Fix latest flake8 issues

The latest flake8 checks strings for escape chars, and also has a new
and better rule about line breaks before binary operators - which is
what knuth says should happen.

The escape char check was catching some asterisks in docstrings that
weren't actually providing much, since we already list type as "kwargs".
Just remove them.

Install latest flake8 so we can gate on this.

Change-Id: I89088adcc6f4ff5a894df5e677ae9b28a58edd9a
This commit is contained in:
Monty Taylor 2018-10-29 14:21:42 -05:00
parent a30cc754f2
commit d42811c405
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
31 changed files with 143 additions and 131 deletions

View File

@ -45,6 +45,7 @@ class Opts(object):
def _get_resource_value(resource_key, default):
return config.get_extra_config('example').get(resource_key, default)
SERVER_NAME = 'openstacksdk-example'
IMAGE_NAME = _get_resource_value('image_name', 'cirros-0.3.5-x86_64-disk')
FLAVOR_NAME = _get_resource_value('flavor_name', 'm1.small')

View File

@ -22,7 +22,6 @@ except ImportError:
JSONDecodeError = ValueError
from six.moves import urllib
from keystoneauth1 import adapter
from openstack import exceptions

View File

@ -239,16 +239,16 @@ class Node(resource.Resource):
self._body.clean(only={'provision_state'})
super(Node, self).create(session, *args, **kwargs)
if (self.provision_state == 'enroll' and
expected_provision_state != 'enroll'):
if (self.provision_state == 'enroll'
and expected_provision_state != 'enroll'):
self.set_provision_state(session, 'manage', wait=True)
if (self.provision_state == 'manageable' and
expected_provision_state == 'available'):
if (self.provision_state == 'manageable'
and expected_provision_state == 'available'):
self.set_provision_state(session, 'provide', wait=True)
if (self.provision_state == 'available' and
expected_provision_state == 'manageable'):
if (self.provision_state == 'available'
and expected_provision_state == 'manageable'):
self.set_provision_state(session, 'manage', wait=True)
return self
@ -422,9 +422,9 @@ class Node(resource.Resource):
a failure state is reached.
"""
# NOTE(dtantsur): microversion 1.2 changed None to available
if (self.provision_state == expected_state or
(expected_state == 'available' and
self.provision_state is None)):
if (self.provision_state == expected_state
or (expected_state == 'available'
and self.provision_state is None)):
return True
elif not abort_on_failed_state:
return False
@ -437,8 +437,8 @@ class Node(resource.Resource):
'error': self.last_error})
# Special case: a failure state for "manage" transition can be
# "enroll"
elif (expected_state == 'manageable' and
self.provision_state == 'enroll' and self.last_error):
elif (expected_state == 'manageable'
and self.provision_state == 'enroll' and self.last_error):
raise exceptions.SDKException(
"Node %(node)s could not reach state manageable: "
"failed to verify management credentials; "

View File

@ -41,7 +41,7 @@ class Proxy(proxy.Proxy):
objects will be returned. The default, ``True``, will cause
:class:`~openstack.block_storage.v2.snapshot.SnapshotDetail`
objects to be returned.
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the snapshots being returned. Available parameters include:
* name: Name of the snapshot as a string.
@ -150,7 +150,7 @@ class Proxy(proxy.Proxy):
will be returned. The default, ``True``, will cause
:class:`~openstack.block_storage.v2.volume.VolumeDetail`
objects to be returned.
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the volumes being returned. Available parameters include:
* name: Name of the volume as a string.

View File

@ -27,6 +27,8 @@ def _construct_yaml_str(self, node):
# Override the default string handling function
# to always return unicode objects
return self.construct_scalar(node)
HeatYamlLoader.add_constructor(u'tag:yaml.org,2002:str', _construct_yaml_str)
# Unquoted dates like 2013-05-23 in yaml files get loaded as objects of type
# datetime.data which causes problems in API layer when being processed by

View File

@ -79,8 +79,8 @@ def resolve_template_get_files(template, files, template_base_url,
return True
if not isinstance(value, six.string_types):
return True
if (key == 'type' and
not value.endswith(('.yaml', '.template'))):
if (key == 'type'
and not value.endswith(('.yaml', '.template'))):
return True
return False

View File

@ -113,8 +113,8 @@ def _filter_list(data, name_or_id, filters):
e_id = _make_unicode(e.get('id', None))
e_name = _make_unicode(e.get('name', None))
if ((e_id and e_id == name_or_id) or
(e_name and e_name == name_or_id)):
if ((e_id and e_id == name_or_id)
or (e_name and e_name == name_or_id)):
identifier_matches.append(e)
else:
# Only try fnmatch if we don't match exactly
@ -123,8 +123,8 @@ def _filter_list(data, name_or_id, filters):
# so that we log the bad pattern
bad_pattern = True
continue
if ((e_id and fn_reg.match(e_id)) or
(e_name and fn_reg.match(e_name))):
if ((e_id and fn_reg.match(e_id))
or (e_name and fn_reg.match(e_name))):
identifier_matches.append(e)
if not identifier_matches and bad_pattern:
log.debug("Bad pattern passed to fnmatch", exc_info=True)
@ -187,8 +187,8 @@ def _get_entity(cloud, resource, name_or_id, filters, **kwargs):
# an additional call, it's simple enough to test to see if we got an
# object and just short-circuit return it.
if (hasattr(name_or_id, 'id') or
(isinstance(name_or_id, dict) and 'id' in name_or_id)):
if (hasattr(name_or_id, 'id')
or (isinstance(name_or_id, dict) and 'id' in name_or_id)):
return name_or_id
# If a uuid is passed short-circuit it calling the
@ -528,8 +528,8 @@ def _call_client_and_retry(client, url, retry_on=None,
try:
ret_val = client(url, **kwargs)
except exc.OpenStackCloudHTTPError as e:
if (retry_on is not None and
e.response.status_code in retry_on):
if (retry_on is not None
and e.response.status_code in retry_on):
log.debug('Received retryable error {err}, waiting '
'{wait} seconds to retry', {
'err': e.response.status_code,
@ -570,7 +570,7 @@ def parse_range(value):
if value is None:
return None
range_exp = re.match('(<|>|<=|>=){0,1}(\d+)$', value)
range_exp = re.match(r'(<|>|<=|>=){0,1}(\d+)$', value)
if range_exp is None:
return None

View File

@ -404,8 +404,9 @@ def _get_supplemental_addresses(cloud, server):
try:
# Don't bother doing this before the server is active, it's a waste
# of an API call while polling for a server to come up
if (cloud.has_service('network') and cloud._has_floating_ips() and
server['status'] == 'ACTIVE'):
if (cloud.has_service('network')
and cloud._has_floating_ips()
and server['status'] == 'ACTIVE'):
for port in cloud.search_ports(
filters=dict(device_id=server['id'])):
# This SHOULD return one and only one FIP - but doing it as a

View File

@ -1377,8 +1377,8 @@ class _OpenStackCloudMixin(_normalize.Normalizer):
"""
flavors = self.list_flavors(get_extra=get_extra)
for flavor in sorted(flavors, key=operator.itemgetter('ram')):
if (flavor['ram'] >= ram and
(not include or include in flavor['name'])):
if (flavor['ram'] >= ram
and (not include or include in flavor['name'])):
return flavor
raise exc.OpenStackCloudException(
"Could not find a flavor with {ram} and '{include}'".format(
@ -2402,38 +2402,38 @@ class _OpenStackCloudMixin(_normalize.Normalizer):
or network['id'] in self._external_ipv4_names):
external_ipv4_networks.append(network)
elif ((('router:external' in network
and network['router:external']) or
network.get('provider:physical_network')) and
network['name'] not in self._internal_ipv4_names and
network['id'] not in self._internal_ipv4_names):
and network['router:external'])
or network.get('provider:physical_network'))
and network['name'] not in self._internal_ipv4_names
and network['id'] not in self._internal_ipv4_names):
external_ipv4_networks.append(network)
# Internal networks
if (network['name'] in self._internal_ipv4_names
or network['id'] in self._internal_ipv4_names):
internal_ipv4_networks.append(network)
elif (not network.get('router:external', False) and
not network.get('provider:physical_network') and
network['name'] not in self._external_ipv4_names and
network['id'] not in self._external_ipv4_names):
elif (not network.get('router:external', False)
and not network.get('provider:physical_network')
and network['name'] not in self._external_ipv4_names
and network['id'] not in self._external_ipv4_names):
internal_ipv4_networks.append(network)
# External networks
if (network['name'] in self._external_ipv6_names
or network['id'] in self._external_ipv6_names):
external_ipv6_networks.append(network)
elif (network.get('router:external') and
network['name'] not in self._internal_ipv6_names and
network['id'] not in self._internal_ipv6_names):
elif (network.get('router:external')
and network['name'] not in self._internal_ipv6_names
and network['id'] not in self._internal_ipv6_names):
external_ipv6_networks.append(network)
# Internal networks
if (network['name'] in self._internal_ipv6_names
or network['id'] in self._internal_ipv6_names):
internal_ipv6_networks.append(network)
elif (not network.get('router:external', False) and
network['name'] not in self._external_ipv6_names and
network['id'] not in self._external_ipv6_names):
elif (not network.get('router:external', False)
and network['name'] not in self._external_ipv6_names
and network['id'] not in self._external_ipv6_names):
internal_ipv6_networks.append(network)
# External Floating IPv4 networks
@ -2612,8 +2612,8 @@ class _OpenStackCloudMixin(_normalize.Normalizer):
"""
self._find_interesting_networks()
return list(
set(self._external_ipv4_networks) |
set(self._external_ipv6_networks))
set(self._external_ipv4_networks)
| set(self._external_ipv6_networks))
def get_internal_networks(self):
"""Return the networks that are configured to not route northbound.
@ -2625,8 +2625,8 @@ class _OpenStackCloudMixin(_normalize.Normalizer):
"""
self._find_interesting_networks()
return list(
set(self._internal_ipv4_networks) |
set(self._internal_ipv6_networks))
set(self._internal_ipv4_networks)
| set(self._internal_ipv6_networks))
def get_external_ipv4_networks(self):
"""Return the networks that are configured to route northbound.
@ -9744,8 +9744,8 @@ class _OpenStackCloudMixin(_normalize.Normalizer):
"Timeout waiting for reservation to clear "
"before setting provide state"):
machine = self.get_machine(machine['uuid'])
if (machine['reservation'] is None and
machine['provision_state'] is not 'enroll'):
if (machine['reservation'] is None
and machine['provision_state'] != 'enroll'):
# NOTE(TheJulia): In this case, the node has
# has moved on from the previous state and is
# likely not being verified, as no lock is

