Update bundle version to 1.4.4.210 and fix the remove workspace config method
fix the remove workspace config method
update IsUpgradeWorkspaceConfiguration to IsUpgrade for remove workspace config method
@@ -39,14 +39,14 @@ except Exception as e:
# Global Variables
PackagesDirectory = 'packages'
-BundleFileName = 'omsagent-1.4.1-123.universal.x64.sh'
+BundleFileName = 'omsagent-1.4.4-210.universal.x64.sh'
GUIDRegex = r'[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'
GUIDOnlyRegex = r'^' + GUIDRegex + '$'
SCOMCertIssuerRegex = r'^[\s]*Issuer:[\s]*CN=SCX-Certificate/title=SCX' + GUIDRegex + ', DC=.*$'
SCOMPort = 1270
PostOnboardingSleepSeconds = 5
InitialRetrySleepSeconds = 30
-CleanupWorkspaceConfiguration = False
+IsUpgrade = False
# Paths
OMSAdminPath = '/opt/microsoft/omsagent/bin/omsadmin.sh'
@@ -116,6 +116,7 @@ def main():
"""
init_waagent_logger()
waagent_log_info('OmsAgentForLinux started to handle.')
+ global IsUpgrade
# Determine the operation being executed
operation = None
@@ -131,7 +132,7 @@ def main():
operation = 'Enable'
elif re.match('^([-/]*)(update)', option):
operation = 'Update'
- CleanupWorkspaceConfiguration = True
+ IsUpgrade = True
except Exception as e:
waagent_log_error(str(e))
@@ -228,6 +229,7 @@ def uninstall():
"""
package_directory = os.path.join(os.getcwd(), PackagesDirectory)
bundle_path = os.path.join(package_directory, BundleFileName)
+ global IsUpgrade
os.chmod(bundle_path, 100)
cmd = UninstallCommandTemplate.format(bundle_path)
@@ -237,8 +239,9 @@ def uninstall():
exit_code = run_command_with_retries(cmd, retries = 5,
retry_check = retry_if_dpkg_locked_or_curl_is_not_found,
final_check = final_check_if_dpkg_locked)
- if CleanupWorkspaceConfiguration:
- CleanupWorkspaceConfiguration = False
+ if IsUpgrade:
+ IsUpgrade = False
+ else:
remove_workspace_configuration()
return exit_code
@@ -363,6 +366,7 @@ def remove_workspace_configuration():
This method will remove all the files/folders from the workspace path in Etc and Var.
"""
+ public_settings, _ = get_settings()
workspaceId = public_settings.get('workspaceId')
etc_remove_path = os.path.join(EtcOMSAgentPath, workspaceId)
var_remove_path = os.path.join(VarOMSAgentPath, workspaceId)
