public void OnExecute(string path) { var config = ConductorConfiguration.Load(path); Console.WriteLine($"Deleting {config.ResourceGroupName}..."); AzureFactory.GetAzure().ResourceGroups.DeleteByName(config.ResourceGroupName); }
void CreateConfigIfnotExists() { if (!System.IO.File.Exists(configFilePath)) { CurrentConfiguration = CreateDefaultConfig(); SaveConfig(); } }
ConductorConfiguration CreateDefaultConfig() { var config = new ConductorConfiguration() { ReserveNodes = 0 //remaining data gets fetched from current structure }; NotifyNewLogMessageEvent("Default configuration created"); return(config); }
private void _commandManager_StatusChangedEvent(ConductorConfiguration pBackendConfiguration) { if (_signalrclientmanager.IsConnected) { _signalrclientmanager.SendConfig(pBackendConfiguration); } else { CoreNotifyLogMessage("Trying to send new status, but target host is not connected"); } }
public async void SendConfig(ConductorConfiguration pConfig) { try { await _connection.InvokeAsync("ReportConfiguration", pConfig); NotifyNewLogMessageEvent("Configuration reported"); } catch (Exception ex) { NotifyNewLogMessageEvent($"Something went wrong while sending configuration: {ex.Message}"); } }
public override void Initialize() { //load configuration file var config = LoadConfig(); if (config == null) { CreateConfigIfnotExists(); } else { CurrentConfiguration = config; NotifyNewLogMessageEvent("Configuration loaded"); } base.Initialize(); }
public void UpdateConfiguration(ConductorConfiguration pNewConfig) { //only update certain fields //update reserve nodes CurrentConfiguration.ReserveNodes = pNewConfig.ReserveNodes; //update versions foreach (var remoteVersion in pNewConfig.Versions) { bool matchFound = false; foreach (var localVersion in CurrentConfiguration.Versions) { //find match if (remoteVersion.ToString() == localVersion.ToString()) { //only target models is editable localVersion.TargetModels = remoteVersion.TargetModels; matchFound = true; break; } } //if no local match found, add new version if (!matchFound) { CurrentConfiguration.Versions.Add(remoteVersion); NotifyNewLogMessageEvent($"New remote configuration detected, added {remoteVersion.ToString()} to list."); //TODO file handlings } } //if no remote match found, assume version got deleted var deletedVersions = CurrentConfiguration.Versions.Where(t => !pNewConfig.Versions.Any(u => u.ToString() == t.ToString())); if (deletedVersions.Any()) { foreach (var deletedVersion in deletedVersions) { CurrentConfiguration.Versions.Remove(deletedVersion); NotifyNewLogMessageEvent($"Remote version missing, assuming deletion. Removed {deletedVersion.ToString()} from list."); } } CurrentConfiguration.LastUpdated = DateTime.Now; SaveConfig(); }
public async Task OnExecute(string path) { Program.SetupLogging(); var config = ConductorConfiguration.Load(path); var datacenterTasks = config.Datacenters.Select(d => new DatacenterFactory(config).CreateAsync(d)); var results = await Task.WhenAll(datacenterTasks); Console.WriteLine($"Creating connection between datacenter-1 and datacenter-2"); var peering = await results[0].Item1.Peerings.Define(results[0].Item1.Name + "-peering") .WithRemoteNetwork(results[1].Item1) .CreateAsync(); Console.WriteLine($"Finished creating connection between datacenter-1 and datacenter-2"); var fqdns1 = results[0].Item2.Select(p => p.Fqdn); var fqdns2 = results[1].Item2.Select(p => p.Fqdn); await results[0].Item2.First().FederateAsync(fqdns2); await results[1].Item2.First().FederateAsync(fqdns1); Console.WriteLine("Initialization Complete"); }