View File

@ -134,7 +134,7 @@ class Proxy(proxy.Proxy):
def profiles(self, **query):
"""Retrieve a generator of profiles.
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
restrict the profiles to be returned. Available parameters include:
* name: The name of a profile.
@ -247,7 +247,7 @@ class Proxy(proxy.Proxy):
def clusters(self, **query):
"""Retrieve a generator of clusters.
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
restrict the clusters to be returned. Available parameters include:
* name: The name of a cluster.
@ -302,7 +302,7 @@ class Proxy(proxy.Proxy):
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param nodes: List of nodes to be removed from the cluster.
:param kwargs \*\*params: Optional query parameters to be sent to
:param kwargs params: Optional query parameters to be sent to
restrict the nodes to be returned. Available parameters include:
* destroy_after_deletion: A boolean value indicating whether the
@ -364,7 +364,7 @@ class Proxy(proxy.Proxy):
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param dict \*\*params: A dictionary providing the parameters for the
:param dict params: A dictionary providing the parameters for the
resize action.
:returns: A dict containing the action initiated by this operation.
"""
@ -380,7 +380,7 @@ class Proxy(proxy.Proxy):
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param policy: Either the name or the ID of a policy.
:param dict \*\*params: A dictionary containing the properties for the
:param dict params: A dictionary containing the properties for the
policy to be attached.
:returns: A dict containing the action initiated by this operation.
"""
@ -410,7 +410,7 @@ class Proxy(proxy.Proxy):
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param policy: Either the name or the ID of a policy.
:param dict \*\*params: A dictionary containing the new properties for
:param dict params: A dictionary containing the new properties for
the policy.
:returns: A dict containing the action initiated by this operation.
"""
@ -544,7 +544,7 @@ class Proxy(proxy.Proxy):
def nodes(self, **query):
"""Retrieve a generator of nodes.
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
restrict the nodes to be returned. Available parameters include:
* cluster_id: A string including the name or ID of a cluster to
@ -708,7 +708,7 @@ class Proxy(proxy.Proxy):
def policies(self, **query):
"""Retrieve a generator of policies.
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
restrict the policies to be returned. Available parameters include:
* name: The name of a policy.
@ -760,7 +760,7 @@ class Proxy(proxy.Proxy):
:param cluster: The value can be the name or ID of a cluster or a
:class:`~openstack.clustering.v1.cluster.Cluster` instance.
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
restrict the policies to be returned. Available parameters include:
* enabled: A boolean value indicating whether the policy is
@ -858,7 +858,7 @@ class Proxy(proxy.Proxy):
def receivers(self, **query):
"""Retrieve a generator of receivers.
:param kwargs \*\*query: Optional query parameters for restricting the
:param kwargs query: Optional query parameters for restricting the
receivers to be returned. Available parameters include:
* name: The name of a receiver object.
@ -891,7 +891,7 @@ class Proxy(proxy.Proxy):
def actions(self, **query):
"""Retrieve a generator of actions.
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
restrict the actions to be returned. Available parameters include:
* name: name of action for query.
@ -929,7 +929,7 @@ class Proxy(proxy.Proxy):
def events(self, **query):
"""Retrieve a generator of events.
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
restrict the events to be returned. Available parameters include:
* obj_name: name string of the object associated with an event.

