-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Echo log to /dev/console during provisioning #2043
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments but everything else LGTM.
(Since you touched the provisioning code, might be a good idea to get this reviewed by the provisioning folks just to be on the safer side)
# 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be added under the try just to be on the safer side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the appender was not added we do not want do remove it (nothing bad would happen in the current implementation, but still)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's been some confusion, I meant moving the adding part under the try too. Just having a logger.info
under try adds little value.
try:
self.__add_console_appender(logger.LogLevel.INFO)
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()
@@ -25,6 +25,35 @@ | |||
from azurelinuxagent.common.utils.flexible_version import FlexibleVersion | |||
from azurelinuxagent.common.future import ustr, get_linux_distribution | |||
|
|||
__DAEMON_VERSION_ENV_VARIABLE = '_AZURE_GUEST_AGENT_DAEMON_VERSION_' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not put this under this class -
class ExtCommandEnvVariable(object):
If position of that class is a problem, you can also move it from exthandlers.py
to some file under common/
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those are mean for extensions, this one is not
i used underscores to mark variables not meant to be used by extensions
tests/common/test_logger.py
Outdated
@@ -565,3 +562,32 @@ def test_stdout_appender(self, mock_sys_stdout): | |||
|
|||
# Validating only test-error gets logged and not others. | |||
self.assertEqual(1, mock_sys_stdout.call_count) | |||
|
|||
def test_console_output_enabled_should_return_true_when_there_are_no_console_appenders(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo; should be "when_there_are_console_appenders"
No description provided.