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
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): def _get_resource_value(resource_key, default):
return config.get_extra_config('example').get(resource_key, default) return config.get_extra_config('example').get(resource_key, default)
SERVER_NAME = 'openstacksdk-example' SERVER_NAME = 'openstacksdk-example'
IMAGE_NAME = _get_resource_value('image_name', 'cirros-0.3.5-x86_64-disk') IMAGE_NAME = _get_resource_value('image_name', 'cirros-0.3.5-x86_64-disk')
FLAVOR_NAME = _get_resource_value('flavor_name', 'm1.small') FLAVOR_NAME = _get_resource_value('flavor_name', 'm1.small')

View File

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

View File

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

View File

@@ -41,7 +41,7 @@ class Proxy(proxy.Proxy):
objects will be returned. The default, ``True``, will cause objects will be returned. The default, ``True``, will cause
:class:`~openstack.block_storage.v2.snapshot.SnapshotDetail` :class:`~openstack.block_storage.v2.snapshot.SnapshotDetail`
objects to be returned. 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: the snapshots being returned. Available parameters include:
* name: Name of the snapshot as a string. * name: Name of the snapshot as a string.
@@ -150,7 +150,7 @@ class Proxy(proxy.Proxy):
will be returned. The default, ``True``, will cause will be returned. The default, ``True``, will cause
:class:`~openstack.block_storage.v2.volume.VolumeDetail` :class:`~openstack.block_storage.v2.volume.VolumeDetail`
objects to be returned. 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: the volumes being returned. Available parameters include:
* name: Name of the volume as a string. * 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 # Override the default string handling function
# to always return unicode objects # to always return unicode objects
return self.construct_scalar(node) return self.construct_scalar(node)
HeatYamlLoader.add_constructor(u'tag:yaml.org,2002:str', _construct_yaml_str) 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 # 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 # 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 return True
if not isinstance(value, six.string_types): if not isinstance(value, six.string_types):
return True return True
if (key == 'type' and if (key == 'type'
not value.endswith(('.yaml', '.template'))): and not value.endswith(('.yaml', '.template'))):
return True return True
return False 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_id = _make_unicode(e.get('id', None))
e_name = _make_unicode(e.get('name', None)) e_name = _make_unicode(e.get('name', None))
if ((e_id and e_id == name_or_id) or if ((e_id and e_id == name_or_id)
(e_name and e_name == name_or_id)): or (e_name and e_name == name_or_id)):
identifier_matches.append(e) identifier_matches.append(e)
else: else:
# Only try fnmatch if we don't match exactly # 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 # so that we log the bad pattern
bad_pattern = True bad_pattern = True
continue continue
if ((e_id and fn_reg.match(e_id)) or if ((e_id and fn_reg.match(e_id))
(e_name and fn_reg.match(e_name))): or (e_name and fn_reg.match(e_name))):
identifier_matches.append(e) identifier_matches.append(e)
if not identifier_matches and bad_pattern: if not identifier_matches and bad_pattern:
log.debug("Bad pattern passed to fnmatch", exc_info=True) 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 # an additional call, it's simple enough to test to see if we got an
# object and just short-circuit return it. # object and just short-circuit return it.
if (hasattr(name_or_id, 'id') or if (hasattr(name_or_id, 'id')
(isinstance(name_or_id, dict) and 'id' in name_or_id)): or (isinstance(name_or_id, dict) and 'id' in name_or_id)):
return name_or_id return name_or_id
# If a uuid is passed short-circuit it calling the # 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: try:
ret_val = client(url, **kwargs) ret_val = client(url, **kwargs)
except exc.OpenStackCloudHTTPError as e: except exc.OpenStackCloudHTTPError as e:
if (retry_on is not None and if (retry_on is not None
e.response.status_code in retry_on): and e.response.status_code in retry_on):
log.debug('Received retryable error {err}, waiting ' log.debug('Received retryable error {err}, waiting '
'{wait} seconds to retry', { '{wait} seconds to retry', {
'err': e.response.status_code, 'err': e.response.status_code,
@@ -570,7 +570,7 @@ def parse_range(value):
if value is None: if value is None:
return 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: if range_exp is None:
return None return None

View File

@@ -404,8 +404,9 @@ def _get_supplemental_addresses(cloud, server):
try: try:
# Don't bother doing this before the server is active, it's a waste # 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 # of an API call while polling for a server to come up
if (cloud.has_service('network') and cloud._has_floating_ips() and if (cloud.has_service('network')
server['status'] == 'ACTIVE'): and cloud._has_floating_ips()
and server['status'] == 'ACTIVE'):
for port in cloud.search_ports( for port in cloud.search_ports(
filters=dict(device_id=server['id'])): filters=dict(device_id=server['id'])):
# This SHOULD return one and only one FIP - but doing it as a # 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) flavors = self.list_flavors(get_extra=get_extra)
for flavor in sorted(flavors, key=operator.itemgetter('ram')): for flavor in sorted(flavors, key=operator.itemgetter('ram')):
if (flavor['ram'] >= ram and if (flavor['ram'] >= ram
(not include or include in flavor['name'])): and (not include or include in flavor['name'])):
return flavor return flavor
raise exc.OpenStackCloudException( raise exc.OpenStackCloudException(
"Could not find a flavor with {ram} and '{include}'".format( "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): or network['id'] in self._external_ipv4_names):
external_ipv4_networks.append(network) external_ipv4_networks.append(network)
elif ((('router:external' in network elif ((('router:external' in network
and network['router:external']) or and network['router:external'])
network.get('provider:physical_network')) and or network.get('provider:physical_network'))
network['name'] not in self._internal_ipv4_names and and network['name'] not in self._internal_ipv4_names
network['id'] not in self._internal_ipv4_names): and network['id'] not in self._internal_ipv4_names):
external_ipv4_networks.append(network) external_ipv4_networks.append(network)
# Internal networks # Internal networks
if (network['name'] in self._internal_ipv4_names if (network['name'] in self._internal_ipv4_names
or network['id'] in self._internal_ipv4_names): or network['id'] in self._internal_ipv4_names):
internal_ipv4_networks.append(network) internal_ipv4_networks.append(network)
elif (not network.get('router:external', False) and elif (not network.get('router:external', False)
not network.get('provider:physical_network') and and not network.get('provider:physical_network')
network['name'] not in self._external_ipv4_names and and network['name'] not in self._external_ipv4_names
network['id'] not in self._external_ipv4_names): and network['id'] not in self._external_ipv4_names):
internal_ipv4_networks.append(network) internal_ipv4_networks.append(network)
# External networks # External networks
if (network['name'] in self._external_ipv6_names if (network['name'] in self._external_ipv6_names
or network['id'] in self._external_ipv6_names): or network['id'] in self._external_ipv6_names):
external_ipv6_networks.append(network) external_ipv6_networks.append(network)
elif (network.get('router:external') and elif (network.get('router:external')
network['name'] not in self._internal_ipv6_names and and network['name'] not in self._internal_ipv6_names
network['id'] not in self._internal_ipv6_names): and network['id'] not in self._internal_ipv6_names):
external_ipv6_networks.append(network) external_ipv6_networks.append(network)
# Internal networks # Internal networks
if (network['name'] in self._internal_ipv6_names if (network['name'] in self._internal_ipv6_names
or network['id'] in self._internal_ipv6_names): or network['id'] in self._internal_ipv6_names):
internal_ipv6_networks.append(network) internal_ipv6_networks.append(network)
elif (not network.get('router:external', False) and elif (not network.get('router:external', False)
network['name'] not in self._external_ipv6_names and and network['name'] not in self._external_ipv6_names
network['id'] not in self._external_ipv6_names): and network['id'] not in self._external_ipv6_names):
internal_ipv6_networks.append(network) internal_ipv6_networks.append(network)
# External Floating IPv4 networks # External Floating IPv4 networks
@@ -2612,8 +2612,8 @@ class _OpenStackCloudMixin(_normalize.Normalizer):
""" """
self._find_interesting_networks() self._find_interesting_networks()
return list( return list(
set(self._external_ipv4_networks) | set(self._external_ipv4_networks)
set(self._external_ipv6_networks)) | set(self._external_ipv6_networks))
def get_internal_networks(self): def get_internal_networks(self):
"""Return the networks that are configured to not route northbound. """Return the networks that are configured to not route northbound.
@@ -2625,8 +2625,8 @@ class _OpenStackCloudMixin(_normalize.Normalizer):
""" """
self._find_interesting_networks() self._find_interesting_networks()
return list( return list(
set(self._internal_ipv4_networks) | set(self._internal_ipv4_networks)
set(self._internal_ipv6_networks)) | set(self._internal_ipv6_networks))
def get_external_ipv4_networks(self): def get_external_ipv4_networks(self):
"""Return the networks that are configured to route northbound. """Return the networks that are configured to route northbound.
@@ -9744,8 +9744,8 @@ class _OpenStackCloudMixin(_normalize.Normalizer):
"Timeout waiting for reservation to clear " "Timeout waiting for reservation to clear "
"before setting provide state"): "before setting provide state"):
machine = self.get_machine(machine['uuid']) machine = self.get_machine(machine['uuid'])
if (machine['reservation'] is None and if (machine['reservation'] is None
machine['provision_state'] is not 'enroll'): and machine['provision_state'] != 'enroll'):
# NOTE(TheJulia): In this case, the node has # NOTE(TheJulia): In this case, the node has
# has moved on from the previous state and is # has moved on from the previous state and is
# likely not being verified, as no lock is # likely not being verified, as no lock is

View File

@@ -134,7 +134,7 @@ class Proxy(proxy.Proxy):
def profiles(self, **query): def profiles(self, **query):
"""Retrieve a generator of profiles. """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: restrict the profiles to be returned. Available parameters include:
* name: The name of a profile. * name: The name of a profile.
@@ -247,7 +247,7 @@ class Proxy(proxy.Proxy):
def clusters(self, **query): def clusters(self, **query):
"""Retrieve a generator of clusters. """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: restrict the clusters to be returned. Available parameters include:
* name: The name of a cluster. * 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 :param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`. instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param nodes: List of nodes to be removed from the 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: restrict the nodes to be returned. Available parameters include:
* destroy_after_deletion: A boolean value indicating whether the * 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 :param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`. 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. resize action.
:returns: A dict containing the action initiated by this operation. :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 :param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`. instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param policy: Either the name or the ID of a policy. :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. policy to be attached.
:returns: A dict containing the action initiated by this operation. :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 :param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`. instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param policy: Either the name or the ID of a policy. :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. the policy.
:returns: A dict containing the action initiated by this operation. :returns: A dict containing the action initiated by this operation.
""" """
@@ -544,7 +544,7 @@ class Proxy(proxy.Proxy):
def nodes(self, **query): def nodes(self, **query):
"""Retrieve a generator of nodes. """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: restrict the nodes to be returned. Available parameters include:
* cluster_id: A string including the name or ID of a cluster to * 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): def policies(self, **query):
"""Retrieve a generator of policies. """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: restrict the policies to be returned. Available parameters include:
* name: The name of a policy. * 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 :param cluster: The value can be the name or ID of a cluster or a
:class:`~openstack.clustering.v1.cluster.Cluster` instance. :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: restrict the policies to be returned. Available parameters include:
* enabled: A boolean value indicating whether the policy is * enabled: A boolean value indicating whether the policy is
@@ -858,7 +858,7 @@ class Proxy(proxy.Proxy):
def receivers(self, **query): def receivers(self, **query):
"""Retrieve a generator of receivers. """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: receivers to be returned. Available parameters include:
* name: The name of a receiver object. * name: The name of a receiver object.
@@ -891,7 +891,7 @@ class Proxy(proxy.Proxy):
def actions(self, **query): def actions(self, **query):
"""Retrieve a generator of actions. """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: restrict the actions to be returned. Available parameters include:
* name: name of action for query. * name: name of action for query.
@@ -929,7 +929,7 @@ class Proxy(proxy.Proxy):
def events(self, **query): def events(self, **query):
"""Retrieve a generator of events. """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: restrict the events to be returned. Available parameters include:
* obj_name: name string of the object associated with an event. * 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, :class:`~openstack.compute.v2.flavor.FlavorDetail` objects,
otherwise :class:`~openstack.compute.v2.flavor.Flavor`. otherwise :class:`~openstack.compute.v2.flavor.Flavor`.
*Default: ``True``* *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. the flavors being returned.
:returns: A generator of flavor objects :returns: A generator of flavor objects
@@ -168,7 +168,7 @@ class Proxy(proxy.Proxy):
:class:`~openstack.compute.v2.image.ImageDetail` objects, :class:`~openstack.compute.v2.image.ImageDetail` objects,
otherwise :class:`~openstack.compute.v2.image.Image`. otherwise :class:`~openstack.compute.v2.image.Image`.
*Default: ``True``* *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. the resources being returned.
:returns: A generator of image objects :returns: A generator of image objects
@@ -379,7 +379,7 @@ class Proxy(proxy.Proxy):
will be returned. The default, ``True``, will cause will be returned. The default, ``True``, will cause
:class:`~openstack.compute.v2.server.ServerDetail` :class:`~openstack.compute.v2.server.ServerDetail`
instances to be returned. 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: the servers being returned. Available parameters include:
* changes_since: A time/date stamp for when the server last changed * 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): def server_groups(self, **query):
"""Return a generator of server groups """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. the resources being returned.
:returns: A generator of ServerGroup objects :returns: A generator of ServerGroup objects

View File

@@ -919,9 +919,9 @@ class OpenStackConfig(object):
def option_prompt(self, config, p_opt): def option_prompt(self, config, p_opt):
"""Prompt user for option that requires a value""" """Prompt user for option that requires a value"""
if ( if (
getattr(p_opt, 'prompt', None) is not None and getattr(p_opt, 'prompt', None) is not None
p_opt.dest not in config['auth'] and and p_opt.dest not in config['auth']
self._pw_callback is not None and self._pw_callback is not None
): ):
config['auth'][p_opt.dest] = self._pw_callback(p_opt.prompt) config['auth'][p_opt.dest] = self._pw_callback(p_opt.prompt)
return config return config
@@ -948,9 +948,9 @@ class OpenStackConfig(object):
"""Perform the set of magic argument fixups""" """Perform the set of magic argument fixups"""
# Infer token plugin if a token was given # Infer token plugin if a token was given
if (('auth' in config and 'token' in config['auth']) or if (('auth' in config and 'token' in config['auth'])
('auth_token' in config and config['auth_token']) or or ('auth_token' in config and config['auth_token'])
('token' in config and config['token'])): or ('token' in config and config['token'])):
config.setdefault('token', config.pop('auth_token', None)) config.setdefault('token', config.pop('auth_token', None))
# These backwards compat values are only set via argparse. If it's # 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 :param instance: This can be either the ID of an instance
or a :class:`~openstack.database.v1.instance.Instance` or a :class:`~openstack.database.v1.instance.Instance`
instance that the interface belongs to. 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. the resources being returned.
:returns: A generator of database objects :returns: A generator of database objects
@@ -137,7 +137,7 @@ class Proxy(proxy.Proxy):
def flavors(self, **query): def flavors(self, **query):
"""Return a generator of flavors """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. the resources being returned.
:returns: A generator of flavor objects :returns: A generator of flavor objects
@@ -203,7 +203,7 @@ class Proxy(proxy.Proxy):
def instances(self, **query): def instances(self, **query):
"""Return a generator of instances """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. the resources being returned.
:returns: A generator of instance objects :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 :param instance: This can be either the ID of an instance
or a :class:`~openstack.database.v1.instance.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. the resources being returned.
:returns: A generator of user objects :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.message = self.__class__.__name__ if message is None else message
self.extra_data = extra_data self.extra_data = extra_data
super(SDKException, self).__init__(self.message) super(SDKException, self).__init__(self.message)
OpenStackCloudException = SDKException OpenStackCloudException = SDKException

View File

@@ -96,7 +96,7 @@ class Proxy(proxy.Proxy):
def roles(self, **query): def roles(self, **query):
"""Retrieve a generator of roles """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 resources being returned.
:returns: A generator of role instances. :returns: A generator of role instances.
@@ -173,7 +173,7 @@ class Proxy(proxy.Proxy):
def tenants(self, **query): def tenants(self, **query):
"""Retrieve a generator of tenants """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. the resources being returned.
:returns: A generator of tenant instances. :returns: A generator of tenant instances.
@@ -250,7 +250,7 @@ class Proxy(proxy.Proxy):
def users(self, **query): def users(self, **query):
"""Retrieve a generator of users """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. the resources being returned.
:returns: A generator of user instances. :returns: A generator of user instances.

View File

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

View File

@@ -72,8 +72,8 @@ class Proxy(proxy.Proxy):
def images(self, **query): def images(self, **query):
"""Return a generator of images """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. the resources being returned.
:returns: A generator of image objects :returns: A generator of image objects
:rtype: :class:`~openstack.image.v1.image.Image` :rtype: :class:`~openstack.image.v1.image.Image`

View File

@@ -138,7 +138,7 @@ class Proxy(proxy.Proxy):
def images(self, **query): def images(self, **query):
"""Return a generator of images """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. the resources being returned.
:returns: A generator of image objects :returns: A generator of image objects

View File

@@ -29,7 +29,7 @@ class Proxy(proxy.Proxy):
def notifications(self, **query): def notifications(self, **query):
"""Return a generator of notifications. """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. limit the notifications being returned.
:returns: A generator of notifications :returns: A generator of notifications
""" """
@@ -67,7 +67,7 @@ class Proxy(proxy.Proxy):
def segments(self, **query): def segments(self, **query):
"""Return a generator of segments. """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. limit the segments being returned.
:returns: A generator of segments :returns: A generator of segments
""" """
@@ -132,7 +132,7 @@ class Proxy(proxy.Proxy):
"""Return a generator of hosts. """Return a generator of hosts.
:param segment_id: The ID of a failover segment. :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. limit the hosts being returned.
:returns: A generator of hosts :returns: A generator of hosts

View File

@@ -78,7 +78,7 @@ class Proxy(proxy.Proxy):
def containers(self, **query): def containers(self, **query):
"""Return a generator of containers """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. the resources being returned.
:returns: A generator of container objects :returns: A generator of container objects
@@ -158,7 +158,7 @@ class Proxy(proxy.Proxy):
def orders(self, **query): def orders(self, **query):
"""Return a generator of orders """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. the resources being returned.
:returns: A generator of order objects :returns: A generator of order objects
@@ -239,7 +239,7 @@ class Proxy(proxy.Proxy):
def secrets(self, **query): def secrets(self, **query):
"""Return a generator of secrets """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. the resources being returned.
:returns: A generator of secret objects :returns: A generator of secret objects

View File

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

View File

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

View File

@@ -59,7 +59,7 @@ class Proxy(proxy.Proxy):
def stacks(self, **query): def stacks(self, **query):
"""Return a generator of stacks """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. the resources being returned.
:returns: A generator of stack objects :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 :param stack: The value can be the ID of a stack or a
:class:`~openstack.orchestration.v1.stack.Stack` instance. :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``. represented by ``value``.
:returns: The updated stack :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 :param stack: This can be a stack object, or the name of a stack
for which the resources are to be listed. 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. the resources being returned.
:returns: A generator of resource objects if the stack exists and :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 # Retry one time if we get a retriable connection failure
try: try:
self.done(self.main()) self.done(self.main())
except keystoneauth1.exceptions.RetriableConnectionFailure as e: except keystoneauth1.exceptions.RetriableConnectionFailure:
self.done(self.main()) self.done(self.main())
except Exception as e: except Exception as e:
self.exception(e, sys.exc_info()[2]) 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'swap': u'',
u'vcpus': vcpus u'vcpus': vcpus
} }
FAKE_FLAVOR = make_fake_flavor(FLAVOR_ID, 'vanilla') FAKE_FLAVOR = make_fake_flavor(FLAVOR_ID, 'vanilla')
FAKE_CHOCOLATE_FLAVOR = make_fake_flavor( FAKE_CHOCOLATE_FLAVOR = make_fake_flavor(
CHOCOLATE_FLAVOR_ID, 'chocolate', ram=200) CHOCOLATE_FLAVOR_ID, 'chocolate', ram=200)

View File

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

View File

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

View File

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

View File

@@ -44,7 +44,7 @@ class Proxy(proxy.Proxy):
def workflows(self, **query): def workflows(self, **query):
"""Retrieve a generator of workflows """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 restrict the workflows to be returned. Available parameters
include: include:
@@ -120,7 +120,7 @@ class Proxy(proxy.Proxy):
def executions(self, **query): def executions(self, **query):
"""Retrieve a generator of executions """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 restrict the executions to be returned. Available parameters
include: include:

View File

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