View File

@ -112,7 +112,7 @@ class Proxy(proxy.Proxy):
:class:`~openstack.compute.v2.flavor.FlavorDetail` objects,
otherwise :class:`~openstack.compute.v2.flavor.Flavor`.
*Default: ``True``*
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the flavors being returned.
:returns: A generator of flavor objects
@ -168,7 +168,7 @@ class Proxy(proxy.Proxy):
:class:`~openstack.compute.v2.image.ImageDetail` objects,
otherwise :class:`~openstack.compute.v2.image.Image`.
*Default: ``True``*
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of image objects
@ -379,7 +379,7 @@ class Proxy(proxy.Proxy):
will be returned. The default, ``True``, will cause
:class:`~openstack.compute.v2.server.ServerDetail`
instances to be returned.
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the servers being returned. Available parameters include:
* changes_since: A time/date stamp for when the server last changed
@ -1077,7 +1077,7 @@ class Proxy(proxy.Proxy):
def server_groups(self, **query):
"""Return a generator of server groups
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of ServerGroup objects

View File

@ -919,9 +919,9 @@ class OpenStackConfig(object):
def option_prompt(self, config, p_opt):
"""Prompt user for option that requires a value"""
if (
getattr(p_opt, 'prompt', None) is not None and
p_opt.dest not in config['auth'] and
self._pw_callback is not None
getattr(p_opt, 'prompt', None) is not None
and p_opt.dest not in config['auth']
and self._pw_callback is not None
):
config['auth'][p_opt.dest] = self._pw_callback(p_opt.prompt)
return config
@ -948,9 +948,9 @@ class OpenStackConfig(object):
"""Perform the set of magic argument fixups"""
# Infer token plugin if a token was given
if (('auth' in config and 'token' in config['auth']) or
('auth_token' in config and config['auth_token']) or
('token' in config and config['token'])):
if (('auth' in config and 'token' in config['auth'])
or ('auth_token' in config and config['auth_token'])
or ('token' in config and config['token'])):
config.setdefault('token', config.pop('auth_token', None))
# These backwards compat values are only set via argparse. If it's

View File

@ -81,7 +81,7 @@ class Proxy(proxy.Proxy):
:param instance: This can be either the ID of an instance
or a :class:`~openstack.database.v1.instance.Instance`
instance that the interface belongs to.
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of database objects
@ -137,7 +137,7 @@ class Proxy(proxy.Proxy):
def flavors(self, **query):
"""Return a generator of flavors
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of flavor objects
@ -203,7 +203,7 @@ class Proxy(proxy.Proxy):
def instances(self, **query):
"""Return a generator of instances
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of instance objects
@ -283,7 +283,7 @@ class Proxy(proxy.Proxy):
:param instance: This can be either the ID of an instance
or a :class:`~openstack.database.v1.instance.Instance`
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of user objects

View File

@ -29,6 +29,8 @@ class SDKException(Exception):
self.message = self.__class__.__name__ if message is None else message
self.extra_data = extra_data
super(SDKException, self).__init__(self.message)
OpenStackCloudException = SDKException

View File

@ -96,7 +96,7 @@ class Proxy(proxy.Proxy):
def roles(self, **query):
"""Retrieve a generator of roles
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of role instances.
@ -173,7 +173,7 @@ class Proxy(proxy.Proxy):
def tenants(self, **query):
"""Retrieve a generator of tenants
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of tenant instances.
@ -250,7 +250,7 @@ class Proxy(proxy.Proxy):
def users(self, **query):
"""Retrieve a generator of users
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of user instances.

