Rebase omsagent to latest code base
* Revert "enable rocky and alma (#1543)"
This reverts commit
* Revert "Install GPG if not on VM + Debian 10 Support (#1540)"
This reverts commit
* Revert "Temp revert the code base to release version 1.14.12 (#1547)"
This reverts commit
@@ -117,6 +117,9 @@ OnboardCommandWithOptionalParams = '{0} -w {1} -s {2} {3}'
RestartOMSAgentServiceCommand = '{0} restart'.format(OMSAgentServiceScript)
DisableOMSAgentServiceCommand = '{0} disable'.format(OMSAgentServiceScript)
+InstallExtraPackageCommand = 'apt-get -y update && apt-get -y install {0} || yum install -y {0} '\
+ '|| zypper --non-interactive refresh && zypper --non-interactive install {0}'
+
# Cloud Environments
PublicCloudName = "AzurePublicCloud"
FairfaxCloudName = "AzureUSGovernmentCloud"
@@ -142,6 +145,7 @@ EnableErrorResolvingHost = 7
EnableErrorOnboarding = 8
EnableCalledBeforeSuccessfulInstall = 52 # since install is a missing dependency
UnsupportedOpenSSL = 55 #60, temporary as it excludes from SLA
+UnsupportedGpg = 55
# OneClick error codes
OneClickErrorCode = 40
ManagedIdentityExtMissingErrorCode = 41
@@ -284,6 +288,8 @@ def main():
message = '{0} failed due to low disk space'.format(operation)
log_and_exit(operation, exit_code, message)
+ exit_if_gpg_unavailable(operation)
+
# Invoke operation
try:
global HUtilObject
@@ -921,9 +927,11 @@ def is_vm_supported_for_extension():
supported_dists = {'redhat' : ['6', '7', '8'], 'red hat' : ['6', '7', '8'], 'rhel' : ['6', '7', '8'], # Red Hat
'centos' : ['6', '7', '8'], # CentOS
'oracle' : ['6', '7', '8'], 'ol': ['6', '7', '8'], # Oracle
- 'debian' : ['8', '9'], # Debian
+ 'debian' : ['8', '9', '10'], # Debian
'ubuntu' : ['14.04', '16.04', '18.04', '20.04'], # Ubuntu
'suse' : ['12', '15'], 'sles' : ['12', '15'], # SLES
+ 'rocky' : ['8'], # Rocky
+ 'alma' : ['8'], # Alma
'amzn' : ['2'] # AWS
}
@@ -1010,6 +1018,23 @@ def exit_if_openssl_unavailable(operation):
return 0
+def exit_if_gpg_unavailable(operation):
+ """
+ Check if gpg is available to use
+ If not, attempt to install
+ If install fails, throw error to return UnsupportedGpg error code
+ """
+ check_exit_code, _ = run_get_output('which gpg', True, False)
+ if check_exit_code is not 0:
+ hutil_log_info('GPG not found, attempting to install')
+ exit_code, output = run_get_output(InstallExtraPackageCommand.format('gpg'))
+ if exit_code is not 0:
+ log_and_exit(operation, UnsupportedGpg, 'GPG could not be installed: {0}'.format(output))
+ else:
+ hutil_log_info('GPG successfully installed')
+ return 0
+
+
def check_workspace_id_and_key(workspace_id, workspace_key):
"""
Validate formats of workspace_id and workspace_key
