Conversation
| { | ||
| class UninstallAppCommand : BaseCommand | ||
| { | ||
| public UninstallAppCommand() : this("uninstallApp", "[Preview] Uninstalls an app from a customer environment version") |
There was a problem hiding this comment.
the command name should be uninstall-app
There was a problem hiding this comment.
Preview is not needed for this one. Actually, please take the time to remove the preview from the undeploy, its already GA.
|
|
||
| public UninstallAppCommand(string name, string description = null) : base(name, description) | ||
| { | ||
| Add(new Option<string>(new[] { "--appName", }, Resources.CUSTOMER_ENVIRONMENT_APPLICATION_PACKAGE_NAME_HELP) |
There was a problem hiding this comment.
The app name option should be:
- -n
- --name
| { | ||
| IsRequired = true | ||
| }); | ||
| Add(new Option<string>(new[] { "--customerEnvironmentName", }, Resources.CUSTOMER_ENVIRONMENT_NAME_HELP) |
There was a problem hiding this comment.
The customer env name should be:
- -ce
- --customer-environment
| }, | ||
| "Uninstall App": { | ||
| "commandName": "Project", | ||
| "commandLineArgs": "uninstallApp --customerEnvironmentName \"env-name\" --appName \"Dummy\"" |
There was a problem hiding this comment.
This needs to be updated after the command options are updated
There was a problem hiding this comment.
Additionally, the README needs update to include the new cmd
| public const string REPLACETOKENS_HELP = "Replace the tokens specified in the input files using the proper syntax (e.g. #{MyToken}#) with the specified values. E.g. MyToken=value MyToken2=value2."; | ||
|
|
||
| public const string CUSTOMER_ENVIRONMENT_NAME_HELP = "Name of the Customer Environment to be used."; | ||
| public const string CUSTOMER_ENVIRONMENT_APPLICATION_PACKAGE_NAME_HELP = "Name of the App to be uninstalled."; |
There was a problem hiding this comment.
Const name should be scoped to uninstall
| try | ||
| { | ||
| customerEnvironment = await customerPortalClient.GetObjectByName<CustomerEnvironment>(customerEnvironmentName); | ||
| customerEnvironment = await customerPortalClient.GetCustomerEnvironmentById(customerEnvironment.Id, 1); |
There was a problem hiding this comment.
the first one doesn't load the relations.
| Session.LogError($"Customer environment '{customerEnvironmentName}' is terminated; uninstall cannot proceed."); | ||
| return; | ||
| } | ||
| if (customerEnvironment.Status == DeploymentStatus.NotDeployed) |
There was a problem hiding this comment.
We actually defined that we should get the last non-NotDeployed version.
| return; | ||
| } | ||
|
|
||
| await customerPortalClient.StartAppUninstall(customerEnvironmentApplicationPackage.Id, terminateOtherVersionsRemove, terminateOtherVersionsRemoveVolumes); |
There was a problem hiding this comment.
This is missing the logic to get the logs/feedback and wait until the process is over.
| await customerPortalClient.StartAppUninstall(customerEnvironmentApplicationPackage.Id, terminateOtherVersionsRemove, terminateOtherVersionsRemoveVolumes); | ||
| Session.LogInformation($"Uninstall request submitted for application '{appName}' (relation id: {customerEnvironmentApplicationPackage.Id}) in environment '{customerEnvironmentName}'."); | ||
| } | ||
| else |
There was a problem hiding this comment.
suggestion: For readability purposes, you can just add an if condition before and return right away if no installed app was found.
Changes