summaryrefslogtreecommitdiff
path: root/cloudinit/cmd/main.py
diff options
context:
space:
mode:
authorAndrew Jorgensen <ajorgens@amazon.com>2014-03-05 14:56:13 -0800
committerScott Moser <smoser@brickies.net>2017-06-15 15:18:14 -0400
commit977c4cf42e795e35cf4ac31b5f000736c674502e (patch)
tree29f49d594c360a82eaa806c23297f98f9190d4ef /cloudinit/cmd/main.py
parent1025e492412431e95b7ddde46805514e42469db0 (diff)
downloadvyos-cloud-init-977c4cf42e795e35cf4ac31b5f000736c674502e.tar.gz
vyos-cloud-init-977c4cf42e795e35cf4ac31b5f000736c674502e.zip
main: Don't use templater to format the welcome message
Some versions of Cheetah returned everything as unicode by default (not utf-8 or ascii) and some varieties of syslog would choke on unicode. Jinja2 is probably fine, but Python's format() is perfectly adequate for a short message like the welcome message. Reviewed-by: Tom Kirchner <tjk@amazon.com> Reviewed-by: Ben Cressey <bcressey@amazon.com>
Diffstat (limited to 'cloudinit/cmd/main.py')
-rw-r--r--cloudinit/cmd/main.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/cloudinit/cmd/main.py b/cloudinit/cmd/main.py
index 26cc2654..ce3c10dd 100644
--- a/cloudinit/cmd/main.py
+++ b/cloudinit/cmd/main.py
@@ -3,10 +3,12 @@
# Copyright (C) 2012 Canonical Ltd.
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# Copyright (C) 2012 Yahoo! Inc.
+# Copyright (C) 2017 Amazon.com, Inc. or its affiliates
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
# Author: Joshua Harlow <harlowja@yahoo-inc.com>
+# Author: Andrew Jorgensen <ajorgens@amazon.com>
#
# This file is part of cloud-init. See LICENSE file for license information.
@@ -25,7 +27,6 @@ from cloudinit import netinfo
from cloudinit import signal_handler
from cloudinit import sources
from cloudinit import stages
-from cloudinit import templater
from cloudinit import url_helper
from cloudinit import util
from cloudinit import version
@@ -42,9 +43,9 @@ from cloudinit import atomic_helper
from cloudinit.dhclient_hook import LogDhclient
-# Pretty little cheetah formatted welcome message template
-WELCOME_MSG_TPL = ("Cloud-init v. ${version} running '${action}' at "
- "${timestamp}. Up ${uptime} seconds.")
+# 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"
@@ -88,13 +89,11 @@ def welcome(action, msg=None):
def welcome_format(action):
- tpl_params = {
- 'version': version.version_string(),
- 'uptime': util.uptime(),
- 'timestamp': util.time_rfc2822(),
- 'action': action,
- }
- return templater.render_string(WELCOME_MSG_TPL, tpl_params)
+ return WELCOME_MSG_TPL.format(
+ version=version.version_string(),
+ uptime=util.uptime(),
+ timestamp=util.time_rfc2822(),
+ action=action)
def extract_fns(args):