summaryrefslogtreecommitdiff
path: root/ec2init/__init__.py
diff options
context:
space:
mode:
authorSoren Hansen <soren@canonical.com>2009-08-10 21:01:08 +0200
committerSoren Hansen <soren@canonical.com>2009-08-10 21:01:08 +0200
commitfb6561d590b494b25f96489eda89adfad6bd557a (patch)
treef1bece3a6a6ff653b39d1c95bdaf2e200dc30b37 /ec2init/__init__.py
parente822aba1d8ded633f9f5dbea215a0e708c2c4267 (diff)
downloadvyos-cloud-init-fb6561d590b494b25f96489eda89adfad6bd557a.tar.gz
vyos-cloud-init-fb6561d590b494b25f96489eda89adfad6bd557a.zip
Moved mappings from ec2-set-sources-list to ec2init.
Moved everything else from ec2-set-sources-list to ec2-set-defaults. Removed call to ec2-set-sources-list from init script. Removed ec2-set-sources-list.
Diffstat (limited to 'ec2init/__init__.py')
-rw-r--r--ec2init/__init__.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/ec2init/__init__.py b/ec2init/__init__.py
index 729e3a48..c8e7ba2f 100644
--- a/ec2init/__init__.py
+++ b/ec2init/__init__.py
@@ -73,8 +73,7 @@ class EC2Init():
def get_hostname(self):
return self.get_instance_metadata()['local-hostname']
- def get_mirror_for_availability_zone(self):
- availability_zone = self.get_availability_zone()
+ def get_mirror_from_availability_zone(self, availability_zone):
if zone.startswith("us"):
return 'http://us.ec2.archive.ubuntu.com/ubuntu/'
elif zone.startswith("eu"):
@@ -97,3 +96,21 @@ class EC2Init():
time.sleep(timeout)
timeout = timeout * 2
return False
+
+ def get_location_from_availability_zone(availability_zone):
+ if availability.startswith('us-'):
+ return 'us'
+ elif availability.startswith('eu-'):
+ return 'eu'
+ raise Exception('Could not determine location')
+
+location_locale_map = {
+ 'us' : 'en_US.UTF-8',
+ 'eu' : 'en_GB.UTF-8'
+}
+
+location_archive_map = {
+ 'us' : 'http://us.ec2.archive.ubuntu.com/ubuntu',
+ 'eu' : 'http://eu.ec2.archive.ubuntu.com/ubuntu'
+}
+