View File

@ -96,7 +96,7 @@ class Proxy(proxy.Proxy):
def credentials(self, **query):
"""Retrieve a generator of credentials
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of credentials instances.
@ -174,7 +174,7 @@ class Proxy(proxy.Proxy):
def domains(self, **query):
"""Retrieve a generator of domains
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of domain instances.
@ -254,7 +254,7 @@ class Proxy(proxy.Proxy):
def endpoints(self, **query):
"""Retrieve a generator of endpoints
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of endpoint instances.
@ -334,7 +334,7 @@ class Proxy(proxy.Proxy):
def groups(self, **query):
"""Retrieve a generator of groups
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of group instances.
@ -412,7 +412,7 @@ class Proxy(proxy.Proxy):
def policies(self, **query):
"""Retrieve a generator of policies
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of policy instances.
@ -490,7 +490,7 @@ class Proxy(proxy.Proxy):
def projects(self, **query):
"""Retrieve a generator of projects
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of project instances.
@ -505,7 +505,7 @@ class Proxy(proxy.Proxy):
:param user: Either the user id or an instance of
:class:`~openstack.identity.v3.user.User`
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of project instances.
@ -584,7 +584,7 @@ class Proxy(proxy.Proxy):
def services(self, **query):
"""Retrieve a generator of services
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of service instances.
@ -662,7 +662,7 @@ class Proxy(proxy.Proxy):
def users(self, **query):
"""Retrieve a generator of users
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of user instances.
@ -740,7 +740,7 @@ class Proxy(proxy.Proxy):
def trusts(self, **query):
"""Retrieve a generator of trusts
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of trust instances.
@ -805,7 +805,7 @@ class Proxy(proxy.Proxy):
def regions(self, **query):
"""Retrieve a generator of regions
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the regions being returned.
:returns: A generator of region instances.
@ -883,7 +883,7 @@ class Proxy(proxy.Proxy):
def roles(self, **query):
"""Retrieve a generator of roles
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned. The options
are: domain_id, name.
:return: A generator of role instances.
@ -964,7 +964,7 @@ class Proxy(proxy.Proxy):
def role_assignments(self, **query):
"""Retrieve a generator of role assignments
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned. The options
are: group_id, role_id, scope_domain_id,
scope_project_id, user_id, include_names,
@ -978,7 +978,7 @@ class Proxy(proxy.Proxy):
def registered_limits(self, **query):
"""Retrieve a generator of registered_limits
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the registered_limits being returned.
:returns: A generator of registered_limits instances.
@ -1052,7 +1052,7 @@ class Proxy(proxy.Proxy):
def limits(self, **query):
"""Retrieve a generator of limits
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the limits being returned.
:returns: A generator of limits instances.

