diff options
| author | Stephen Finucane <sfinucan@redhat.com> | 2019-06-14 11:51:52 +0100 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2019-08-27 17:12:15 -0500 |
| commit | 6419533f436c6c369e05662c6ced26ad0bc68240 (patch) | |
| tree | 52c06195e2a9456b3d10d1ddbee451a7d0113298 /openstackclient | |
| parent | b9d63105566c84db11a976846844ad7b3a0b331e (diff) | |
| download | python-openstackclient-6419533f436c6c369e05662c6ced26ad0bc68240.tar.gz | |
Bump hacking version
Pick up newer versions of this library. Thankfully no serious changes
are needed.
Change-Id: I69e523844529fc1c8aa0c1ce764182dbe29cfeb6
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/common/configuration.py | 2 | ||||
| -rw-r--r-- | openstackclient/compute/v2/hypervisor.py | 2 | ||||
| -rw-r--r-- | openstackclient/compute/v2/server.py | 58 | ||||
| -rw-r--r-- | openstackclient/network/v2/network_segment_range.py | 2 | ||||
| -rw-r--r-- | openstackclient/shell.py | 1 | ||||
| -rw-r--r-- | openstackclient/tests/unit/compute/v2/fakes.py | 2 | ||||
| -rw-r--r-- | openstackclient/tests/unit/network/v2/fakes.py | 2 |
7 files changed, 35 insertions, 34 deletions
diff --git a/openstackclient/common/configuration.py b/openstackclient/common/configuration.py index 57825bb0..ce646b1e 100644 --- a/openstackclient/common/configuration.py +++ b/openstackclient/common/configuration.py @@ -52,6 +52,6 @@ class ShowConfiguration(command.ShowOne): info = self.app.client_manager.get_configuration() for key, value in six.iteritems(info.pop('auth', {})): if parsed_args.mask and key.lower() in secret_opts: - value = REDACTED + value = REDACTED info['auth.' + key] = value return zip(*sorted(six.iteritems(info))) diff --git a/openstackclient/compute/v2/hypervisor.py b/openstackclient/compute/v2/hypervisor.py index 406aa917..0d367fee 100644 --- a/openstackclient/compute/v2/hypervisor.py +++ b/openstackclient/compute/v2/hypervisor.py @@ -112,7 +112,7 @@ class ShowHypervisor(command.ShowOne): # example: 17:37:14 up 2:33, 3 users, # load average: 0.33, 0.36, 0.34 m = re.match( - "\s*(.+)\sup\s+(.+),\s+(.+)\susers?,\s+load average:\s(.+)", + r"\s*(.+)\sup\s+(.+),\s+(.+)\susers?,\s+load average:\s(.+)", uptime['uptime']) if m: hypervisor["host_time"] = m.group(1) diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index 95c2f28a..5922dc50 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -79,37 +79,37 @@ def _format_servers_list_power_state(state): def _get_ip_address(addresses, address_type, ip_address_family): - # Old style addresses - if address_type in addresses: - for addy in addresses[address_type]: + # Old style addresses + if address_type in addresses: + for addy in addresses[address_type]: + if int(addy['version']) in ip_address_family: + return addy['addr'] + + # New style addresses + new_address_type = address_type + if address_type == 'public': + new_address_type = 'floating' + if address_type == 'private': + new_address_type = 'fixed' + for network in addresses: + for addy in addresses[network]: + # Case where it is list of strings + if isinstance(addy, six.string_types): + if new_address_type == 'fixed': + return addresses[network][0] + else: + return addresses[network][-1] + # Case where it is a dict + if 'OS-EXT-IPS:type' not in addy: + continue + if addy['OS-EXT-IPS:type'] == new_address_type: if int(addy['version']) in ip_address_family: return addy['addr'] - - # New style addresses - new_address_type = address_type - if address_type == 'public': - new_address_type = 'floating' - if address_type == 'private': - new_address_type = 'fixed' - for network in addresses: - for addy in addresses[network]: - # Case where it is list of strings - if isinstance(addy, six.string_types): - if new_address_type == 'fixed': - return addresses[network][0] - else: - return addresses[network][-1] - # Case where it is a dict - if 'OS-EXT-IPS:type' not in addy: - continue - if addy['OS-EXT-IPS:type'] == new_address_type: - if int(addy['version']) in ip_address_family: - return addy['addr'] - msg = _("ERROR: No %(type)s IP version %(family)s address found") - raise exceptions.CommandError( - msg % {"type": address_type, - "family": ip_address_family} - ) + msg = _("ERROR: No %(type)s IP version %(family)s address found") + raise exceptions.CommandError( + msg % {"type": address_type, + "family": ip_address_family} + ) def _prefix_checked_value(prefix): diff --git a/openstackclient/network/v2/network_segment_range.py b/openstackclient/network/v2/network_segment_range.py index 567b5b6e..b938bdd9 100644 --- a/openstackclient/network/v2/network_segment_range.py +++ b/openstackclient/network/v2/network_segment_range.py @@ -358,7 +358,7 @@ class ListNetworkSegmentRange(command.Lister): parsed_args.used and _is_prop_empty(columns, props, 'used') or \ parsed_args.unused and \ not _is_prop_empty(columns, props, 'used'): - continue + continue if parsed_args.long: props = _update_additional_fields_from_props(columns, props) display_props += (props,) diff --git a/openstackclient/shell.py b/openstackclient/shell.py index 22d8412c..86aa032b 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -209,5 +209,6 @@ def main(argv=None): return OpenStackShell().run(argv) + if __name__ == "__main__": sys.exit(main()) diff --git a/openstackclient/tests/unit/compute/v2/fakes.py b/openstackclient/tests/unit/compute/v2/fakes.py index ee7d4983..7357e143 100644 --- a/openstackclient/tests/unit/compute/v2/fakes.py +++ b/openstackclient/tests/unit/compute/v2/fakes.py @@ -505,7 +505,7 @@ class FakeSecurityGroup(object): @staticmethod def get_security_groups(security_groups=None, count=2): - """Get an iterable MagicMock object with a list of faked security groups. + """Get an iterable MagicMock with a list of faked security groups. If security groups list is provided, then initialize the Mock object with the list. Otherwise create one. diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py index e41621a4..1519bd4b 100644 --- a/openstackclient/tests/unit/network/v2/fakes.py +++ b/openstackclient/tests/unit/network/v2/fakes.py @@ -1344,7 +1344,7 @@ class FakeSecurityGroupRule(object): @staticmethod def get_security_group_rules(security_group_rules=None, count=2): - """Get an iterable Mock object with a list of faked security group rules. + """Get an iterable Mock with a list of faked security group rules. If security group rules list is provided, then initialize the Mock object with the list. Otherwise create one. |
