diff options
Diffstat (limited to 'Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/EnvironmentManager.cs')
| -rw-r--r-- | Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/EnvironmentManager.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/EnvironmentManager.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/EnvironmentManager.cs index 83b0c29ee..53665a73d 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/EnvironmentManager.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/EnvironmentManager.cs @@ -453,5 +453,61 @@ namespace Tango.AzureUtils.Environment } #endregion + + #region Rollback + + public async Task RollbackEnvironment(IWebAppBase app, RollbackEnvironmentConfiguration config) + { + OnProgress(AzureUtilsStage.Environment, $"Retrieving settings for '{app.Name}'..."); + + var settings = await app.GetMachineServiceSettingsAsync(); + await _storageManager.Connect(settings.STORAGE_ACCOUNT); + + if (config.RollbackMachineStudio) + { + try + { + await _storageManager.DowngradeMachineStudioStorage(app); + } + catch (Exception ex) + { + await RequestConfirmation($"Error occurred while trying to remove machine studio storage blobs.\n{ex.FlattenMessage()}\nDo you wish to continue?"); + } + + try + { + await _databaseManager.DowngradeMachineStudioVersion(app); + } + catch (Exception ex) + { + await RequestConfirmation($"Error occurred while trying to remove machine studio database version.\n{ex.FlattenMessage()}\nDo you wish to continue?"); + } + } + + if (config.RollbackPPC) + { + try + { + await _storageManager.DowngradePPCStorage(app); + } + catch (Exception ex) + { + await RequestConfirmation($"Error occurred while trying to remove PPC storage blobs.\n{ex.FlattenMessage()}\nDo you wish to continue?"); + } + + try + { + await _databaseManager.DowngradePPCVersion(app); + } + catch (Exception ex) + { + await RequestConfirmation($"Error occurred while trying to remove PPC database version.\n{ex.FlattenMessage()}\nDo you wish to continue?"); + } + } + + OnCompleted("Environment rollback completed successfully."); + } + + #endregion } } |
