Skip to content

Commit

Permalink
osbuilder: add option for marking packages optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Meulengracht committed Jul 22, 2022
1 parent 7c36361 commit e89f9fb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion osbuilder/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,20 @@ static async void InstallChefPackage(FileSystems.IFileSystem fileSystem, Project
var temporaryFilePath = Path.GetTempFileName();

Console.Write($"{nameof(Program)} | {nameof(InstallChefPackage)} | Downloading {source.Package}... ");
await Integrations.ChefClient.DownloadPack(temporaryFilePath, source.Package, platform, arch, channel);
try
{
await Integrations.ChefClient.DownloadPack(temporaryFilePath, source.Package, platform, arch, channel);
}
catch (Exception)
{
if (source.Required)
throw new Exception($"{nameof(Program)} | {nameof(InstallChefPackage)} | ERROR: Failed to download {source.Package}");
else
{
Console.WriteLine($"ERROR: Failed to download {source.Package}, skipping");
return;
}
}

// now install the file onto the disk, set the source to the file downloaded
// and set target to the target path
Expand Down
1 change: 1 addition & 0 deletions osbuilder/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ProjectSource
public string Channel { get; set; }
public string Platform { get; set; }
public string Arch { get; set; }
public bool Required { get; set; }
}

public class ProjectPartition
Expand Down

0 comments on commit e89f9fb

Please sign in to comment.