Resync charmhelpers for py3 fixes.
Change-Id: I998fb90967fd226de92d0397417677e9e0876c8d
This commit is contained in:
parent
a5e0534af0
commit
04f4e6e756
@ -250,7 +250,14 @@ class OpenStackAmuletDeployment(AmuletDeployment):
|
|||||||
self.log.debug('Waiting up to {}s for extended status on services: '
|
self.log.debug('Waiting up to {}s for extended status on services: '
|
||||||
'{}'.format(timeout, services))
|
'{}'.format(timeout, services))
|
||||||
service_messages = {service: message for service in services}
|
service_messages = {service: message for service in services}
|
||||||
|
|
||||||
|
# Check for idleness
|
||||||
|
self.d.sentry.wait()
|
||||||
|
# Check for error states and bail early
|
||||||
|
self.d.sentry.wait_for_status(self.d.juju_env, services)
|
||||||
|
# Check for ready messages
|
||||||
self.d.sentry.wait_for_messages(service_messages, timeout=timeout)
|
self.d.sentry.wait_for_messages(service_messages, timeout=timeout)
|
||||||
|
|
||||||
self.log.info('OK')
|
self.log.info('OK')
|
||||||
|
|
||||||
def _get_openstack_release(self):
|
def _get_openstack_release(self):
|
||||||
|
@ -43,7 +43,6 @@ import swiftclient
|
|||||||
from charmhelpers.contrib.amulet.utils import (
|
from charmhelpers.contrib.amulet.utils import (
|
||||||
AmuletUtils
|
AmuletUtils
|
||||||
)
|
)
|
||||||
from charmhelpers.core.decorators import retry_on_exception
|
|
||||||
from charmhelpers.core.host import CompareHostReleases
|
from charmhelpers.core.host import CompareHostReleases
|
||||||
|
|
||||||
DEBUG = logging.DEBUG
|
DEBUG = logging.DEBUG
|
||||||
@ -311,7 +310,6 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
self.log.debug('Checking if tenant exists ({})...'.format(tenant))
|
self.log.debug('Checking if tenant exists ({})...'.format(tenant))
|
||||||
return tenant in [t.name for t in keystone.tenants.list()]
|
return tenant in [t.name for t in keystone.tenants.list()]
|
||||||
|
|
||||||
@retry_on_exception(5, base_delay=10)
|
|
||||||
def keystone_wait_for_propagation(self, sentry_relation_pairs,
|
def keystone_wait_for_propagation(self, sentry_relation_pairs,
|
||||||
api_version):
|
api_version):
|
||||||
"""Iterate over list of sentry and relation tuples and verify that
|
"""Iterate over list of sentry and relation tuples and verify that
|
||||||
@ -327,7 +325,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
rel = sentry.relation('identity-service',
|
rel = sentry.relation('identity-service',
|
||||||
relation_name)
|
relation_name)
|
||||||
self.log.debug('keystone relation data: {}'.format(rel))
|
self.log.debug('keystone relation data: {}'.format(rel))
|
||||||
if rel['api_version'] != str(api_version):
|
if rel.get('api_version') != str(api_version):
|
||||||
raise Exception("api_version not propagated through relation"
|
raise Exception("api_version not propagated through relation"
|
||||||
" data yet ('{}' != '{}')."
|
" data yet ('{}' != '{}')."
|
||||||
"".format(rel['api_version'], api_version))
|
"".format(rel['api_version'], api_version))
|
||||||
@ -349,6 +347,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
|
|
||||||
config = {'preferred-api-version': api_version}
|
config = {'preferred-api-version': api_version}
|
||||||
deployment.d.configure('keystone', config)
|
deployment.d.configure('keystone', config)
|
||||||
|
deployment._auto_wait_for_status()
|
||||||
self.keystone_wait_for_propagation(sentry_relation_pairs, api_version)
|
self.keystone_wait_for_propagation(sentry_relation_pairs, api_version)
|
||||||
|
|
||||||
def authenticate_cinder_admin(self, keystone_sentry, username,
|
def authenticate_cinder_admin(self, keystone_sentry, username,
|
||||||
|
@ -18,7 +18,7 @@ rbd default features = {{ rbd_features }}
|
|||||||
|
|
||||||
[client]
|
[client]
|
||||||
{% if rbd_client_cache_settings -%}
|
{% if rbd_client_cache_settings -%}
|
||||||
{% for key, value in rbd_client_cache_settings.iteritems() -%}
|
{% for key, value in rbd_client_cache_settings.items() -%}
|
||||||
{{ key }} = {{ value }}
|
{{ key }} = {{ value }}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
@ -61,13 +61,19 @@ def bytes_from_string(value):
|
|||||||
if isinstance(value, six.string_types):
|
if isinstance(value, six.string_types):
|
||||||
value = six.text_type(value)
|
value = six.text_type(value)
|
||||||
else:
|
else:
|
||||||
msg = "Unable to interpret non-string value '%s' as boolean" % (value)
|
msg = "Unable to interpret non-string value '%s' as bytes" % (value)
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
matches = re.match("([0-9]+)([a-zA-Z]+)", value)
|
matches = re.match("([0-9]+)([a-zA-Z]+)", value)
|
||||||
if not matches:
|
if matches:
|
||||||
msg = "Unable to interpret string value '%s' as bytes" % (value)
|
size = int(matches.group(1)) * (1024 ** BYTE_POWER[matches.group(2)])
|
||||||
raise ValueError(msg)
|
else:
|
||||||
return int(matches.group(1)) * (1024 ** BYTE_POWER[matches.group(2)])
|
# Assume that value passed in is bytes
|
||||||
|
try:
|
||||||
|
size = int(value)
|
||||||
|
except ValueError:
|
||||||
|
msg = "Unable to interpret string value '%s' as bytes" % (value)
|
||||||
|
raise ValueError(msg)
|
||||||
|
return size
|
||||||
|
|
||||||
|
|
||||||
class BasicStringComparator(object):
|
class BasicStringComparator(object):
|
||||||
|
@ -250,7 +250,14 @@ class OpenStackAmuletDeployment(AmuletDeployment):
|
|||||||
self.log.debug('Waiting up to {}s for extended status on services: '
|
self.log.debug('Waiting up to {}s for extended status on services: '
|
||||||
'{}'.format(timeout, services))
|
'{}'.format(timeout, services))
|
||||||
service_messages = {service: message for service in services}
|
service_messages = {service: message for service in services}
|
||||||
|
|
||||||
|
# Check for idleness
|
||||||
|
self.d.sentry.wait()
|
||||||
|
# Check for error states and bail early
|
||||||
|
self.d.sentry.wait_for_status(self.d.juju_env, services)
|
||||||
|
# Check for ready messages
|
||||||
self.d.sentry.wait_for_messages(service_messages, timeout=timeout)
|
self.d.sentry.wait_for_messages(service_messages, timeout=timeout)
|
||||||
|
|
||||||
self.log.info('OK')
|
self.log.info('OK')
|
||||||
|
|
||||||
def _get_openstack_release(self):
|
def _get_openstack_release(self):
|
||||||
|
@ -43,7 +43,6 @@ import swiftclient
|
|||||||
from charmhelpers.contrib.amulet.utils import (
|
from charmhelpers.contrib.amulet.utils import (
|
||||||
AmuletUtils
|
AmuletUtils
|
||||||
)
|
)
|
||||||
from charmhelpers.core.decorators import retry_on_exception
|
|
||||||
from charmhelpers.core.host import CompareHostReleases
|
from charmhelpers.core.host import CompareHostReleases
|
||||||
|
|
||||||
DEBUG = logging.DEBUG
|
DEBUG = logging.DEBUG
|
||||||
@ -311,7 +310,6 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
self.log.debug('Checking if tenant exists ({})...'.format(tenant))
|
self.log.debug('Checking if tenant exists ({})...'.format(tenant))
|
||||||
return tenant in [t.name for t in keystone.tenants.list()]
|
return tenant in [t.name for t in keystone.tenants.list()]
|
||||||
|
|
||||||
@retry_on_exception(5, base_delay=10)
|
|
||||||
def keystone_wait_for_propagation(self, sentry_relation_pairs,
|
def keystone_wait_for_propagation(self, sentry_relation_pairs,
|
||||||
api_version):
|
api_version):
|
||||||
"""Iterate over list of sentry and relation tuples and verify that
|
"""Iterate over list of sentry and relation tuples and verify that
|
||||||
@ -327,7 +325,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
rel = sentry.relation('identity-service',
|
rel = sentry.relation('identity-service',
|
||||||
relation_name)
|
relation_name)
|
||||||
self.log.debug('keystone relation data: {}'.format(rel))
|
self.log.debug('keystone relation data: {}'.format(rel))
|
||||||
if rel['api_version'] != str(api_version):
|
if rel.get('api_version') != str(api_version):
|
||||||
raise Exception("api_version not propagated through relation"
|
raise Exception("api_version not propagated through relation"
|
||||||
" data yet ('{}' != '{}')."
|
" data yet ('{}' != '{}')."
|
||||||
"".format(rel['api_version'], api_version))
|
"".format(rel['api_version'], api_version))
|
||||||
@ -349,6 +347,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
|
|
||||||
config = {'preferred-api-version': api_version}
|
config = {'preferred-api-version': api_version}
|
||||||
deployment.d.configure('keystone', config)
|
deployment.d.configure('keystone', config)
|
||||||
|
deployment._auto_wait_for_status()
|
||||||
self.keystone_wait_for_propagation(sentry_relation_pairs, api_version)
|
self.keystone_wait_for_propagation(sentry_relation_pairs, api_version)
|
||||||
|
|
||||||
def authenticate_cinder_admin(self, keystone_sentry, username,
|
def authenticate_cinder_admin(self, keystone_sentry, username,
|
||||||
|
@ -61,13 +61,19 @@ def bytes_from_string(value):
|
|||||||
if isinstance(value, six.string_types):
|
if isinstance(value, six.string_types):
|
||||||
value = six.text_type(value)
|
value = six.text_type(value)
|
||||||
else:
|
else:
|
||||||
msg = "Unable to interpret non-string value '%s' as boolean" % (value)
|
msg = "Unable to interpret non-string value '%s' as bytes" % (value)
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
matches = re.match("([0-9]+)([a-zA-Z]+)", value)
|
matches = re.match("([0-9]+)([a-zA-Z]+)", value)
|
||||||
if not matches:
|
if matches:
|
||||||
msg = "Unable to interpret string value '%s' as bytes" % (value)
|
size = int(matches.group(1)) * (1024 ** BYTE_POWER[matches.group(2)])
|
||||||
raise ValueError(msg)
|
else:
|
||||||
return int(matches.group(1)) * (1024 ** BYTE_POWER[matches.group(2)])
|
# Assume that value passed in is bytes
|
||||||
|
try:
|
||||||
|
size = int(value)
|
||||||
|
except ValueError:
|
||||||
|
msg = "Unable to interpret string value '%s' as bytes" % (value)
|
||||||
|
raise ValueError(msg)
|
||||||
|
return size
|
||||||
|
|
||||||
|
|
||||||
class BasicStringComparator(object):
|
class BasicStringComparator(object):
|
||||||
|
Loading…
Reference in New Issue
Block a user