Skip to content
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

Merged
merged 7 commits into from
Oct 16, 2020
Merged

Conversation

narrieta
Copy link
Member

No description provided.

larohra
larohra previously approved these changes Oct 15, 2020
Copy link
Contributor

@larohra larohra left a 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)
Copy link
Contributor

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?

Copy link
Member Author

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)

Copy link
Contributor

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_'
Copy link
Contributor

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?

Copy link
Member Author

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

@@ -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):
Copy link
Member Author

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"

kevinclark19a
kevinclark19a previously approved these changes Oct 15, 2020
@narrieta narrieta dismissed stale reviews from kevinclark19a and larohra via a6f8ca7 October 15, 2020 20:35
@narrieta narrieta merged commit f19b0eb into Azure:develop Oct 16, 2020
@narrieta narrieta deleted the console branch October 27, 2020 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants