~niedbalski/charms/trusty/quantum-gateway/lp-1366598

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/amulet/utils.py

  • Committer: Liam Young
  • Date: 2014-09-25 15:52:47 UTC
  • mfrom: (60.3.3 quantum-gateway)
  • Revision ID: liam.young@canonical.com-20140925155247-71hz7u55teb6s8vz
[corey.bryant,r=gnuoy] This patch turns on metadata caching in the metadata config file from Icehouse on. To test this, boot an instance and run 'for i in {0..2}; do time ec2metadata; done'. Also charmhelper sync and Turn off implicit save.

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
 
188
188
        f = opener.open("http://download.cirros-cloud.net/version/released")
189
189
        version = f.read().strip()
190
 
        cirros_img = "tests/cirros-{}-x86_64-disk.img".format(version)
 
190
        cirros_img = "cirros-{}-x86_64-disk.img".format(version)
 
191
        local_path = os.path.join('tests', cirros_img)
191
192
 
192
 
        if not os.path.exists(cirros_img):
 
193
        if not os.path.exists(local_path):
193
194
            cirros_url = "http://{}/{}/{}".format("download.cirros-cloud.net",
194
195
                                                  version, cirros_img)
195
 
            opener.retrieve(cirros_url, cirros_img)
 
196
            opener.retrieve(cirros_url, local_path)
196
197
        f.close()
197
198
 
198
 
        with open(cirros_img) as f:
 
199
        with open(local_path) as f:
199
200
            image = glance.images.create(name=image_name, is_public=True,
200
201
                                         disk_format='qcow2',
201
202
                                         container_format='bare', data=f)