def run_exthandlers(self, debug=False): """ Run the update and extension handler """ logger.set_prefix("ExtHandler") threading.current_thread().setName("ExtHandler") # # Agents < 2.2.53 used to echo the log to the console. Since the extension handler could have been started by # one of those daemons, output a message indicating that output to the console will stop, otherwise users # may think that the agent died if they noticed that output to the console stops abruptly. # # Feel free to remove this code if telemetry shows there are no more agents <= 2.2.53 in the field. # if conf.get_logs_console( ) and get_daemon_version() < FlexibleVersion("2.2.53"): self.__add_console_appender(logger.LogLevel.INFO) try: logger.info( u"The agent will now check for updates and then will process extensions. Output to /dev/console will be suspended during those operations." ) finally: logger.disable_console_output() from azurelinuxagent.ga.update import get_update_handler update_handler = get_update_handler() update_handler.run(debug)
def test_get_daemon_version_should_return_the_version_that_was_previously_set( self): set_daemon_version("1.2.3.4") try: self.assertEqual( FlexibleVersion("1.2.3.4"), get_daemon_version(), "The daemon version should be 1.2.3.4. Environment={0}".format( os.environ)) finally: os.environ.pop(DAEMON_VERSION_ENV_VARIABLE)
def test_get_daemon_version_should_return_zero_when_the_version_has_not_been_set( self): self.assertEqual( FlexibleVersion("0.0.0.0"), get_daemon_version(), "The daemon version should not be defined. Environment={0}".format( os.environ))