View File

@ -72,8 +72,8 @@ class Proxy(proxy.Proxy):
def images(self, **query):
"""Return a generator of images
:param kwargs \*\*query: Optional query parameters to be sent to limit
the resources being returned.
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of image objects
:rtype: :class:`~openstack.image.v1.image.Image`

View File

@ -138,7 +138,7 @@ class Proxy(proxy.Proxy):
def images(self, **query):
"""Return a generator of images
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of image objects

View File

@ -29,7 +29,7 @@ class Proxy(proxy.Proxy):
def notifications(self, **query):
"""Return a generator of notifications.
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
limit the notifications being returned.
:returns: A generator of notifications
"""
@ -67,7 +67,7 @@ class Proxy(proxy.Proxy):
def segments(self, **query):
"""Return a generator of segments.
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
limit the segments being returned.
:returns: A generator of segments
"""
@ -132,7 +132,7 @@ class Proxy(proxy.Proxy):
"""Return a generator of hosts.
:param segment_id: The ID of a failover segment.
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
limit the hosts being returned.
:returns: A generator of hosts

View File

@ -78,7 +78,7 @@ class Proxy(proxy.Proxy):
def containers(self, **query):
"""Return a generator of containers
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of container objects
@ -158,7 +158,7 @@ class Proxy(proxy.Proxy):
def orders(self, **query):
"""Return a generator of orders
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of order objects
@ -239,7 +239,7 @@ class Proxy(proxy.Proxy):
def secrets(self, **query):
"""Return a generator of secrets
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of secret objects

