~cbjchen/charms/trusty/cinder-ceph/remove_stale_key

« back to all changes in this revision

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

  • Committer: james.page at ubuntu
  • Date: 2014-12-15 09:18:58 UTC
  • mfrom: (20.1.9 cinder-ceph)
  • Revision ID: james.page@ubuntu.com-20141215091858-qryinzazthotmi3p
[corey.bryant,r=james-page] Sort out charmhelpers issues.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
import keystoneclient.v2_0 as keystone_client
8
8
import novaclient.v1_1.client as nova_client
9
9
 
 
10
import six
 
11
 
10
12
from charmhelpers.contrib.amulet.utils import (
11
13
    AmuletUtils
12
14
)
60
62
           expected service catalog endpoints.
61
63
           """
62
64
        self.log.debug('actual: {}'.format(repr(actual)))
63
 
        for k, v in expected.iteritems():
 
65
        for k, v in six.iteritems(expected):
64
66
            if k in actual:
65
67
                ret = self._validate_dict_data(expected[k][0], actual[k][0])
66
68
                if ret:
187
189
 
188
190
        f = opener.open("http://download.cirros-cloud.net/version/released")
189
191
        version = f.read().strip()
190
 
        cirros_img = "tests/cirros-{}-x86_64-disk.img".format(version)
 
192
        cirros_img = "cirros-{}-x86_64-disk.img".format(version)
 
193
        local_path = os.path.join('tests', cirros_img)
191
194
 
192
 
        if not os.path.exists(cirros_img):
 
195
        if not os.path.exists(local_path):
193
196
            cirros_url = "http://{}/{}/{}".format("download.cirros-cloud.net",
194
197
                                                  version, cirros_img)
195
 
            opener.retrieve(cirros_url, cirros_img)
 
198
            opener.retrieve(cirros_url, local_path)
196
199
        f.close()
197
200
 
198
 
        with open(cirros_img) as f:
 
201
        with open(local_path) as f:
199
202
            image = glance.images.create(name=image_name, is_public=True,
200
203
                                         disk_format='qcow2',
201
204
                                         container_format='bare', data=f)