diff options
author | Chuck Short <zulcss@ubuntu.com> | 2009-05-13 14:41:35 +0200 |
---|---|---|
committer | Chuck Short <zulcss@ubuntu.com> | 2009-05-13 14:41:35 +0200 |
commit | dd112c3afe50c75ae9b00f142b550c6e0d95f47b (patch) | |
tree | ce1843820c13f3c33dd16d34929deedf16107f37 | |
parent | 322bf4c779a378f113e6bf60714c66298aba876d (diff) | |
download | vyos-cloud-init-dd112c3afe50c75ae9b00f142b550c6e0d95f47b.tar.gz vyos-cloud-init-dd112c3afe50c75ae9b00f142b550c6e0d95f47b.zip |
* Really change the locale when setting up an instance. (LP: #341066)
* Run ec2-run-user-data script last. (LP: #373055)
* Minor comment tweaks. (LP:373057)
-rw-r--r-- | debian/changelog | 8 | ||||
-rw-r--r-- | debian/init | 21 | ||||
-rwxr-xr-x | ec2-set-defaults.py | 19 | ||||
-rwxr-xr-x | ec2-set-hostname.py | 4 |
4 files changed, 35 insertions, 17 deletions
diff --git a/debian/changelog b/debian/changelog index a99b17fc..a705faaf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ec2-init (0.3.4ubuntu2) karmic; urgency=low + + * Really change the locale when setting up an instance. (LP: #341066) + * Run ec2-run-user-data script last. (LP: #373055) + * Minor comment tweaks. (LP:373057) + + -- Chuck Short <zulcss@ubuntu.com> Wed, 13 May 2009 13:41:35 -0400 + ec2-init (0.3.4ubuntu1) karmic; urgency=low * Add more smarts to ec2 instance bring up. (LP: #371936) diff --git a/debian/init b/debian/init index ea4f0acf..15345b6a 100644 --- a/debian/init +++ b/debian/init @@ -30,7 +30,7 @@ case "$1" in log_end_msg 1 fi - log_daemon_msg "Fetching EC2 login credentials" + log_daemon_msg "Fetching EC2 SSH keys" if ec2-fetch-credentials 2> /dev/null then log_end_msg 0 @@ -38,28 +38,27 @@ case "$1" in log_end_msg 1 fi - log_daemon_msg "Running EC2 user data" - if ec2-run-user-data 2>&1 | logger -t "user-data" - then - log_end_msg 0 - else - log_end_msg 1 - fi - - log_daemon_msg "Setting hostname to EC2 public_hostname" + log_daemon_msg "Setting hostname to EC2 localhostname" if ec2-set-hostname 2> /dev/null then log_end_msg 0 else log_end_msg 1 fi - log_daemon_msg "Determining EC2 availability zone" + log_daemon_msg "Creating /etc/apt/sources.list" if ec2-set-apt-sources 2> /dev/null then log_end_msg 0 else log_end_msg 1 fi + log_daemon_msg "Running EC2 user data" + if ec2-run-user-data 2>&1 | logger -t "user-data" + then + log_end_msg 0 + else + log_end_msg 1 + fi ;; stop) diff --git a/ec2-set-defaults.py b/ec2-set-defaults.py index 09234d0d..75a2f5c8 100755 --- a/ec2-set-defaults.py +++ b/ec2-set-defaults.py @@ -36,12 +36,23 @@ elif zone.startswith("eu"): def set_language(location,filename): if location.startswith("us"): lang='en_US.UTF-8' - os.system('locale-gen %s 2>&1 > /dev/null' %(lang)) - os.system('update-locale %s 2>&1 > /dev/null' %(lang)) elif location.startswith("eu"): lang='en_GB.UTF-8' - os.system('locale-gen %s 2>&1 > /dev/null' %(lang)) - os.system('update-locale %s 2>&1 > /dev/null' %(lang)) + + os.system('locale-gen %s' %(lang) + os.system('update-locale %s' %(lang) + + mp = {'lang' : lang } + T = Template(file="/etc/ec2-init/templates/locale.tmpl", searchList=[mp]) + f = open("/var/run/ec2/locale", "w") + f.write('%s' $(t)) + f.close() + + if not os.path.exists("/etc/default/locale-ec2-init"): + os.system("mv /etc/default/locale /etc/default/locale-ec2-init") + os.symlink("/var/run/ec2/locale", "/etc/default/locale") + os.system("source /etc/default/locale") + os.system('touch %s' %(filename)) def get_amid(): diff --git a/ec2-set-hostname.py b/ec2-set-hostname.py index 9abb8877..818d0e02 100755 --- a/ec2-set-hostname.py +++ b/ec2-set-hostname.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Fetch login credentials for EC2 +# Set up the hostname for ec2. # Copyright 2008 Canonical Ltd. # # Author: Chuck Short <chuck.short@canonical.com> @@ -54,6 +54,6 @@ def set_hostname(filename): id = get_ami_id() filename = '/var/ec2/.hostname-already-ran.%s' %id if os.path.exists(filename): - print "hostname already set previously" + print "Hostname already set previously....skipping!" else: set_hostname(filename) |