Resync helpers
This commit is contained in:
parent
730b876845
commit
92ed63861a
2
.bzrignore
Normal file
2
.bzrignore
Normal file
@ -0,0 +1,2 @@
|
||||
bin
|
||||
.coverage
|
@ -7,19 +7,36 @@ class OpenStackAmuletDeployment(AmuletDeployment):
|
||||
"""This class inherits from AmuletDeployment and has additional support
|
||||
that is specifically for use by OpenStack charms."""
|
||||
|
||||
def __init__(self, series=None, openstack=None):
|
||||
def __init__(self, series=None, openstack=None, source=None):
|
||||
"""Initialize the deployment environment."""
|
||||
self.openstack = None
|
||||
super(OpenStackAmuletDeployment, self).__init__(series)
|
||||
|
||||
if openstack:
|
||||
self.openstack = openstack
|
||||
self.source = source
|
||||
|
||||
def _add_services(self, this_service, other_services):
|
||||
"""Add services to the deployment and set openstack-origin."""
|
||||
super(OpenStackAmuletDeployment, self)._add_services(this_service,
|
||||
other_services)
|
||||
name = 0
|
||||
services = other_services
|
||||
services.append(this_service)
|
||||
use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph']
|
||||
|
||||
if self.openstack:
|
||||
for svc in services:
|
||||
if svc[name] not in use_source:
|
||||
config = {'openstack-origin': self.openstack}
|
||||
self.d.configure(svc[name], config)
|
||||
|
||||
if self.source:
|
||||
for svc in services:
|
||||
if svc[name] in use_source:
|
||||
config = {'source': self.source}
|
||||
self.d.configure(svc[name], config)
|
||||
|
||||
def _configure_services(self, configs):
|
||||
"""Configure all of the services."""
|
||||
for service, config in configs.iteritems():
|
||||
if service == self.this_service:
|
||||
config['openstack-origin'] = self.openstack
|
||||
self.d.configure(service, config)
|
||||
|
||||
def _get_openstack_release(self):
|
||||
|
@ -74,7 +74,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
||||
if ret:
|
||||
return "unexpected tenant data - {}".format(ret)
|
||||
if not found:
|
||||
return "tenant {} does not exist".format(e.name)
|
||||
return "tenant {} does not exist".format(e['name'])
|
||||
return ret
|
||||
|
||||
def validate_role_data(self, expected, actual):
|
||||
@ -91,7 +91,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
||||
if ret:
|
||||
return "unexpected role data - {}".format(ret)
|
||||
if not found:
|
||||
return "role {} does not exist".format(e.name)
|
||||
return "role {} does not exist".format(e['name'])
|
||||
return ret
|
||||
|
||||
def validate_user_data(self, expected, actual):
|
||||
@ -110,7 +110,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
||||
if ret:
|
||||
return "unexpected user data - {}".format(ret)
|
||||
if not found:
|
||||
return "user {} does not exist".format(e.name)
|
||||
return "user {} does not exist".format(e['name'])
|
||||
return ret
|
||||
|
||||
def validate_flavor_data(self, expected, actual):
|
||||
@ -192,8 +192,8 @@ class OpenStackAmuletUtils(AmuletUtils):
|
||||
|
||||
count = 1
|
||||
status = instance.status
|
||||
while status == 'BUILD' and count < 10:
|
||||
time.sleep(5)
|
||||
while status != 'ACTIVE' and count < 60:
|
||||
time.sleep(3)
|
||||
instance = nova.servers.get(instance.id)
|
||||
status = instance.status
|
||||
self.log.debug('instance status: {}'.format(status))
|
||||
|
Loading…
Reference in New Issue
Block a user