diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-07-02 10:56:22 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-07-02 10:56:22 -0700 |
commit | 879946c26f005f5ae5c2bbdd537beb295d7f4773 (patch) | |
tree | d9036cd7fe1eee3cb5ce4510f4374a6bb7c95057 /bin | |
parent | 8037b4723ad641701750f9b4c9b7d7216bf50838 (diff) | |
download | vyos-cloud-init-879946c26f005f5ae5c2bbdd537beb295d7f4773.tar.gz vyos-cloud-init-879946c26f005f5ae5c2bbdd537beb295d7f4773.zip |
1. Move the welcome message template string to a constant at the top of the module
2. Fix the usage of multi_log to log to only one of the places (for now)
3. Update comment about multi-log and why write_file isn't used in this case
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cloud-init | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/cloud-init b/bin/cloud-init index fce4fe8c..c7863db1 100755 --- a/bin/cloud-init +++ b/bin/cloud-init @@ -45,6 +45,10 @@ from cloudinit.settings import (PER_INSTANCE, PER_ALWAYS, PER_ONCE, CLOUD_CONFIG) +# Pretty little welcome message template +WELCOME_MSG_TPL = ("Cloud-init v. {{version}} running '{{action}}' at " + "{{timestamp}}. Up {{uptime}} seconds.") + # Module section template MOD_SECTION_TPL = "cloud_%s_modules" @@ -56,6 +60,7 @@ QUERY_DATA_TYPES = [ ] # Frequency shortname to full name +# (so users don't have to remember the full name...) FREQ_SHORT_NAMES = { 'instance': PER_INSTANCE, 'always': PER_ALWAYS, @@ -78,15 +83,15 @@ def print_exc(msg=''): def welcome(action): - msg = ("Cloud-init v. {{version}} running '{{action}}' at " - "{{timestamp}}. Up {{uptime}} seconds.") tpl_params = { 'version': version.version_string(), 'uptime': util.uptime(), 'timestamp': util.time_rfc2822(), 'action': action, } - util.multi_log("%s\n" % (templater.render_string(msg, tpl_params))) + tpl_msg = templater.render_string(WELCOME_MSG_TPL, tpl_params) + util.multi_log("%s\n" % (tpl_msg), + console=False, stderr=True) def extract_fns(args): |