View File

@ -47,7 +47,7 @@ class Proxy(proxy.Proxy):
def queues(self, **query):
"""Retrieve a generator of queues
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
restrict the queues to be returned. Available parameters include:
* limit: Requests at most the specified number of items be
@ -93,7 +93,7 @@ class Proxy(proxy.Proxy):
"""Retrieve a generator of messages
:param queue_name: The name of target queue to query messages from.
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
restrict the messages to be returned. Available parameters include:
* limit: Requests at most the specified number of items be
@ -170,7 +170,7 @@ class Proxy(proxy.Proxy):
"""Retrieve a generator of subscriptions
:param queue_name: The name of target queue to subscribe on.
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
restrict the subscriptions to be returned. Available parameters
include:

View File

@ -214,7 +214,7 @@ class Proxy(proxy.Proxy):
:param agent: Either the agent id of an instance of
:class:`~openstack.network.v2.network_agent.Agent`
:param query: kwargs \*\*query: Optional query parameters to be sent
:param query: kwargs query: Optional query parameters to be sent
to limit the resources being returned.
:return: A generator of networks
"""
@ -1136,7 +1136,7 @@ class Proxy(proxy.Proxy):
def networks(self, **query):
"""Return a generator of networks
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned. Available parameters include:
* ``description``: The network description.
@ -1210,7 +1210,7 @@ class Proxy(proxy.Proxy):
def network_ip_availabilities(self, **query):
"""Return a generator of network ip availabilities
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned. Available parameters include:
* ``ip_version``: IP version of the network
@ -1504,7 +1504,7 @@ class Proxy(proxy.Proxy):
def ports(self, **query):
"""Return a generator of ports
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned. Available parameters include:
* ``description``: The port description.
@ -1647,7 +1647,7 @@ class Proxy(proxy.Proxy):
:param qos_policy: The value can be the ID of the QoS policy that the
rule belongs or a :class:`~openstack.network.v2.
qos_policy.QoSPolicy` instance.
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of bandwidth limit rule objects
:rtype: :class:`~openstack.network.v2.qos_bandwidth_limit_rule.
@ -1770,7 +1770,7 @@ class Proxy(proxy.Proxy):
:param qos_policy: The value can be the ID of the QoS policy that the
rule belongs or a :class:`~openstack.network.v2.
qos_policy.QoSPolicy` instance.
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of QoS DSCP marking rule objects
:rtype: :class:`~openstack.network.v2.qos_dscp_marking_rule.
@ -1893,7 +1893,7 @@ class Proxy(proxy.Proxy):
:param qos_policy: The value can be the ID of the QoS policy that the
rule belongs or a :class:`~openstack.network.v2.
qos_policy.QoSPolicy` instance.
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of minimum bandwidth rule objects
:rtype: :class:`~openstack.network.v2.qos_minimum_bandwidth_rule.
@ -2385,7 +2385,7 @@ class Proxy(proxy.Proxy):
:param router: Either the router id or an instance of
:class:`~openstack.network.v2.router.Router`
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources returned
:returns: A generator of Router L3 Agents
@ -2400,7 +2400,7 @@ class Proxy(proxy.Proxy):
:param agent: Either the agent id of an instance of
:class:`~openstack.network.v2.network_agent.Agent`
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources returned
:returns: A generator of routers
@ -2939,7 +2939,7 @@ class Proxy(proxy.Proxy):
def security_group_rules(self, **query):
"""Return a generator of security group rules
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned. Available parameters include:
* ``description``: The security group rule description
@ -3019,7 +3019,7 @@ class Proxy(proxy.Proxy):
def segments(self, **query):
"""Return a generator of segments
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned. Available parameters include:
* ``description``: The segment description
@ -3051,7 +3051,7 @@ class Proxy(proxy.Proxy):
def service_providers(self, **query):
"""Return a generator of service providers
:param kwargs \*\* query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of service provider objects
@ -3308,7 +3308,7 @@ class Proxy(proxy.Proxy):
def subnet_pools(self, **query):
"""Return a generator of subnet pools
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned. Available parameters include:
* ``address_scope_id``: Subnet pool address scope ID

View File

@ -150,7 +150,7 @@ class Proxy(proxy.Proxy):
that you want to retrieve objects from.
:type container:
:class:`~openstack.object_store.v1.container.Container`
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:rtype: A generator of

View File

@ -59,7 +59,7 @@ class Proxy(proxy.Proxy):
def stacks(self, **query):
"""Return a generator of stacks
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of stack objects
@ -84,7 +84,7 @@ class Proxy(proxy.Proxy):
:param stack: The value can be the ID of a stack or a
:class:`~openstack.orchestration.v1.stack.Stack` instance.
:param kwargs \*\*attrs: The attributes to update on the stack
:param kwargs attrs: The attributes to update on the stack
represented by ``value``.
:returns: The updated stack
@ -191,7 +191,7 @@ class Proxy(proxy.Proxy):
:param stack: This can be a stack object, or the name of a stack
for which the resources are to be listed.
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of resource objects if the stack exists and

