public void TestExtractor() { string zippedFilePath = Path.GetFullPath(@"Resources\\Halts.zip"); string zippedFileDir = Path.GetDirectoryName(zippedFilePath); string[] zippedContents = { zippedFileDir + "\\Halts_with_0.exe", zippedFileDir + "\\Halts_with_1.exe" }; foreach (string fileName in zippedContents) { if (File.Exists(fileName)) { File.Delete(fileName); } } ProductSettings settings = new ProductSettings { Name = "testPkg" }; InstallationPackage pkg = new InstallationPackage(settings); PackageExtractor extractor = new PackageExtractor(pkg); extractor.Extract(zippedFilePath, zippedFileDir); foreach (string fileName in zippedContents) { Assert.IsTrue(File.Exists(fileName), "No file named " + fileName); } }
//private static async Task PushPackage(PushOption options, ILogger logger, Stream packageStream) //{ // packageStream.Seek(0, SeekOrigin.Begin); // var client = new StoreClient( // new StoreClientOptions // { // ServerUrl = new Uri(options.ServerUrl) // }); // using (logger.BeginScope("Publishing")) // { // try // { // try // { // await client.Login(new LoginViewModel // { // Email = options.Login, // Password = options.Password // }); // } // catch // { // if (!options.Register) throw; // logger.LogInformation("Registering new user"); // await client.Register(new RegisterViewModel // { // Email = options.Login, // Password = options.Password // }); // await client.Login(new LoginViewModel // { // Email = options.Login, // Password = options.Password // }); // } // await client.SubmitPackage(packageStream); // logger.LogInformation("Package published"); // } // catch (Exception ex) // { // logger.LogError(new EventId(), ex, "Failed to publish package"); // throw; // } // } //} private static async Task ExecuteVerb(InstallOption io) { var logger = new ConsoleLogger("Installer", null, true); using (logger.BeginScope("ExecuteInstall")) { try { var installerFactory = new PackageInstallerFactory(); var appManager = new ApplicationManager(); var package = new InstallationPackage(io.PackagePath); var installer = installerFactory.GetInstaller(package.Manifest.Deploy.Platform); var result = await installer.InstallPackage(package, logger); appManager.WriteAppPackageInstalled(package.Manifest.AppId, result); } catch (Exception ex) { logger.LogError(new EventId(), ex, "Failed to isntall package"); throw; } } }
protected override async Task ExecuteOverrideAsync(ILogger logger) { using (logger.BeginScope("ExecuteInstall")) { try { var installerFactory = new PackageInstallerFactory(); var appManager = new ApplicationManager(); var package = new InstallationPackage(PackagePath); var installer = installerFactory.GetInstaller(package.Manifest.Deploy.Platform); var result = await installer.InstallPackage(package, logger); appManager.WriteAppPackageInstalled( package.Manifest.AppId, result, writeDotykTechFields: true); } catch (Exception ex) { logger.LogError(new EventId(), ex, "Failed to isntall package"); throw; } } }
public static InstallationPackage CreateCustomPackage(string productLogic, string name) { InstallationPackage pkg; if (string.IsNullOrEmpty(productLogic)) { pkg = new InstallationPackage(name); } else if (typeof(PkgDownloadAndRun).Name.Equals(productLogic)) { pkg = new PkgDownloadAndRun(name); } else if (typeof(PkgDownloadAndRunAndWait).Name.Equals(productLogic)) { pkg = new PkgDownloadAndRunAndWait(name); } else if (typeof(PkgDownloadAndRunAndWaitWithParamsChange).Name.Equals(productLogic)) { pkg = new PkgDownloadAndRunAndWaitWithParamsChange(name); } else if (typeof(PkgRunOnClose).Name.Equals(productLogic)) { pkg = new PkgRunOnClose(name); } else { pkg = new InstallationPackage(name); } return(pkg); }
public ViewPackageModel(InstallationPackage package) { if (package != null) { PackageName = package.PackageName; InstallCommandLine = package.PackageInstallCommand; Container = package.Container; Type = package.Type; switch (package.Type) { case InstallationPackageType.Qube610: case InstallationPackageType.Qube70: InitQubePackage(package); break; case InstallationPackageType.Deadline10: case InstallationPackageType.Tractor2: case InstallationPackageType.OpenCue: case InstallationPackageType.Gpu: case InstallationPackageType.General: InitGeneralPackage(package); break; } } }
private void InitQubePackage(InstallationPackage package) { PythonInstaller = package.Files.FirstOrDefault(f => f.ToLower().Contains("python")); QubeCoreInstaller = package.Files.FirstOrDefault(f => f.ToLower().Contains("qube-core")); QubeWorkerInstaller = package.Files.FirstOrDefault(f => f.ToLower().Contains("qube-worker")); // TODO regex for below? QubeJobTypes = package.Files.Where(f => f.ToLower().StartsWith("qube-") && f.ToLower().Contains("jt-")).ToList(); }
public InstallationPackage CreatePackage(string productLogic, string name) { InstallationPackage pkg = CustomPackage.CreateCustomPackage(productLogic, name); pkg.HandleProgress = HandleProgressUpdate; packageDictionary.Add(name, pkg); return(pkg); }
internal void DeclinePackge(string name) { if (packageDictionary.ContainsKey(name)) { InstallationPackage pkgToDecline = packageDictionary[name]; pkgToDecline.ChangeState(InstallationPackage.State.Skipped); } }
public PackageDownloaderBits(InstallationPackage installationPackage) : base(installationPackage) { aTimer = new Timer { Interval = TIMER_INTERVAL_MS, Enabled = false }; aTimer.Elapsed += new ElapsedEventHandler(TimerElapsed); }
public async Task <StartTask> GetDeadlineStartTask( string poolName, IEnumerable <string> additionalPools, IEnumerable <string> additionalGroups, RenderingEnvironment environment, InstallationPackage deadlinePackage, InstallationPackage gpuPackage, IEnumerable <InstallationPackage> generalPackages, bool isWindows, bool useGroups) { await Task.CompletedTask; if (environment == null || environment.RenderManagerConfig == null || environment.RenderManager != RenderManagerType.Deadline) { throw new Exception("Wrong environment for Deadline."); } var resourceFiles = new List <ResourceFile>(); var startTask = new StartTask( "", resourceFiles, GetEnvironmentSettings(environment, isWindows), new UserIdentity( autoUser: new AutoUserSpecification(AutoUserScope.Pool, ElevationLevel.Admin)), 3, // retries true); // waitForSuccess AppendGpu(startTask, gpuPackage); AppendGeneralPackages(startTask, generalPackages); AppendDeadlineSetupToStartTask( environment, poolName, additionalPools, additionalGroups, startTask, environment.RenderManagerConfig.Deadline, deadlinePackage, isWindows, useGroups); // Wrap all the start task command if (isWindows) { startTask.CommandLine = $"powershell.exe -ExecutionPolicy RemoteSigned -NoProfile \"$ErrorActionPreference='Stop'; {startTask.CommandLine}\""; } else { startTask.CommandLine = $"/bin/bash -c 'set -e; set -o pipefail; {startTask.CommandLine}'"; } return(startTask); }
internal void DiscardPackge(string name, string errorMessage) { if (packageDictionary.ContainsKey(name)) { InstallationPackage pkgToDiscard = packageDictionary[name]; pkgToDiscard.ErrorMessage = errorMessage; pkgToDiscard.ChangeState(InstallationPackage.State.Discard); } }
private async Task AppendQubeSetupToStartTask( RenderingEnvironment environment, string poolName, IEnumerable <string> additionalGroups, StartTask startTask, QubeConfig qubeConfig, InstallationPackage qubePackage, bool isWindows) { var commandLine = startTask.CommandLine; var resourceFiles = new List <ResourceFile>(startTask.ResourceFiles); var startTaskScriptUrl = isWindows ? GetWindowsStartTaskUrl(environment) : GetLinuxStartTaskUrl(environment); var uri = new Uri(startTaskScriptUrl); var filename = uri.AbsolutePath.Split('/').Last(); var installScriptResourceFile = new ResourceFile(httpUrl: startTaskScriptUrl, filePath: filename); resourceFiles.Add(installScriptResourceFile); var workerGroups = $"azure,{poolName}"; if (additionalGroups != null && additionalGroups.Any()) { workerGroups += $",{string.Join(',', additionalGroups)}"; } commandLine += $".\\{installScriptResourceFile.FilePath} " + $"-qubeSupervisorIp {qubeConfig.SupervisorIp} " + $"-workerHostGroups '{workerGroups}'"; if (qubePackage != null && !string.IsNullOrEmpty(qubePackage.Container)) { resourceFiles.AddRange(await GetResourceFilesFromContainer(qubePackage.Container)); // Add qb.conf if one isn't already specified by the package if (!resourceFiles.Any(rf => rf.FilePath.Contains("qb.conf"))) { var qbConfResourceFile = new ResourceFile(httpUrl: _configuration["Qube:QbConf"], filePath: "qb.conf"); resourceFiles.Add(qbConfResourceFile); } } else { // No package, lets just configure commandLine += " -skipInstall "; } commandLine += ";"; startTask.CommandLine = commandLine; startTask.ResourceFiles = resourceFiles; }
internal void HandleProgressUpdate(InstallationPackage pkg) { lock (progressLock) { if ((pkg.InstallationState > InstallationPackage.State.Init) && (pkg.DwnldBytesOffset > 0)) { if (!pkg.hasUpdatedTotal) { dwnldBytesTotal += pkg.DwnldBytesTotal; pkg.hasUpdatedTotal = true; pkgRunningCounter++; } dwnldBytesReceived += pkg.DwnldBytesOffset; currentProgress = Math.Round(100.0 * dwnldBytesReceived / dwnldBytesTotal); } if (pkg.isProgressCompleted && !pkg.isUpdatedProgressCompleted) { pkgCompletedCounter++; if (pkg.hasUpdatedTotal) { pkgRunningCounter--; } pkg.isUpdatedProgressCompleted = true; #if DEBUG Logger.GetLogger().Info(string.Format("[{0}] Package Progress completed", pkg.Name)); #endif } if (packageDictionary.Count > pkgRunningCounter + pkgCompletedCounter) { return; } if ((currentProgress > 100) || (packageDictionary.Count == pkgCompletedCounter)) { currentProgress = 100; } if (((DateTime.Now - progressSampleTime).TotalMilliseconds < 100) && (currentProgress != 100)) { return; } progressSampleCnt = (progressSampleCnt < 50) ? progressSampleCnt + 1 : 1; avgDwnldSpeed = avgDwnldSpeed * (progressSampleCnt - 1) / progressSampleCnt + CalcCurrentDownloadSpeed(dwnldBytesReceived) / progressSampleCnt; progressSampleTime = DateTime.Now; ProgressEventArgs progressEvent = new ProgressEventArgs("", Convert.ToInt32(currentProgress), dwnldBytesReceived, dwnldBytesTotal, avgDwnldSpeed, packageDictionary.Count == pkgCompletedCounter); ProgressBarUpdater.HandleProgress(progressEvent); } }
private void AppendOpenCueParamsToStartTask( PoolConfigurationModel poolConfiguration, RenderingEnvironment environment, StartTask startTask, OpenCueConfig openCueConfig, InstallationPackage openCuePackage, bool isWindows) { var commandLine = startTask.CommandLine; var resourceFiles = new List <ResourceFile>(startTask.ResourceFiles); if (environment.KeyVaultServicePrincipal != null) { commandLine += GetParameterSet(isWindows, "tenantId", environment.KeyVaultServicePrincipal.TenantId.ToString()); commandLine += GetParameterSet(isWindows, "applicationId", environment.KeyVaultServicePrincipal.ApplicationId.ToString()); commandLine += GetParameterSet(isWindows, "keyVaultCertificateThumbprint", environment.KeyVaultServicePrincipal.Thumbprint); commandLine += GetParameterSet(isWindows, "keyVaultName", environment.KeyVault.Name); } if (!string.IsNullOrWhiteSpace(openCueConfig.CuebotHostnameOrIp)) { commandLine += GetParameterSet(isWindows, "cuebotHost", openCueConfig.CuebotHostnameOrIp); } if (!string.IsNullOrWhiteSpace(openCueConfig.Facility)) { commandLine += GetParameterSet(isWindows, "facility", openCueConfig.Facility); } var groups = $"azure,{poolConfiguration.PoolName}"; if (poolConfiguration.AdditionalGroups != null && poolConfiguration.AdditionalGroups.Any()) { groups += $",{string.Join(',', poolConfiguration.AdditionalGroups)}"; } if (!string.IsNullOrWhiteSpace(groups)) { commandLine += GetParameterSet(isWindows, "groups", groups); } if (openCuePackage != null && !string.IsNullOrEmpty(openCuePackage.Container)) { resourceFiles.Add(GetContainerResourceFile(openCuePackage.Container, openCuePackage.PackageName)); commandLine += GetParameterSet(isWindows, "installerPath", openCuePackage.PackageName); } commandLine += ";"; startTask.CommandLine = commandLine; startTask.ResourceFiles = resourceFiles; }
private async Task AppendGpu(StartTask startTask, InstallationPackage gpuPackage) { if (gpuPackage != null) { var resourceFiles = new List <ResourceFile>(startTask.ResourceFiles); resourceFiles.Add(GetContainerResourceFile(gpuPackage.Container, gpuPackage.PackageName)); startTask.ResourceFiles = resourceFiles; if (!string.IsNullOrWhiteSpace(gpuPackage.PackageInstallCommand)) { var cmd = gpuPackage.PackageInstallCommand.Replace("{filename}", resourceFiles.First().FilePath); startTask.CommandLine += $"cd {gpuPackage.PackageName}; {cmd}; cd..; "; } } }
private void AppendGpu(StartTask startTask, InstallationPackage gpuPackage) { if (gpuPackage != null) { var resourceFile = GetContainerResourceFile(gpuPackage.Container, gpuPackage.PackageName); startTask.ResourceFiles = new List <ResourceFile>(startTask.ResourceFiles) { resourceFile }; if (!string.IsNullOrWhiteSpace(gpuPackage.PackageInstallCommand)) { startTask.CommandLine += $"pushd {gpuPackage.PackageName}; {gpuPackage.PackageInstallCommand}; popd; "; } } }
private async Task AppendQubeParamsToStartTask( PoolConfigurationModel poolConfiguration, RenderingEnvironment environment, StartTask startTask, QubeConfig qubeConfig, InstallationPackage qubePackage, bool isWindows) { var commandLine = startTask.CommandLine; var resourceFiles = new List <ResourceFile>(startTask.ResourceFiles); var workerGroups = $"azure,{poolConfiguration.PoolName}"; if (poolConfiguration.AdditionalGroups != null && poolConfiguration.AdditionalGroups.Any()) { workerGroups += $",{string.Join(',', poolConfiguration.AdditionalGroups)}"; } commandLine += $"-qubeSupervisorIp {qubeConfig.SupervisorIp} " + $"-workerHostGroups '{workerGroups}'"; if (qubePackage != null && !string.IsNullOrEmpty(qubePackage.Container)) { resourceFiles.AddRange(await GetResourceFilesFromContainer(qubePackage.Container)); // Add qb.conf if one isn't already specified by the package if (!resourceFiles.Any(rf => rf.FilePath.Contains("qb.conf"))) { var qbConfResourceFile = new ResourceFile(httpUrl: _configuration["Qube:QbConf"], filePath: "qb.conf"); resourceFiles.Add(qbConfResourceFile); } } else { // No package, lets just configure commandLine += " -skipInstall "; } commandLine += ";"; startTask.CommandLine = commandLine; startTask.ResourceFiles = resourceFiles; }
public async Task <StartTask> GetQubeStartTask( string poolName, IEnumerable <string> additionalGroups, RenderingEnvironment environment, InstallationPackage qubePackage, InstallationPackage gpuPackage, IEnumerable <InstallationPackage> generalPackages, bool isWindows) { var resourceFiles = new List <ResourceFile>(); var startTask = new StartTask( "", resourceFiles, GetEnvironmentSettings(environment, isWindows), new UserIdentity( autoUser: new AutoUserSpecification(AutoUserScope.Pool, ElevationLevel.Admin)), 3, // retries true); // waitForSuccess AppendGpu(startTask, gpuPackage); AppendDomainSetup(startTask, environment); AppendGeneralPackages(startTask, generalPackages); await AppendQubeSetupToStartTask( environment, poolName, additionalGroups, startTask, environment.RenderManagerConfig.Qube, qubePackage, isWindows); // Wrap all the start task command startTask.CommandLine = $"powershell.exe -ExecutionPolicy RemoteSigned -NoProfile \"$ErrorActionPreference='Stop'; {startTask.CommandLine}\""; return(startTask); }
/// <summary> /// Reads the installation description and ShowDialog. /// </summary> /// <returns></returns> internal bool?Open() { StackPanelButtons.Children.Clear(); StackPanelButtons.Children.Add(ButtonOK); StackPanelButtons.Children.Add(ButtonCancel); // Configure open file dialog box Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = Properties.Settings.Default.PackageName; // Default file name dlg.DefaultExt = Properties.Settings.Default.PackageExtension; // Default file extension string _filterFormat = "Installation package ({0})|*{0}"; dlg.Filter = String.Format(_filterFormat, Properties.Settings.Default.PackageExtension); // Filter files by extension // Process open file dialog box results if (!dlg.ShowDialog().GetValueOrDefault(false)) { return(false); } FileInfo _location = new FileInfo(dlg.FileName); PackageProperties = InstalationPackageProperties.GetProperties(InstallationPackage.ReadPackageProperties(_location), _location); x_MainGrid.IsEnabled = false; return(this.ShowDialog()); }
public bool NextLayout() { if (_productLayouts != null && _productIndex < _productLayouts.Count) { _currntLayout = _productLayouts[_productIndex]; if (!_currntLayout.controlLayout.ResourcesReady) { InstallationPackage package = _packageManager.GetPackageByName(_currntLayout.productName); if (package != null) { package.ErrorMessage = $"missing resource for control layout"; OnLayoutError(_currntLayout.productName, _productIndex); package.OnInstallFailed?.Invoke(ErrorConsts.ERR_PKG_MISSING_LAYOUT_RESOURCES, package.ErrorMessage); } _productIndex++; _internalSkippedProducts++; _currntLayout.controlLayout.StopWaitingForResources(); _currntLayout = null; return(NextLayout()); } if (_pnlLayout.Controls.Count > 0) { _pnlLayout.Resize -= ((ProductControl)_pnlLayout.Controls[0]).HandleChanges; } _pnlLayout.Controls.Clear(); _pnlLayout.Controls.Add(_currntLayout.productLayout); _currntLayout.productLayout.HandleChanges(); _pnlLayout.Resize += ((ProductControl)_pnlLayout.Controls[0]).HandleChanges; _optLayout = new OptLayout(_pnlLayout, 4); OnLayoutShown(_currntLayout.productName, _productIndex); } _productIndex++; return(_productLayouts == null || _productIndex <= _productLayouts.Count); }
public async Task <StartTask> GetStartTask( PoolConfigurationModel poolConfiguration, RenderingEnvironment environment, InstallationPackage renderManagerPackage, InstallationPackage gpuPackage, IEnumerable <InstallationPackage> generalPackages, bool isWindows) { var resourceFiles = new List <ResourceFile>(); var startTask = new StartTask( "", resourceFiles, GetEnvironmentSettings(environment, isWindows), new UserIdentity( autoUser: new AutoUserSpecification(AutoUserScope.Pool, ElevationLevel.Admin)), 3, // retries true); // waitForSuccess AppendGpu(startTask, gpuPackage); AppendDomainSetup(startTask, environment); AppendGeneralPackages(startTask, generalPackages); // Appends the start task script, i.e. deadline-starttask.ps1 or tractor-starttask.ps1 AppendRenderManagerStartTask(environment, startTask, isWindows); // Appends the render manager specific parameters and package (if specified) switch (environment.RenderManager) { case RenderManagerType.Deadline: AppendDeadlineParamsToStartTask( poolConfiguration, environment, startTask, environment.RenderManagerConfig.Deadline, renderManagerPackage, isWindows); break; case RenderManagerType.OpenCue: AppendOpenCueParamsToStartTask( poolConfiguration, environment, startTask, environment.RenderManagerConfig.OpenCue, renderManagerPackage, isWindows); break; case RenderManagerType.Qube610: case RenderManagerType.Qube70: await AppendQubeParamsToStartTask( poolConfiguration, environment, startTask, environment.RenderManagerConfig.Qube, renderManagerPackage, isWindows); break; case RenderManagerType.Tractor2: AppendTractorParamsToStartTask( poolConfiguration, environment, startTask, environment.RenderManagerConfig.Tractor, renderManagerPackage, isWindows); break; case RenderManagerType.BYOS: AppendBYOSParamsToStartTask( poolConfiguration, environment, startTask, environment.RenderManagerConfig.BYOS, isWindows); break; } // Wrap all the start task command if (isWindows) { startTask.CommandLine = $"powershell.exe -ExecutionPolicy RemoteSigned -NoProfile \"$ErrorActionPreference='Stop'; {startTask.CommandLine}\""; } else { startTask.CommandLine = $"/bin/bash -c 'set -e; set -o pipefail; {startTask.CommandLine}'"; } return(startTask); }
public PackageDownloader(InstallationPackage installationPackage) { this.installationPackage = installationPackage; //ServicePointManager.Expect100Continue = true; //ServicePointManager.SecurityProtocol = (SecurityProtocolType)0xF00; // Allow variety of protocols to support different clients }
private void AppendDeadlineSetupToStartTask( RenderingEnvironment environment, string poolName, IEnumerable <string> additionalPools, IEnumerable <string> additionalGroups, StartTask startTask, DeadlineConfig deadlineConfig, InstallationPackage deadlinePackage, bool isWindows, bool useGroups) { var commandLine = startTask.CommandLine; var resourceFiles = new List <ResourceFile>(startTask.ResourceFiles); var startTaskScriptUrl = isWindows ? GetWindowsStartTaskUrl(environment) : GetLinuxStartTaskUrl(environment); var uri = new Uri(startTaskScriptUrl); var filename = uri.AbsolutePath.Split('/').Last(); var installScriptResourceFile = new ResourceFile(httpUrl: startTaskScriptUrl, filePath: filename); resourceFiles.Add(installScriptResourceFile); if (isWindows) { commandLine += $".\\{installScriptResourceFile.FilePath} "; } else { commandLine += $"./{installScriptResourceFile.FilePath} "; } if (deadlinePackage != null && !string.IsNullOrEmpty(deadlinePackage.Container)) { resourceFiles.Add(GetContainerResourceFile(deadlinePackage.Container, deadlinePackage.PackageName)); commandLine += GetParameterSet(isWindows, "installerPath", deadlinePackage.PackageName); } if (isWindows & environment.Domain != null && environment.Domain.JoinDomain) { commandLine += GetParameterSet(isWindows, "domainJoin"); commandLine += GetParameterSet(isWindows, "domainName", environment.Domain.DomainName); commandLine += GetParameterSet(isWindows, "domainJoinUserName", environment.Domain.DomainJoinUsername); if (!string.IsNullOrWhiteSpace(environment.Domain.DomainWorkerOuPath)) { commandLine += GetParameterSet(isWindows, "domainOuPath", environment.Domain.DomainWorkerOuPath); } } if (environment.KeyVaultServicePrincipal != null) { commandLine += GetParameterSet(isWindows, "tenantId", environment.KeyVaultServicePrincipal.TenantId.ToString()); commandLine += GetParameterSet(isWindows, "applicationId", environment.KeyVaultServicePrincipal.ApplicationId.ToString()); commandLine += GetParameterSet(isWindows, "keyVaultCertificateThumbprint", environment.KeyVaultServicePrincipal.Thumbprint); commandLine += GetParameterSet(isWindows, "keyVaultName", environment.KeyVault.Name); } var repoPath = isWindows ? deadlineConfig.WindowsRepositoryPath : deadlineConfig.LinuxRepositoryPath; if (!string.IsNullOrWhiteSpace(repoPath)) { commandLine += GetParameterSet(isWindows, "deadlineRepositoryPath", deadlineConfig.WindowsRepositoryPath); } if (!string.IsNullOrEmpty(deadlineConfig.RepositoryUser)) { commandLine += GetParameterSet(isWindows, "deadlineRepositoryUserName", deadlineConfig.RepositoryUser); } if (!string.IsNullOrEmpty(deadlineConfig.ServiceUser)) { commandLine += GetParameterSet(isWindows, "deadlineServiceUserName", deadlineConfig.ServiceUser); } else { // If the Deadline slave is running under the start task context (not a service) // then we don't want to wait for success as it will block after launching the // Deadline launcher to prevent it being killed. startTask.WaitForSuccess = false; } if (deadlineConfig.LicenseMode != null) { commandLine += GetParameterSet(isWindows, "deadlineLicenseMode", deadlineConfig.LicenseMode.ToString()); } if (!string.IsNullOrEmpty(deadlineConfig.DeadlineRegion)) { commandLine += GetParameterSet(isWindows, "deadlineRegion", deadlineConfig.DeadlineRegion); } if (!string.IsNullOrEmpty(deadlineConfig.LicenseServer)) { commandLine += GetParameterSet(isWindows, "deadlineLicenseServer", deadlineConfig.LicenseServer); } var pools = useGroups ? "" : poolName; if (additionalPools != null && additionalPools.Any()) { pools += string.IsNullOrEmpty(pools) ? "" : ","; pools += string.Join(',', additionalPools); } if (!string.IsNullOrEmpty(pools)) { commandLine += GetParameterSet(isWindows, "deadlinePools", pools); } var groups = useGroups ? poolName : ""; if (additionalGroups != null && additionalGroups.Any()) { groups += string.IsNullOrEmpty(groups) ? "" : ","; groups += string.Join(',', additionalGroups); } if (!string.IsNullOrEmpty(groups)) { commandLine += GetParameterSet(isWindows, "deadlineGroups", groups); } if (!string.IsNullOrWhiteSpace(deadlineConfig.ExcludeFromLimitGroups)) { commandLine += GetParameterSet(isWindows, "excludeFromLimitGroups", deadlineConfig.ExcludeFromLimitGroups); } commandLine += "; "; if (!isWindows) { commandLine += "wait"; } startTask.CommandLine = commandLine; startTask.ResourceFiles = resourceFiles; }
internal void SetProductsSettings(List <ProductSettings> productsSettings) { int maxOptionalProducts = ConfigParser.GetConfig().GetIntValue("//RemoteConfiguration/FlowSettings/MaxProducts", int.MaxValue); maxOptionalProducts = maxOptionalProducts == -1 ? int.MaxValue : maxOptionalProducts; int optionalProducts = 0; foreach (ProductSettings prodSettings in productsSettings) { if (packageDictionary.ContainsKey(prodSettings.Name)) { continue; } if (prodSettings.IsOptional && (optionalProducts >= maxOptionalProducts)) { #if DEBUG Logger.GetLogger().Info($"[{prodSettings.Name}] product will not be shown since the limit of optional products to show is: {maxOptionalProducts}"); #endif continue; } if ((prodSettings.PreInstall.RequirementList != null) && (prodSettings.PreInstall.RequirementsList != null)) { RequirementHandlers reqHandlers = new RequirementHandlers(); #if DEBUG Logger.GetLogger().Info("[" + prodSettings.Name + "] Checking requirements for product:"); #endif ProductSettings tmpProdSettings = prodSettings; bool res = default; if (productClasses.Contains(tmpProdSettings.Class)) { res = false; #if DEBUG Logger.GetLogger().Info($"Class ({tmpProdSettings.Class}) <Exists> [{string.Join(", ", productClasses)}] => False"); #endif tmpProdSettings.PreInstall.UnfulfilledRequirementType = "Class"; } else { res = reqHandlers.HandlersResult(ref tmpProdSettings.PreInstall); } if (!res) { OnDiscardPackage(null, tmpProdSettings); continue; } } if (!string.IsNullOrEmpty(prodSettings.Class)) { productClasses.Add(prodSettings.Class); } if (prodSettings.IsOptional) { optionalProducts++; } InstallationPackage pkg = CreatePackage(prodSettings.Behavior, prodSettings.Name); productLayoutManager.AddProductSettings(prodSettings); OnCreatePackage(pkg, prodSettings); } }
public async Task UpdatePackage(InstallationPackage package) { await _configCoordinator.Update(package, package.PackageName, null); }
public PackageDownloaderWebClient(InstallationPackage installationPackage) : base(installationPackage) { isDownloading = false; }
public PackageExtractor(InstallationPackage installationPackage) { this.installationPackage = installationPackage; }
public async Task <bool> RemovePackage(InstallationPackage package) { return(await _configCoordinator.Remove(package.PackageName)); }
private void InitGeneralPackage(InstallationPackage package) { Files = package.Files == null ? "" : string.Join(", ", package.Files); }
private async Task AppendDeadlineSetupToStartTask( RenderingEnvironment environment, string poolName, StartTask startTask, DeadlineConfig deadlineConfig, InstallationPackage deadlinePackage, bool isWindows, bool useGroups) { var commandLine = startTask.CommandLine; var resourceFiles = new List <ResourceFile>(startTask.ResourceFiles); var startTaskScriptUrl = isWindows ? GetWindowsStartTaskUrl(environment) : GetLinuxStartTaskUrl(environment); var uri = new Uri(startTaskScriptUrl); var filename = uri.AbsolutePath.Split('/').Last(); var installScriptResourceFile = new ResourceFile(httpUrl: startTaskScriptUrl, filePath: filename); resourceFiles.Add(installScriptResourceFile); commandLine += $".\\{installScriptResourceFile.FilePath}"; if (deadlinePackage != null && !string.IsNullOrEmpty(deadlinePackage.Container)) { resourceFiles.Add(GetContainerResourceFile(deadlinePackage.Container, deadlinePackage.PackageName)); commandLine += $" -installerPath {deadlinePackage.PackageName}"; } if (environment.Domain.JoinDomain) { commandLine += " -domainJoin"; commandLine += $" -domainName {environment.Domain.DomainName}"; commandLine += $" -domainJoinUserName {environment.Domain.DomainJoinUsername}"; if (!string.IsNullOrWhiteSpace(environment.Domain.DomainWorkerOuPath)) { commandLine += $" -domainOuPath '{environment.Domain.DomainWorkerOuPath}'"; } } if (environment.KeyVaultServicePrincipal != null) { commandLine += $" -tenantId {environment.KeyVaultServicePrincipal.TenantId}"; commandLine += $" -applicationId {environment.KeyVaultServicePrincipal.ApplicationId}"; commandLine += $" -keyVaultCertificateThumbprint {environment.KeyVaultServicePrincipal.Thumbprint}"; commandLine += $" -keyVaultName {environment.KeyVault.Name}"; } commandLine += $" -deadlineRepositoryPath {deadlineConfig.WindowsRepositoryPath}"; if (!string.IsNullOrEmpty(deadlineConfig.RepositoryUser)) { commandLine += $" -deadlineRepositoryUserName {deadlineConfig.RepositoryUser}"; } if (!string.IsNullOrEmpty(deadlineConfig.ServiceUser)) { commandLine += $" -deadlineServiceUserName {deadlineConfig.ServiceUser}"; } else { // If the Deadline slave is running under the start task context (not a service) // then we don't want to wait for success as it will block after launching the // Deadline launcher to prevent it being killed. startTask.WaitForSuccess = false; } commandLine += $" -deadlineLicenseMode {deadlineConfig.LicenseMode.ToString()}"; if (!string.IsNullOrEmpty(deadlineConfig.DeadlineRegion)) { commandLine += $" -deadlineRegion {deadlineConfig.DeadlineRegion}"; } if (!string.IsNullOrEmpty(deadlineConfig.LicenseServer)) { commandLine += $" -deadlineLicenseServer {deadlineConfig.LicenseServer}"; } if (useGroups) { commandLine += $" -deadlineGroups {poolName}"; } else { commandLine += $" -deadlinePools {poolName}"; } if (!string.IsNullOrWhiteSpace(deadlineConfig.ExcludeFromLimitGroups)) { commandLine += $" -excludeFromLimitGroups '{deadlineConfig.ExcludeFromLimitGroups}'"; } commandLine += ";"; startTask.CommandLine = commandLine; startTask.ResourceFiles = resourceFiles; }