diff --git a/azurelinuxagent/common/event.py b/azurelinuxagent/common/event.py index 514c727fff..fe313968fe 100644 --- a/azurelinuxagent/common/event.py +++ b/azurelinuxagent/common/event.py @@ -109,6 +109,7 @@ class WALAEventOperation: OpenSsl = "OpenSsl" Partition = "Partition" PersistFirewallRules = "PersistFirewallRules" + ProvisionAfterExtensions = "ProvisionAfterExtensions" PluginSettingsVersionMismatch = "PluginSettingsVersionMismatch" InvalidExtensionConfig = "InvalidExtensionConfig" Provision = "Provision" diff --git a/azurelinuxagent/common/protocol/extensions_goal_state_from_vm_settings.py b/azurelinuxagent/common/protocol/extensions_goal_state_from_vm_settings.py index f6496bfd38..664d1e868f 100644 --- a/azurelinuxagent/common/protocol/extensions_goal_state_from_vm_settings.py +++ b/azurelinuxagent/common/protocol/extensions_goal_state_from_vm_settings.py @@ -22,6 +22,7 @@ from azurelinuxagent.common import logger from azurelinuxagent.common.AgentGlobals import AgentGlobals +from azurelinuxagent.common.event import WALAEventOperation, add_event from azurelinuxagent.common.future import ustr from azurelinuxagent.common.protocol.extensions_goal_state import ExtensionsGoalState, GoalStateChannel, VmSettingsParseError from azurelinuxagent.common.protocol.restapi import VMAgentFamily, Extension, ExtensionRequestedState, ExtensionSettings @@ -492,11 +493,28 @@ def _parse_dependency_level(depends_on, extension): length = len(depends_on) if length > 1: raise Exception('dependsOn should be an array with exactly one item for single-config extensions ({0}) (got {1})'.format(extension.name, depends_on)) - elif length == 0: + if length == 0: logger.warn('dependsOn is an empty array for extension {0}; setting the dependency level to 0'.format(extension.name)) - extension.settings[0].dependencyLevel = 0 + dependency_level = 0 else: - extension.settings[0].dependencyLevel = depends_on[0]['dependencyLevel'] + dependency_level = depends_on[0]['dependencyLevel'] + depends_on_extension = depends_on[0].get('dependsOnExtension') + if depends_on_extension is None: + # TODO: Consider removing this check and its telemetry after a few releases if we do not receive any telemetry indicating + # that dependsOnExtension is actually missing from the vmSettings + message = 'Missing dependsOnExtension on extension {0}'.format(extension.name) + logger.warn(message) + add_event(WALAEventOperation.ProvisionAfterExtensions, message=message, is_success=False, log_event=False) + else: + message = '{0} depends on {1}'.format(extension.name, depends_on_extension) + logger.info(message) + add_event(WALAEventOperation.ProvisionAfterExtensions, message=message, is_success=True, log_event=False) + if len(extension.settings) == 0: + message = 'Extension {0} does not have any settings. Will ignore dependency (dependency level: {1})'.format(extension.name, dependency_level) + logger.warn(message) + add_event(WALAEventOperation.ProvisionAfterExtensions, message=message, is_success=False, log_event=False) + else: + extension.settings[0].dependencyLevel = dependency_level else: # multi-config settings_by_name = {} diff --git a/azurelinuxagent/ga/agent_update_handler.py b/azurelinuxagent/ga/agent_update_handler.py index a8390c1c7d..5ec44fab51 100644 --- a/azurelinuxagent/ga/agent_update_handler.py +++ b/azurelinuxagent/ga/agent_update_handler.py @@ -268,9 +268,6 @@ def __check_if_downgrade_is_requested_and_allowed(self, requested_version): """ if not self._is_requested_version_update: if requested_version < CURRENT_VERSION: - msg = "Downgrade requested in the GoalState, but downgrades are not supported for self-update version:{0}, " \ - "skipping agent update".format(requested_version) - self.__log_event(LogLevel.INFO, msg) return False return True