private void ValidateArchitecture(Architecture architecture) { if (!SupportedArchitectures.Any(s => s.Equals(architecture.ToString(), StringComparison.OrdinalIgnoreCase))) { throw new PlatformNotSupportedException($"Architecture {architecture.ToString()} is not supported for language {Language}"); } }
public void OverrideNulls(ResourceNode defaultValues) { Init(); if (defaultValues == null) { CheckConsistency(); return; } //ResourceName { get; set; } // private set //public string ProviderName; if (!SupportedArchitectures.Any() && defaultValues.SupportedArchitectures.Any()) { SupportedArchitectures = defaultValues.SupportedArchitectures; // it's ok, because field is read-only } if (Services == null) { Services = new NodeServices(defaultValues.Services); } if (DataFolders == null) { DataFolders = new NodeDataFolders(defaultValues.DataFolders); } Credentials = new NodeCredentials ( userName: (Credentials.Username ?? defaultValues.Credentials.Username), password: (Credentials.Password ?? defaultValues.Credentials.Password), certFile: (Credentials.CertFile ?? defaultValues.Credentials.CertFile) ); if (CoresCount == 0 && defaultValues.CoresCount > 0) { CoresCount = defaultValues.CoresCount; } //if (CoresAvailable == 0 && defaultValues.CoresAvailable > 0) // todo : unnecessary? //CoresAvailable = defaultValues.CoresAvailable; if (TasksSubmissionLimit <= 1 && defaultValues.TasksSubmissionLimit > 1) // do not override if defaultValue == (0 or 1) or non-default value for node is set { TasksSubmissionLimit = defaultValues.TasksSubmissionLimit; } //if (SubmissionsAvailable == 0 && defaultValues.SubmissionsAvailable > 0) // todo : unnecessary? //SubmissionsAvailable = defaultValues.SubmissionsAvailable; if (defaultValues.StaticHardwareParams != null) { foreach (var key in defaultValues.StaticHardwareParams.Keys) { if (!StaticHardwareParams.ContainsKey(key)) { StaticHardwareParams[key] = defaultValues.StaticHardwareParams[key]; } } } if (!_packages.Any()) { foreach (var pack in defaultValues._packages) { _packages.Add(new PackageOnNode(pack)); } } if (!_otherSoftware.Any()) { foreach (var soft in defaultValues._otherSoftware) { _otherSoftware.Add(soft); } } CheckConsistency(); }