From fb6561d590b494b25f96489eda89adfad6bd557a Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 10 Aug 2009 21:01:08 +0200 Subject: 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. --- ec2init/__init__.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'ec2init') 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' +} + -- cgit v1.2.3