Fix and enable gating on H402

End one-line docstrings with punctuation.
Change them to command style where necessary.

Change-Id: I8ff689c3a2f20d489286f80112c6dc95c97f2f31
This commit is contained in:
Dirk Mueller 2013-06-27 17:49:55 +02:00
parent 0c775cbd78
commit af7ca70e3e
11 changed files with 58 additions and 58 deletions

View File

@ -69,7 +69,7 @@ class FindResourceTestCase(test_utils.TestCase):
self.manager = FakeManager(None) self.manager = FakeManager(None)
def test_find_none(self): def test_find_none(self):
"""Test a few non-valid inputs""" """Test a few non-valid inputs."""
self.assertRaises(exceptions.CommandError, self.assertRaises(exceptions.CommandError,
utils.find_resource, utils.find_resource,
self.manager, self.manager,

View File

@ -47,7 +47,7 @@ def add_arg(f, *args, **kwargs):
def bool_from_str(val): def bool_from_str(val):
"""Convert a string representation of a bool into a bool value""" """Convert a string representation of a bool into a bool value."""
if not val: if not val:
return False return False
@ -62,7 +62,7 @@ def bool_from_str(val):
def add_resource_manager_extra_kwargs_hook(f, hook): def add_resource_manager_extra_kwargs_hook(f, hook):
"""Adds hook to bind CLI arguments to ResourceManager calls. """Add hook to bind CLI arguments to ResourceManager calls.
The `do_foo` calls in shell.py will receive CLI args and then in turn pass The `do_foo` calls in shell.py will receive CLI args and then in turn pass
them through to the ResourceManager. Before passing through the args, the them through to the ResourceManager. Before passing through the args, the

View File

@ -36,7 +36,7 @@ class AgentsManager(base.ManagerWithFind):
resource_class = Agent resource_class = Agent
def list(self, hypervisor=None): def list(self, hypervisor=None):
"""Lists all agent builds.""" """List all agent builds."""
url = "/os-agents" url = "/os-agents"
if hypervisor: if hypervisor:
url = "/os-agents?hypervisor=%s" % hypervisor url = "/os-agents?hypervisor=%s" % hypervisor
@ -53,7 +53,7 @@ class AgentsManager(base.ManagerWithFind):
def create(self, os, architecture, version, def create(self, os, architecture, version,
url, md5hash, hypervisor): url, md5hash, hypervisor):
"""Creates a new agent build""" """Create a new agent build."""
body = {'agent': { body = {'agent': {
'hypervisor': hypervisor, 'hypervisor': hypervisor,
'os': os, 'os': os,

View File

@ -181,7 +181,7 @@ class BareMetalNodeManager(base.ManagerWithFind):
type=int, type=int,
help='ShellInABox port?') help='ShellInABox port?')
def do_baremetal_node_create(cs, args): def do_baremetal_node_create(cs, args):
"""Create a baremetal node""" """Create a baremetal node."""
node = cs.baremetal.create(args.service_host, args.cpus, node = cs.baremetal.create(args.service_host, args.cpus,
args.memory_mb, args.local_gb, args.prov_mac_address, args.memory_mb, args.local_gb, args.prov_mac_address,
pm_address=args.pm_address, pm_user=args.pm_user, pm_address=args.pm_address, pm_user=args.pm_user,
@ -194,7 +194,7 @@ def do_baremetal_node_create(cs, args):
metavar='<node>', metavar='<node>',
help='ID of the node to delete.') help='ID of the node to delete.')
def do_baremetal_node_delete(cs, args): def do_baremetal_node_delete(cs, args):
"""Remove a baremetal node and any associated interfaces""" """Remove a baremetal node and any associated interfaces."""
node = _find_baremetal_node(cs, args.node) node = _find_baremetal_node(cs, args.node)
cs.baremetal.delete(node) cs.baremetal.delete(node)
@ -216,7 +216,7 @@ def _translate_baremetal_node_keys(collection):
def _print_baremetal_nodes_list(nodes): def _print_baremetal_nodes_list(nodes):
"""Print the list of baremetal nodes""" """Print the list of baremetal nodes."""
_translate_baremetal_node_keys(nodes) _translate_baremetal_node_keys(nodes)
utils.print_list(nodes, [ utils.print_list(nodes, [
'ID', 'ID',
@ -233,7 +233,7 @@ def _print_baremetal_nodes_list(nodes):
def do_baremetal_node_list(cs, _args): def do_baremetal_node_list(cs, _args):
"""Print a list of available baremetal nodes""" """Print list of available baremetal nodes."""
nodes = cs.baremetal.list() nodes = cs.baremetal.list()
_print_baremetal_nodes_list(nodes) _print_baremetal_nodes_list(nodes)
@ -244,13 +244,13 @@ def _find_baremetal_node(cs, node):
def _print_baremetal_resource(resource): def _print_baremetal_resource(resource):
"""Print the details of a baremetal resource""" """Print details of a baremetal resource."""
info = resource._info.copy() info = resource._info.copy()
utils.print_dict(info) utils.print_dict(info)
def _print_baremetal_node_interfaces(interfaces): def _print_baremetal_node_interfaces(interfaces):
"""Print the interfaces of a baremetal node""" """Print interfaces of a baremetal node."""
utils.print_list(interfaces, [ utils.print_list(interfaces, [
'ID', 'ID',
'Datapath_ID', 'Datapath_ID',
@ -263,7 +263,7 @@ def _print_baremetal_node_interfaces(interfaces):
metavar='<node>', metavar='<node>',
help="ID of node") help="ID of node")
def do_baremetal_node_show(cs, args): def do_baremetal_node_show(cs, args):
"""Show information about a baremetal node""" """Show information about a baremetal node."""
node = _find_baremetal_node(cs, args.node) node = _find_baremetal_node(cs, args.node)
_print_baremetal_resource(node) _print_baremetal_resource(node)
@ -283,7 +283,7 @@ def do_baremetal_node_show(cs, args):
metavar='<port_no>', metavar='<port_no>',
help="OpenFlow port number of interface") help="OpenFlow port number of interface")
def do_baremetal_interface_add(cs, args): def do_baremetal_interface_add(cs, args):
"""Add a network interface to a baremetal node""" """Add a network interface to a baremetal node."""
bmif = cs.baremetal.add_interface(args.node, args.address, bmif = cs.baremetal.add_interface(args.node, args.address,
args.datapath_id, args.port_no) args.datapath_id, args.port_no)
_print_baremetal_resource(bmif) _print_baremetal_resource(bmif)
@ -292,12 +292,12 @@ def do_baremetal_interface_add(cs, args):
@utils.arg('node', metavar='<node>', help="ID of node") @utils.arg('node', metavar='<node>', help="ID of node")
@utils.arg('address', metavar='<address>', help="MAC address of interface") @utils.arg('address', metavar='<address>', help="MAC address of interface")
def do_baremetal_interface_remove(cs, args): def do_baremetal_interface_remove(cs, args):
"""Remove a network interface from a baremetal node""" """Remove a network interface from a baremetal node."""
cs.baremetal.remove_interface(args.node, args.address) cs.baremetal.remove_interface(args.node, args.address)
@utils.arg('node', metavar='<node>', help="ID of node") @utils.arg('node', metavar='<node>', help="ID of node")
def do_baremetal_interface_list(cs, args): def do_baremetal_interface_list(cs, args):
"""List network interfaces associated with a baremetal node""" """List network interfaces associated with a baremetal node."""
interfaces = cs.baremetal.list_interfaces(args.node) interfaces = cs.baremetal.list_interfaces(args.node)
_print_baremetal_node_interfaces(interfaces) _print_baremetal_node_interfaces(interfaces)

View File

@ -42,7 +42,7 @@ class FlavorAccessManager(base.ManagerWithFind):
'flavor_access') 'flavor_access')
def _list_by_tenant(self, tenant): def _list_by_tenant(self, tenant):
"""Print flavor list shared with the given tenant""" """Print flavor list shared with the given tenant."""
# TODO(uni): need to figure out a proper URI for list_by_tenant # TODO(uni): need to figure out a proper URI for list_by_tenant
# since current API already provided current tenant_id information # since current API already provided current tenant_id information
raise NotImplementedError('Sorry, query by tenant not supported.') raise NotImplementedError('Sorry, query by tenant not supported.')

View File

@ -74,7 +74,7 @@ class FloatingIPDNSDomainManager(base.Manager):
'domain_entry') 'domain_entry')
def delete(self, fqdomain): def delete(self, fqdomain):
"""Delete the specified domain""" """Delete the specified domain."""
self._delete("/os-floating-ip-dns/%s" % _quote_domain(fqdomain)) self._delete("/os-floating-ip-dns/%s" % _quote_domain(fqdomain))

View File

@ -57,7 +57,7 @@ class HostManager(base.ManagerWithFind):
return self._update("/os-hosts/%s" % host, values) return self._update("/os-hosts/%s" % host, values)
def host_action(self, host, action): def host_action(self, host, action):
"""Performs an action on a host.""" """Perform an action on a host."""
body = {action: None} body = {action: None}
url = '/os-hosts/%s/action' % host url = '/os-hosts/%s/action' % host
return self.api.client.post(url, body=body) return self.api.client.post(url, body=body)

View File

@ -6,7 +6,7 @@ from novaclient import base
class Limits(base.Resource): class Limits(base.Resource):
"""A collection of RateLimit and AbsoluteLimit objects""" """A collection of RateLimit and AbsoluteLimit objects."""
def __repr__(self): def __repr__(self):
return "<Limits>" return "<Limits>"
@ -28,7 +28,7 @@ class Limits(base.Resource):
class RateLimit(object): class RateLimit(object):
"""Data model that represents a flattened view of a single rate limit""" """Data model that represents a flattened view of a single rate limit."""
def __init__(self, verb, uri, regex, value, remain, def __init__(self, verb, uri, regex, value, remain,
unit, next_available): unit, next_available):
@ -54,7 +54,7 @@ class RateLimit(object):
class AbsoluteLimit(object): class AbsoluteLimit(object):
"""Data model that represents a single absolute limit""" """Data model that represents a single absolute limit."""
def __init__(self, name, value): def __init__(self, name, value):
self.name = name self.name = name
@ -68,7 +68,7 @@ class AbsoluteLimit(object):
class LimitsManager(base.Manager): class LimitsManager(base.Manager):
"""Manager object used to interact with limits resource""" """Manager object used to interact with limits resource."""
resource_class = Limits resource_class = Limits

View File

@ -51,16 +51,16 @@ class ServiceManager(base.ManagerWithFind):
return self._list(url, "services") return self._list(url, "services")
def enable(self, host, binary): def enable(self, host, binary):
"""Enable the service specified by hostname and binary""" """Enable the service specified by hostname and binary."""
body = {"host": host, "binary": binary} body = {"host": host, "binary": binary}
return self._update("/os-services/enable", body, "service") return self._update("/os-services/enable", body, "service")
def disable(self, host, binary): def disable(self, host, binary):
"""Enable the service specified by hostname and binary""" """Disable the service specified by hostname and binary."""
body = {"host": host, "binary": binary} body = {"host": host, "binary": binary}
return self._update("/os-services/disable", body, "service") return self._update("/os-services/disable", body, "service")
def disable_log_reason(self, host, binary, reason): def disable_log_reason(self, host, binary, reason):
"""Disable the service with reason""" """Disable the service with reason."""
body = {"host": host, "binary": binary, "disabled_reason": reason} body = {"host": host, "binary": binary, "disabled_reason": reason}
return self._update("/os-services/disable-log-reason", body, "service") return self._update("/os-services/disable-log-reason", body, "service")

View File

@ -341,14 +341,14 @@ def do_cloudpipe_list(cs, _args):
@utils.arg('project', metavar='<project>', help='Name of the project.') @utils.arg('project', metavar='<project>', help='Name of the project.')
def do_cloudpipe_create(cs, args): def do_cloudpipe_create(cs, args):
"""Create a cloudpipe instance for the given project""" """Create a cloudpipe instance for the given project."""
cs.cloudpipe.create(args.project) cs.cloudpipe.create(args.project)
@utils.arg('address', metavar='<ip address>', help='New IP Address.') @utils.arg('address', metavar='<ip address>', help='New IP Address.')
@utils.arg('port', metavar='<port>', help='New Port.') @utils.arg('port', metavar='<port>', help='New Port.')
def do_cloudpipe_configure(cs, args): def do_cloudpipe_configure(cs, args):
"""Update the VPN IP/port of a cloudpipe instance""" """Update the VPN IP/port of a cloudpipe instance."""
cs.cloudpipe.update(args.address, args.port) cs.cloudpipe.update(args.address, args.port)
@ -627,7 +627,7 @@ def do_flavor_access_remove(cs, args):
@utils.arg('project_id', metavar='<project_id>', @utils.arg('project_id', metavar='<project_id>',
help='The ID of the project.') help='The ID of the project.')
def do_scrub(cs, args): def do_scrub(cs, args):
"""Deletes data associated with the project""" """Delete data associated with the project."""
networks_list = cs.networks.list() networks_list = cs.networks.list()
networks_list = [network for network in networks_list networks_list = [network for network in networks_list
if getattr(network, 'project_id', '') == args.project_id] if getattr(network, 'project_id', '') == args.project_id]
@ -1266,7 +1266,7 @@ def do_image_create(cs, args):
@utils.arg('rotation', metavar='<rotation>', @utils.arg('rotation', metavar='<rotation>',
help='Int parameter representing how many backups to keep around.') help='Int parameter representing how many backups to keep around.')
def do_backup(cs, args): def do_backup(cs, args):
"""Backup a instance by create a 'backup' type snapshot """ """Backup a instance by create a 'backup' type snapshot."""
_find_server(cs, args.server).backup(args.name, _find_server(cs, args.server).backup(args.name,
args.backup_type, args.backup_type,
args.rotation) args.rotation)
@ -1789,7 +1789,7 @@ def do_floating_ip_pool_list(cs, _args):
@utils.arg('--host', dest='host', metavar='<host>', default=None, @utils.arg('--host', dest='host', metavar='<host>', default=None,
help='Filter by host') help='Filter by host')
def do_floating_ip_bulk_list(cs, args): def do_floating_ip_bulk_list(cs, args):
"""List all floating ips""" """List all floating ips."""
utils.print_list(cs.floating_ips_bulk.list(args.host), ['project_id', utils.print_list(cs.floating_ips_bulk.list(args.host), ['project_id',
'address', 'address',
'instance_uuid', 'instance_uuid',
@ -1803,13 +1803,13 @@ def do_floating_ip_bulk_list(cs, args):
@utils.arg('--interface', metavar='<interface>', default=None, @utils.arg('--interface', metavar='<interface>', default=None,
help='Interface for new Floating IPs') help='Interface for new Floating IPs')
def do_floating_ip_bulk_create(cs, args): def do_floating_ip_bulk_create(cs, args):
"""Bulk create floating ips by range""" """Bulk create floating ips by range."""
cs.floating_ips_bulk.create(args.ip_range, args.pool, args.interface) cs.floating_ips_bulk.create(args.ip_range, args.pool, args.interface)
@utils.arg('ip_range', metavar='<range>', help='Address range to delete') @utils.arg('ip_range', metavar='<range>', help='Address range to delete')
def do_floating_ip_bulk_delete(cs, args): def do_floating_ip_bulk_delete(cs, args):
"""Bulk delete floating ips by range""" """Bulk delete floating ips by range."""
cs.floating_ips_bulk.delete(args.ip_range) cs.floating_ips_bulk.delete(args.ip_range)
@ -2143,7 +2143,7 @@ def do_secgroup_delete_group_rule(cs, args):
@utils.arg('--pub_key', @utils.arg('--pub_key',
help=argparse.SUPPRESS) help=argparse.SUPPRESS)
def do_keypair_add(cs, args): def do_keypair_add(cs, args):
"""Create a new key pair for use with instances""" """Create a new key pair for use with instances."""
name = args.name name = args.name
pub_key = args.pub_key pub_key = args.pub_key
@ -2164,7 +2164,7 @@ def do_keypair_add(cs, args):
@utils.arg('name', metavar='<name>', help='Keypair name to delete.') @utils.arg('name', metavar='<name>', help='Keypair name to delete.')
def do_keypair_delete(cs, args): def do_keypair_delete(cs, args):
"""Delete keypair by its name""" """Delete keypair given by its name."""
name = args.name name = args.name
cs.keypairs.delete(name) cs.keypairs.delete(name)
@ -2224,7 +2224,7 @@ def do_rate_limits(cs, args):
help='Usage range end date, ex 2012-01-20 (default: tomorrow) ', help='Usage range end date, ex 2012-01-20 (default: tomorrow) ',
default=None) default=None)
def do_usage_list(cs, args): def do_usage_list(cs, args):
"""List usage data for all tenants""" """List usage data for all tenants."""
dateformat = "%Y-%m-%d" dateformat = "%Y-%m-%d"
rows = ["Tenant ID", "Instances", "RAM MB-Hours", "CPU Hours", rows = ["Tenant ID", "Instances", "RAM MB-Hours", "CPU Hours",
"Disk GB-Hours"] "Disk GB-Hours"]
@ -2271,7 +2271,7 @@ def do_usage_list(cs, args):
default=None, default=None,
help='UUID or name of tenant to get usage for.') help='UUID or name of tenant to get usage for.')
def do_usage(cs, args): def do_usage(cs, args):
"""Show usage data for a single tenant""" """Show usage data for a single tenant."""
dateformat = "%Y-%m-%d" dateformat = "%Y-%m-%d"
rows = ["Instances", "RAM MB-Hours", "CPU Hours", "Disk GB-Hours"] rows = ["Instances", "RAM MB-Hours", "CPU Hours", "Disk GB-Hours"]
@ -2321,7 +2321,7 @@ def do_usage(cs, args):
default='cert.pem', default='cert.pem',
help='Filename for the X.509 certificate [Default: cert.pem]') help='Filename for the X.509 certificate [Default: cert.pem]')
def do_x509_create_cert(cs, args): def do_x509_create_cert(cs, args):
"""Create x509 cert for a user in tenant""" """Create x509 cert for a user in tenant."""
if os.path.exists(args.pk_filename): if os.path.exists(args.pk_filename):
raise exceptions.CommandError("Unable to write privatekey - %s exists." raise exceptions.CommandError("Unable to write privatekey - %s exists."
@ -2351,7 +2351,7 @@ def do_x509_create_cert(cs, args):
default='cacert.pem', default='cacert.pem',
help='Filename to write the x509 root cert.') help='Filename to write the x509 root cert.')
def do_x509_get_root_cert(cs, args): def do_x509_get_root_cert(cs, args):
"""Fetches the x509 root cert.""" """Fetch the x509 root cert."""
if os.path.exists(args.filename): if os.path.exists(args.filename):
raise exceptions.CommandError("Unable to write x509 root cert - \ raise exceptions.CommandError("Unable to write x509 root cert - \
%s exists." % args.filename) %s exists." % args.filename)
@ -2365,7 +2365,7 @@ def do_x509_get_root_cert(cs, args):
@utils.arg('--hypervisor', metavar='<hypervisor>', default=None, @utils.arg('--hypervisor', metavar='<hypervisor>', default=None,
help='type of hypervisor.') help='type of hypervisor.')
def do_agent_list(cs, args): def do_agent_list(cs, args):
"""List all builds""" """List all builds."""
result = cs.agents.list(args.hypervisor) result = cs.agents.list(args.hypervisor)
columns = ["Agent_id", "Hypervisor", "OS", "Architecture", "Version", columns = ["Agent_id", "Hypervisor", "OS", "Architecture", "Version",
'Md5hash', 'Url'] 'Md5hash', 'Url']
@ -2381,7 +2381,7 @@ def do_agent_list(cs, args):
@utils.arg('hypervisor', metavar='<hypervisor>', default='xen', @utils.arg('hypervisor', metavar='<hypervisor>', default='xen',
help='type of hypervisor.') help='type of hypervisor.')
def do_agent_create(cs, args): def do_agent_create(cs, args):
"""Creates a new agent build.""" """Create new agent build."""
result = cs.agents.create(args.os, args.architecture, result = cs.agents.create(args.os, args.architecture,
args.version, args.url, args.version, args.url,
args.md5hash, args.hypervisor) args.md5hash, args.hypervisor)
@ -2390,7 +2390,7 @@ def do_agent_create(cs, args):
@utils.arg('id', metavar='<id>', help='id of the agent-build') @utils.arg('id', metavar='<id>', help='id of the agent-build')
def do_agent_delete(cs, args): def do_agent_delete(cs, args):
"""Deletes an existing agent build.""" """Delete existing agent build."""
cs.agents.delete(args.id) cs.agents.delete(args.id)
@ -2399,7 +2399,7 @@ def do_agent_delete(cs, args):
@utils.arg('url', metavar='<url>', help='url') @utils.arg('url', metavar='<url>', help='url')
@utils.arg('md5hash', metavar='<md5hash>', help='md5hash') @utils.arg('md5hash', metavar='<md5hash>', help='md5hash')
def do_agent_modify(cs, args): def do_agent_modify(cs, args):
"""Modify an existing agent build.""" """Modify existing agent build."""
result = cs.agents.update(args.id, args.version, result = cs.agents.update(args.id, args.version,
args.url, args.md5hash) args.url, args.md5hash)
utils.print_dict(result._info) utils.print_dict(result._info)
@ -2515,7 +2515,7 @@ def _print_aggregate_details(aggregate):
action='store_true', action='store_true',
help=argparse.SUPPRESS) help=argparse.SUPPRESS)
def do_live_migration(cs, args): def do_live_migration(cs, args):
"""Migrates a running instance to a new machine.""" """Migrate running instance to a new machine."""
_find_server(cs, args.server).live_migrate(args.host, _find_server(cs, args.server).live_migrate(args.host,
args.block_migrate, args.block_migrate,
args.disk_over_commit) args.disk_over_commit)
@ -2527,7 +2527,7 @@ def do_live_migration(cs, args):
help='Request the instance be reset to "active" state instead ' help='Request the instance be reset to "active" state instead '
'of "error" state (the default).') 'of "error" state (the default).')
def do_reset_state(cs, args): def do_reset_state(cs, args):
"""Reset the state of an instance""" """Reset the state of an instance."""
_find_server(cs, args.server).reset_state(args.state) _find_server(cs, args.server).reset_state(args.state)
@ -2555,7 +2555,7 @@ def do_service_list(cs, args):
@utils.arg('host', metavar='<hostname>', help='Name of host.') @utils.arg('host', metavar='<hostname>', help='Name of host.')
@utils.arg('binary', metavar='<binary>', help='Service binary.') @utils.arg('binary', metavar='<binary>', help='Service binary.')
def do_service_enable(cs, args): def do_service_enable(cs, args):
"""Enable the service""" """Enable the service."""
result = cs.services.enable(args.host, args.binary) result = cs.services.enable(args.host, args.binary)
utils.print_list([result], ['Host', 'Binary', 'Status']) utils.print_list([result], ['Host', 'Binary', 'Status'])
@ -2565,7 +2565,7 @@ def do_service_enable(cs, args):
@utils.arg('--reason', metavar='<reason>', @utils.arg('--reason', metavar='<reason>',
help='Reason for disabling service.') help='Reason for disabling service.')
def do_service_disable(cs, args): def do_service_disable(cs, args):
"""Disable the service""" """Disable the service."""
if args.reason: if args.reason:
result = cs.services.disable_log_reason(args.host, args.binary, result = cs.services.disable_log_reason(args.host, args.binary,
args.reason) args.reason)
@ -2578,26 +2578,26 @@ def do_service_disable(cs, args):
@utils.arg('fixed_ip', metavar='<fixed_ip>', help='Fixed IP Address.') @utils.arg('fixed_ip', metavar='<fixed_ip>', help='Fixed IP Address.')
def do_fixed_ip_get(cs, args): def do_fixed_ip_get(cs, args):
"""Get info on a fixed ip""" """Retrieve info on a fixed ip."""
result = cs.fixed_ips.get(args.fixed_ip) result = cs.fixed_ips.get(args.fixed_ip)
utils.print_list([result], ['address', 'cidr', 'hostname', 'host']) utils.print_list([result], ['address', 'cidr', 'hostname', 'host'])
@utils.arg('fixed_ip', metavar='<fixed_ip>', help='Fixed IP Address.') @utils.arg('fixed_ip', metavar='<fixed_ip>', help='Fixed IP Address.')
def do_fixed_ip_reserve(cs, args): def do_fixed_ip_reserve(cs, args):
"""Reserve a fixed ip""" """Reserve a fixed IP."""
cs.fixed_ips.reserve(args.fixed_ip) cs.fixed_ips.reserve(args.fixed_ip)
@utils.arg('fixed_ip', metavar='<fixed_ip>', help='Fixed IP Address.') @utils.arg('fixed_ip', metavar='<fixed_ip>', help='Fixed IP Address.')
def do_fixed_ip_unreserve(cs, args): def do_fixed_ip_unreserve(cs, args):
"""Unreserve a fixed ip""" """Unreserve a fixed IP."""
cs.fixed_ips.unreserve(args.fixed_ip) cs.fixed_ips.unreserve(args.fixed_ip)
@utils.arg('host', metavar='<hostname>', help='Name of host.') @utils.arg('host', metavar='<hostname>', help='Name of host.')
def do_host_describe(cs, args): def do_host_describe(cs, args):
"""Describe a specific host""" """Describe a specific host."""
result = cs.hosts.get(args.host) result = cs.hosts.get(args.host)
columns = ["HOST", "PROJECT", "cpu", "memory_mb", "disk_gb"] columns = ["HOST", "PROJECT", "cpu", "memory_mb", "disk_gb"]
utils.print_list(result, columns) utils.print_list(result, columns)
@ -2607,7 +2607,7 @@ def do_host_describe(cs, args):
help='Filters the list, returning only those ' help='Filters the list, returning only those '
'hosts in the availability zone <zone>.') 'hosts in the availability zone <zone>.')
def do_host_list(cs, args): def do_host_list(cs, args):
"""List all hosts by service""" """List all hosts by service."""
columns = ["host_name", "service", "zone"] columns = ["host_name", "service", "zone"]
result = cs.hosts.list(args.zone) result = cs.hosts.list(args.zone)
utils.print_list(result, columns) utils.print_list(result, columns)
@ -2651,13 +2651,13 @@ def do_host_action(cs, args):
default=False, default=False,
help='Generate a single report for all services.') help='Generate a single report for all services.')
def do_coverage_start(cs, args): def do_coverage_start(cs, args):
"""Start Nova coverage reporting""" """Start Nova coverage reporting."""
cs.coverage.start(combine=args.combine) cs.coverage.start(combine=args.combine)
print("Coverage collection started") print("Coverage collection started")
def do_coverage_stop(cs, args): def do_coverage_stop(cs, args):
"""Stop Nova coverage reporting""" """Stop Nova coverage reporting."""
out = cs.coverage.stop() out = cs.coverage.stop()
print("Coverage data file path: %s" % out[-1]['path']) print("Coverage data file path: %s" % out[-1]['path'])
@ -2674,7 +2674,7 @@ def do_coverage_stop(cs, args):
default=False, default=False,
help='Generate XML reports instead of text ones.') help='Generate XML reports instead of text ones.')
def do_coverage_report(cs, args): def do_coverage_report(cs, args):
"""Generate a coverage report""" """Generate coverage report."""
if args.html == True and args.xml == True: if args.html == True and args.xml == True:
raise exceptions.CommandError("--html and --xml must not be " raise exceptions.CommandError("--html and --xml must not be "
"specified together.") "specified together.")
@ -2770,7 +2770,7 @@ def ensure_service_catalog_present(cs):
def do_endpoints(cs, _args): def do_endpoints(cs, _args):
"""Discover endpoints that get returned from the authenticate services""" """Discover endpoints that get returned from the authenticate services."""
ensure_service_catalog_present(cs) ensure_service_catalog_present(cs)
catalog = cs.client.service_catalog.catalog catalog = cs.client.service_catalog.catalog
for e in catalog['access']['serviceCatalog']: for e in catalog['access']['serviceCatalog']:
@ -2780,7 +2780,7 @@ def do_endpoints(cs, _args):
@utils.arg('--wrap', dest='wrap', metavar='<integer>', default=64, @utils.arg('--wrap', dest='wrap', metavar='<integer>', default=64,
help='wrap PKI tokens to a specified length, or 0 to disable') help='wrap PKI tokens to a specified length, or 0 to disable')
def do_credentials(cs, _args): def do_credentials(cs, _args):
"""Show user credentials returned from auth""" """Show user credentials returned from auth."""
ensure_service_catalog_present(cs) ensure_service_catalog_present(cs)
catalog = cs.client.service_catalog.catalog catalog = cs.client.service_catalog.catalog
utils.print_dict(catalog['access']['user'], "User Credentials", utils.print_dict(catalog['access']['user'], "User Credentials",
@ -3172,7 +3172,7 @@ def do_interface_detach(cs, args):
def _treeizeAvailabilityZone(zone): def _treeizeAvailabilityZone(zone):
"""Build a tree view for availability zones""" """Build a tree view for availability zones."""
AvailabilityZone = availability_zones.AvailabilityZone AvailabilityZone = availability_zones.AvailabilityZone
az = AvailabilityZone(zone.manager, az = AvailabilityZone(zone.manager,

View File

@ -24,6 +24,6 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
downloadcache = ~/cache/pip downloadcache = ~/cache/pip
[flake8] [flake8]
ignore = E12,E711,E721,E712,F841,F811,F821,H302,H306,H402,H403,H404 ignore = E12,E711,E721,E712,F841,F811,F821,H302,H306,H403,H404
show-source = True show-source = True
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build