def struct_amis_dict(release): """Download the AMI list HTML and parse it to find the AMI codes for the various versions of Ubuntu. """ try: response = _fetch_html('http://cloud-images.ubuntu.com/locator/ec2/releasesTable') except urllib2.HTTPError, error: _logger.error(error.msg) return None
def struct_amis_dict(release): """Download the AMI list HTML and parse it to find the AMI codes for the various versions of Ubuntu. """ try: response = _fetch_html( 'http://cloud-images.ubuntu.com/locator/ec2/releasesTable') except urllib2.HTTPError, error: _logger.error(error.msg) return None
if raw_type == 'instance-store': return 'instance' return raw_type def struct_amis_dict(release): """Download the AMI list HTML and parse it to find the AMI codes for the various versions of Ubuntu. """ try: response = _fetch_html('http://cloud-images.ubuntu.com/locator/ec2/releasesTable') except urllib2.HTTPError, error: _logger.error(error.msg) return None ami_list = _get_ami_list(response, release) if ami_list: result_dict = dict() instance_types = set(map(lambda ami: ami.instance_type, ami_list)) for bits in ("32", "64"): result_dict[bits] = {_type: {} for _type in instance_types} for ami in ami_list: try: result_dict[ami.bits][ami.instance_type][ami.zone] = ami.ami_id except: _logger.error(ami) raise return result_dict else: _logger.error("No AMIs found in HTML") return None
return 'instance' return raw_type def struct_amis_dict(release): """Download the AMI list HTML and parse it to find the AMI codes for the various versions of Ubuntu. """ try: response = _fetch_html( 'http://cloud-images.ubuntu.com/locator/ec2/releasesTable') except urllib2.HTTPError, error: _logger.error(error.msg) return None ami_list = _get_ami_list(response, release) if ami_list: result_dict = dict() instance_types = set(map(lambda ami: ami.instance_type, ami_list)) for bits in ("32", "64"): result_dict[bits] = {_type: {} for _type in instance_types} for ami in ami_list: try: result_dict[ami.bits][ami.instance_type][ami.zone] = ami.ami_id except: _logger.error(ami) raise return result_dict else: _logger.error("No AMIs found in HTML") return None