View File

@ -90,7 +90,7 @@ class Task(object):
# Retry one time if we get a retriable connection failure
try:
self.done(self.main())
except keystoneauth1.exceptions.RetriableConnectionFailure as e:
except keystoneauth1.exceptions.RetriableConnectionFailure:
self.done(self.main())
except Exception as e:
self.exception(e, sys.exc_info()[2])

View File

@ -64,6 +64,8 @@ def make_fake_flavor(flavor_id, name, ram=100, disk=1600, vcpus=24):
u'swap': u'',
u'vcpus': vcpus
}
FAKE_FLAVOR = make_fake_flavor(FLAVOR_ID, 'vanilla')
FAKE_CHOCOLATE_FLAVOR = make_fake_flavor(
CHOCOLATE_FLAVOR_ID, 'chocolate', ram=200)

View File

@ -38,6 +38,7 @@ def _disable_keep_alive(conn):
sess = conn.config.get_session()
sess.keep_alive = False
IMAGE_NAME = _get_resource_value('image_name', 'cirros-0.3.5-x86_64-disk')
FLAVOR_NAME = _get_resource_value('flavor_name', 'm1.small')
@ -129,10 +130,12 @@ class BaseFunctionalTest(base.TestCase):
if not min_microversion:
return
if not (data.min_microversion and data.max_microversion and
discover.version_between(data.min_microversion,
data.max_microversion,
min_microversion)):
if not (data.min_microversion
and data.max_microversion
and discover.version_between(
data.min_microversion,
data.max_microversion,
min_microversion)):
self.skipTest('Service {service_type} does not provide '
'microversion {ver}'.format(
service_type=service_type,

View File

@ -79,6 +79,7 @@ class FakeCloud(object):
def get_default_network(self):
return None
standard_fake_server = fakes.make_fake_server(
server_id='test-id-0',
name='test-id-0',

View File

@ -22,8 +22,8 @@ from openstack import exceptions
class Test_Exception(base.TestCase):
def test_method_not_supported(self):
exc = exceptions.MethodNotSupported(self.__class__, 'list')
expected = ('The list method is not supported for ' +
'openstack.tests.unit.test_exceptions.Test_Exception')
expected = ('The list method is not supported for '
+ 'openstack.tests.unit.test_exceptions.Test_Exception')
self.assertEqual(expected, str(exc))

View File

@ -44,7 +44,7 @@ class Proxy(proxy.Proxy):
def workflows(self, **query):
"""Retrieve a generator of workflows
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
restrict the workflows to be returned. Available parameters
include:
@ -120,7 +120,7 @@ class Proxy(proxy.Proxy):
def executions(self, **query):
"""Retrieve a generator of executions
:param kwargs \*\*query: Optional query parameters to be sent to
:param kwargs query: Optional query parameters to be sent to
restrict the executions to be returned. Available parameters
include:

View File

@ -40,6 +40,7 @@ skip_install = True
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
doc8
flake8
hacking
pygments
readme