diff options
author | Chuck Short <zulcss@ubuntu.com> | 2009-05-05 09:59:54 +0200 |
---|---|---|
committer | Chuck Short <zulcss@ubuntu.com> | 2009-05-05 09:59:54 +0200 |
commit | 322bf4c779a378f113e6bf60714c66298aba876d (patch) | |
tree | 839d46c3211c2724ecafa32beaeac0cf0ab4519f /ec2-set-defaults.py | |
parent | ac53fe3d7599356b1f8c9851113212b68a5ab667 (diff) | |
download | vyos-cloud-init-322bf4c779a378f113e6bf60714c66298aba876d.tar.gz vyos-cloud-init-322bf4c779a378f113e6bf60714c66298aba876d.zip |
* Add more smarts to ec2 instance bring up. (LP: #371936)
Diffstat (limited to 'ec2-set-defaults.py')
-rwxr-xr-x | ec2-set-defaults.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ec2-set-defaults.py b/ec2-set-defaults.py index 7d410031..09234d0d 100755 --- a/ec2-set-defaults.py +++ b/ec2-set-defaults.py @@ -33,7 +33,7 @@ if zone.startswith("us"): elif zone.startswith("eu"): archive = "http://eu.ec2.archive.ubuntu.com/ubuntu" -def set_language(location): +def set_language(location,filename): if location.startswith("us"): lang='en_US.UTF-8' os.system('locale-gen %s 2>&1 > /dev/null' %(lang)) @@ -42,5 +42,17 @@ def set_language(location): 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('touch %s' %(filename)) -set_language(zone) +def get_amid(): + url = 'http://169.254.169.254/%s/meta-data' % api_ver + ami_id = urllib.urlopen('%s/ami-id/' %url).read() + return ami_id + +ami = get_amid() +filename = '/var/ec2/.defaults-already-ran.%s' %ami + +if os.path.exists(filename): + print "ec2-set-defaults already ran...skipping" +else: + set_language(zone,filename) |