clean up old lint

This commit is contained in:
Ryan Beisner
2015-08-21 16:58:04 +00:00
parent f7d28379c6
commit 49214ced79

View File

@@ -9,8 +9,7 @@ from charmhelpers.contrib.openstack.amulet.deployment import (
from charmhelpers.contrib.openstack.amulet.utils import ( from charmhelpers.contrib.openstack.amulet.utils import (
OpenStackAmuletUtils, OpenStackAmuletUtils,
DEBUG, # flake8: noqa DEBUG
ERROR
) )
# Use DEBUG to turn on debug logging # Use DEBUG to turn on debug logging
@@ -46,28 +45,36 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
def _add_relations(self): def _add_relations(self):
"""Add all of the relations for the services.""" """Add all of the relations for the services."""
relations = { relations = {
'keystone:shared-db': 'mysql:shared-db', 'keystone:shared-db': 'mysql:shared-db',
'swift-proxy:identity-service': 'keystone:identity-service', 'swift-proxy:identity-service': 'keystone:identity-service',
'swift-storage:swift-storage': 'swift-proxy:swift-storage', 'swift-storage:swift-storage': 'swift-proxy:swift-storage',
'glance:identity-service': 'keystone:identity-service', 'glance:identity-service': 'keystone:identity-service',
'glance:shared-db': 'mysql:shared-db', 'glance:shared-db': 'mysql:shared-db',
'glance:object-store': 'swift-proxy:object-store' 'glance:object-store': 'swift-proxy:object-store'
} }
super(SwiftProxyBasicDeployment, self)._add_relations(relations) super(SwiftProxyBasicDeployment, self)._add_relations(relations)
def _configure_services(self): def _configure_services(self):
"""Configure all of the services.""" """Configure all of the services."""
keystone_config = {'admin-password': 'openstack', keystone_config = {
'admin-token': 'ubuntutesting'} 'admin-password': 'openstack',
swift_proxy_config = {'zone-assignment': 'manual', 'admin-token': 'ubuntutesting'
'replicas': '1', }
'swift-hash': 'fdfef9d4-8b06-11e2-8ac0-531c923c8fae'} swift_proxy_config = {
swift_storage_config = {'zone': '1', 'zone-assignment': 'manual',
'block-device': 'vdb', 'replicas': '1',
'overwrite': 'true'} 'swift-hash': 'fdfef9d4-8b06-11e2-8ac0-531c923c8fae'
configs = {'keystone': keystone_config, }
'swift-proxy': swift_proxy_config, swift_storage_config = {
'swift-storage': swift_storage_config} 'zone': '1',
'block-device': 'vdb',
'overwrite': 'true'
}
configs = {
'keystone': keystone_config,
'swift-proxy': swift_proxy_config,
'swift-storage': swift_storage_config
}
super(SwiftProxyBasicDeployment, self)._configure_services(configs) super(SwiftProxyBasicDeployment, self)._configure_services(configs)
def _initialize_tests(self): def _initialize_tests(self):
@@ -89,15 +96,16 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
self.glance = u.authenticate_glance_admin(self.keystone) self.glance = u.authenticate_glance_admin(self.keystone)
# Authenticate swift user # Authenticate swift user
keystone_relation = self.keystone_sentry.relation('identity-service', keystone_relation = self.keystone_sentry.relation(
'swift-proxy:identity-service') 'identity-service', 'swift-proxy:identity-service')
ep = self.keystone.service_catalog.url_for(service_type='identity', ep = self.keystone.service_catalog.url_for(service_type='identity',
endpoint_type='publicURL') endpoint_type='publicURL')
self.swift = swiftclient.Connection(authurl=ep, self.swift = swiftclient.Connection(
user=keystone_relation['service_username'], authurl=ep,
key=keystone_relation['service_password'], user=keystone_relation['service_username'],
tenant_name=keystone_relation['service_tenant'], key=keystone_relation['service_password'],
auth_version='2.0') tenant_name=keystone_relation['service_tenant'],
auth_version='2.0')
# Create a demo tenant/role/user # Create a demo tenant/role/user
self.demo_tenant = 'demoTenant' self.demo_tenant = 'demoTenant'
@@ -140,7 +148,8 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
commands = { commands = {
self.mysql_sentry: ['status mysql'], self.mysql_sentry: ['status mysql'],
self.keystone_sentry: ['status keystone'], self.keystone_sentry: ['status keystone'],
self.glance_sentry: ['status glance-registry', 'status glance-api'], self.glance_sentry: ['status glance-registry',
'status glance-api'],
self.swift_proxy_sentry: ['status swift-proxy'], self.swift_proxy_sentry: ['status swift-proxy'],
self.swift_storage_sentry: swift_storage_services self.swift_storage_sentry: swift_storage_services
} }
@@ -217,7 +226,7 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
amulet.raise_status(amulet.FAIL, msg=message) amulet.raise_status(amulet.FAIL, msg=message)
def test_swift_proxy_identity_service_relation(self): def test_swift_proxy_identity_service_relation(self):
"""Verify the swift-proxy to keystone identity-service relation data.""" """Verify the swift-proxy to keystone identity relation data."""
unit = self.swift_proxy_sentry unit = self.swift_proxy_sentry
relation = ['identity-service', 'keystone:identity-service'] relation = ['identity-service', 'keystone:identity-service']
expected = { expected = {
@@ -236,7 +245,7 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
amulet.raise_status(amulet.FAIL, msg=message) amulet.raise_status(amulet.FAIL, msg=message)
def test_keystone_identity_service_relation(self): def test_keystone_identity_service_relation(self):
"""Verify the keystone to swift-proxy identity-service relation data.""" """Verify the keystone to swift-proxy identity relation data."""
unit = self.keystone_sentry unit = self.keystone_sentry
relation = ['identity-service', 'swift-proxy:identity-service'] relation = ['identity-service', 'swift-proxy:identity-service']
expected = { expected = {
@@ -299,7 +308,7 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
"""Verify the glance to swift-proxy object-store relation data.""" """Verify the glance to swift-proxy object-store relation data."""
unit = self.glance_sentry unit = self.glance_sentry
relation = ['object-store', 'swift-proxy:object-store'] relation = ['object-store', 'swift-proxy:object-store']
expected = { 'private-address': u.valid_ip } expected = {'private-address': u.valid_ip}
ret = u.validate_relation_data(unit, relation, expected) ret = u.validate_relation_data(unit, relation, expected)
if ret: if ret:
@@ -357,10 +366,10 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
unit = self.swift_proxy_sentry unit = self.swift_proxy_sentry
conf = '/etc/swift/proxy-server.conf' conf = '/etc/swift/proxy-server.conf'
keystone_relation = self.keystone_sentry.relation('identity-service', keystone_relation = self.keystone_sentry.relation(
'swift-proxy:identity-service') 'identity-service', 'swift-proxy:identity-service')
swift_proxy_relation = unit.relation('identity-service', swift_proxy_relation = unit.relation(
'keystone:identity-service') 'identity-service', 'keystone:identity-service')
swift_proxy_ip = swift_proxy_relation['private-address'] swift_proxy_ip = swift_proxy_relation['private-address']
auth_host = keystone_relation['auth_host'] auth_host = keystone_relation['auth_host']
auth_protocol = keystone_relation['auth_protocol'] auth_protocol = keystone_relation['auth_protocol']
@@ -376,11 +385,11 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
'log_address': '/dev/log' 'log_address': '/dev/log'
}, },
'pipeline:main': { 'pipeline:main': {
'pipeline': 'gatekeeper healthcheck proxy-logging cache swift3 ' 'pipeline': 'gatekeeper healthcheck proxy-logging cache '
's3token container_sync bulk tempurl slo dlo ' 'swift3 s3token container_sync bulk tempurl '
'formpost authtoken keystoneauth staticweb ' 'slo dlo formpost authtoken keystoneauth '
'container-quotas account-quotas proxy-logging ' 'staticweb container-quotas account-quotas '
'proxy-server' 'proxy-logging proxy-server'
}, },
'app:proxy-server': { 'app:proxy-server': {
'use': 'egg:swift#proxy', 'use': 'egg:swift#proxy',
@@ -420,8 +429,10 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
'auth_host': auth_host, 'auth_host': auth_host,
'auth_port': keystone_relation['auth_port'], 'auth_port': keystone_relation['auth_port'],
'auth_protocol': auth_protocol, 'auth_protocol': auth_protocol,
'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host, 'auth_uri': '{}://{}:{}'.format(
keystone_relation['service_port']), auth_protocol,
auth_host,
keystone_relation['service_port']),
'admin_tenant_name': keystone_relation['service_tenant'], 'admin_tenant_name': keystone_relation['service_tenant'],
'admin_user': keystone_relation['service_username'], 'admin_user': keystone_relation['service_username'],
'admin_password': keystone_relation['service_password'], 'admin_password': keystone_relation['service_password'],
@@ -456,10 +467,10 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
unit = self.swift_proxy_sentry unit = self.swift_proxy_sentry
conf = '/etc/swift/proxy-server.conf' conf = '/etc/swift/proxy-server.conf'
keystone_relation = self.keystone_sentry.relation('identity-service', keystone_relation = self.keystone_sentry.relation(
'swift-proxy:identity-service') 'identity-service', 'swift-proxy:identity-service')
swift_proxy_relation = unit.relation('identity-service', swift_proxy_relation = unit.relation(
'keystone:identity-service') 'identity-service', 'keystone:identity-service')
swift_proxy_ip = swift_proxy_relation['private-address'] swift_proxy_ip = swift_proxy_relation['private-address']
auth_host = keystone_relation['auth_host'] auth_host = keystone_relation['auth_host']
auth_protocol = keystone_relation['auth_protocol'] auth_protocol = keystone_relation['auth_protocol']
@@ -503,8 +514,10 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
'auth_host': auth_host, 'auth_host': auth_host,
'auth_port': keystone_relation['auth_port'], 'auth_port': keystone_relation['auth_port'],
'auth_protocol': auth_protocol, 'auth_protocol': auth_protocol,
'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host, 'auth_uri': '{}://{}:{}'.format(
keystone_relation['service_port']), auth_protocol,
auth_host,
keystone_relation['service_port']),
'admin_tenant_name': keystone_relation['service_tenant'], 'admin_tenant_name': keystone_relation['service_tenant'],
'admin_user': keystone_relation['service_username'], 'admin_user': keystone_relation['service_username'],
'admin_password': keystone_relation['service_password'], 'admin_password': keystone_relation['service_password'],
@@ -540,10 +553,10 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
unit = self.swift_proxy_sentry unit = self.swift_proxy_sentry
conf = '/etc/swift/proxy-server.conf' conf = '/etc/swift/proxy-server.conf'
keystone_relation = self.keystone_sentry.relation('identity-service', keystone_relation = self.keystone_sentry.relation(
'swift-proxy:identity-service') 'identity-service', 'swift-proxy:identity-service')
swift_proxy_relation = unit.relation('identity-service', swift_proxy_relation = unit.relation(
'keystone:identity-service') 'identity-service', 'keystone:identity-service')
swift_proxy_ip = swift_proxy_relation['private-address'] swift_proxy_ip = swift_proxy_relation['private-address']
auth_host = keystone_relation['auth_host'] auth_host = keystone_relation['auth_host']
auth_protocol = keystone_relation['auth_protocol'] auth_protocol = keystone_relation['auth_protocol']
@@ -588,8 +601,10 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
'auth_host': auth_host, 'auth_host': auth_host,
'auth_port': keystone_relation['auth_port'], 'auth_port': keystone_relation['auth_port'],
'auth_protocol': auth_protocol, 'auth_protocol': auth_protocol,
'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host, 'auth_uri': '{}://{}:{}'.format(
keystone_relation['service_port']), auth_protocol,
auth_host,
keystone_relation['service_port']),
'admin_tenant_name': keystone_relation['service_tenant'], 'admin_tenant_name': keystone_relation['service_tenant'],
'admin_user': keystone_relation['service_username'], 'admin_user': keystone_relation['service_username'],
'admin_password': keystone_relation['service_password'], 'admin_password': keystone_relation['service_password'],
@@ -624,10 +639,10 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
unit = self.swift_proxy_sentry unit = self.swift_proxy_sentry
conf = '/etc/swift/proxy-server.conf' conf = '/etc/swift/proxy-server.conf'
keystone_relation = self.keystone_sentry.relation('identity-service', keystone_relation = self.keystone_sentry.relation(
'swift-proxy:identity-service') 'identity-service', 'swift-proxy:identity-service')
swift_proxy_relation = unit.relation('identity-service', swift_proxy_relation = unit.relation(
'keystone:identity-service') 'identity-service', 'keystone:identity-service')
swift_proxy_ip = swift_proxy_relation['private-address'] swift_proxy_ip = swift_proxy_relation['private-address']
auth_host = keystone_relation['auth_host'] auth_host = keystone_relation['auth_host']
auth_protocol = keystone_relation['auth_protocol'] auth_protocol = keystone_relation['auth_protocol']
@@ -669,8 +684,10 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
'auth_host': auth_host, 'auth_host': auth_host,
'auth_port': keystone_relation['auth_port'], 'auth_port': keystone_relation['auth_port'],
'auth_protocol': auth_protocol, 'auth_protocol': auth_protocol,
'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host, 'auth_uri': '{}://{}:{}'.format(
keystone_relation['service_port']), auth_protocol,
auth_host,
keystone_relation['service_port']),
'admin_tenant_name': keystone_relation['service_tenant'], 'admin_tenant_name': keystone_relation['service_tenant'],
'admin_user': keystone_relation['service_username'], 'admin_user': keystone_relation['service_username'],
'admin_password': keystone_relation['service_password'], 'admin_password': keystone_relation['service_password'],
@@ -704,10 +721,10 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
unit = self.swift_proxy_sentry unit = self.swift_proxy_sentry
conf = '/etc/swift/proxy-server.conf' conf = '/etc/swift/proxy-server.conf'
keystone_relation = self.keystone_sentry.relation('identity-service', keystone_relation = self.keystone_sentry.relation(
'swift-proxy:identity-service') 'identity-service', 'swift-proxy:identity-service')
swift_proxy_relation = unit.relation('identity-service', swift_proxy_relation = unit.relation(
'keystone:identity-service') 'identity-service', 'keystone:identity-service')
swift_proxy_ip = swift_proxy_relation['private-address'] swift_proxy_ip = swift_proxy_relation['private-address']
auth_host = keystone_relation['auth_host'] auth_host = keystone_relation['auth_host']
auth_protocol = keystone_relation['auth_protocol'] auth_protocol = keystone_relation['auth_protocol']
@@ -749,8 +766,10 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
'auth_host': auth_host, 'auth_host': auth_host,
'auth_port': keystone_relation['auth_port'], 'auth_port': keystone_relation['auth_port'],
'auth_protocol': auth_protocol, 'auth_protocol': auth_protocol,
'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host, 'auth_uri': '{}://{}:{}'.format(
keystone_relation['service_port']), auth_protocol,
auth_host,
keystone_relation['service_port']),
'admin_tenant_name': keystone_relation['service_tenant'], 'admin_tenant_name': keystone_relation['service_tenant'],
'admin_user': keystone_relation['service_username'], 'admin_user': keystone_relation['service_username'],
'admin_password': keystone_relation['service_password'], 'admin_password': keystone_relation['service_password'],
@@ -778,8 +797,10 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
amulet.raise_status(amulet.FAIL, msg=message) amulet.raise_status(amulet.FAIL, msg=message)
def test_image_create(self): def test_image_create(self):
"""Create an instance in glance, which is backed by swift, and validate """Create an instance in glance, which is backed by swift, and
that some of the metadata for the image match in glance and swift.""" validate that some of the metadata for the image match in glance
and swift.
"""
# NOTE(coreycb): Skipping failing test on folsom until resolved. On # NOTE(coreycb): Skipping failing test on folsom until resolved. On
# folsom only, uploading an image to glance gets 400 Bad # folsom only, uploading an image to glance gets 400 Bad
# Request - Error uploading image: (error): [Errno 111] # Request - Error uploading image: (error): [Errno 111]
@@ -809,7 +830,8 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
# Validate that swift object's checksum/size match that from glance # Validate that swift object's checksum/size match that from glance
headers, containers = self.swift.get_account() headers, containers = self.swift.get_account()
if len(containers) != 1: if len(containers) != 1:
msg = "Expected 1 swift container, found {}".format(len(containers)) msg = ("Expected 1 swift container, found "
"{}".format(len(containers)))
amulet.raise_status(amulet.FAIL, msg=msg) amulet.raise_status(amulet.FAIL, msg=msg)
container_name = containers[0].get('name') container_name = containers[0].get('name')
@@ -823,13 +845,13 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
swift_object_md5 = objects[0].get('hash') swift_object_md5 = objects[0].get('hash')
if glance_image_size != swift_object_size: if glance_image_size != swift_object_size:
msg = "Glance image size {} != swift object size {}".format( \ msg = ("Glance image size {} != swift object size "
glance_image_size, swift_object_size) "{}".format(glance_image_size, swift_object_size))
amulet.raise_status(amulet.FAIL, msg=msg) amulet.raise_status(amulet.FAIL, msg=msg)
if glance_image_md5 != swift_object_md5: if glance_image_md5 != swift_object_md5:
msg = "Glance image hash {} != swift object hash {}".format( \ msg = ("Glance image hash {} != swift object hash "
glance_image_md5, swift_object_md5) "{}".format(glance_image_md5, swift_object_md5))
amulet.raise_status(amulet.FAIL, msg=msg) amulet.raise_status(amulet.FAIL, msg=msg)
# Cleanup # Cleanup