summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/image/v1/image.py2
-rw-r--r--openstackclient/tests/common/test_parseractions.py97
-rw-r--r--openstackclient/tests/test_shell.py2
-rw-r--r--openstackclient/volume/v1/backup.py1
-rw-r--r--openstackclient/volume/v1/qos_specs.py9
-rw-r--r--openstackclient/volume/v1/snapshot.py3
-rw-r--r--openstackclient/volume/v1/volume.py4
-rw-r--r--openstackclient/volume/v1/volume_type.py4
-rw-r--r--openstackclient/volume/v2/backup.py1
-rw-r--r--openstackclient/volume/v2/qos_specs.py9
-rw-r--r--openstackclient/volume/v2/snapshot.py3
-rw-r--r--openstackclient/volume/v2/volume.py4
-rw-r--r--openstackclient/volume/v2/volume_type.py4
13 files changed, 20 insertions, 123 deletions
diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py
index 4ebc8f93..0382501e 100644
--- a/openstackclient/image/v1/image.py
+++ b/openstackclient/image/v1/image.py
@@ -679,8 +679,6 @@ class SetImage(command.Command):
kwargs['data'] != sys.stdin):
kwargs['data'].close()
- return
-
class ShowImage(show.ShowOne):
"""Display image details"""
diff --git a/openstackclient/tests/common/test_parseractions.py b/openstackclient/tests/common/test_parseractions.py
index b75c4814..0109a3f3 100644
--- a/openstackclient/tests/common/test_parseractions.py
+++ b/openstackclient/tests/common/test_parseractions.py
@@ -20,34 +20,14 @@ from openstackclient.tests import utils
class TestKeyValueAction(utils.TestCase):
- def test_good_values(self):
- parser = argparse.ArgumentParser()
-
- # Set up our typical usage
- parser.add_argument(
- '--property',
- metavar='<key=value>',
- action=parseractions.KeyValueAction,
- help='Property to store for this volume '
- '(repeat option to set multiple properties)',
- )
-
- results = parser.parse_args([
- '--property', 'red=',
- '--property', 'green=100%',
- '--property', 'blue=50%',
- ])
- actual = getattr(results, 'property', {})
- # All should pass through unmolested
- expect = {'red': '', 'green': '100%', 'blue': '50%'}
- self.assertDictEqual(expect, actual)
+ def setUp(self):
+ super(TestKeyValueAction, self).setUp()
- def test_default_values(self):
- parser = argparse.ArgumentParser()
+ self.parser = argparse.ArgumentParser()
# Set up our typical usage
- parser.add_argument(
+ self.parser.add_argument(
'--property',
metavar='<key=value>',
action=parseractions.KeyValueAction,
@@ -56,84 +36,55 @@ class TestKeyValueAction(utils.TestCase):
'(repeat option to set multiple properties)',
)
- results = parser.parse_args([
+ def test_good_values(self):
+ results = self.parser.parse_args([
'--property', 'red=',
'--property', 'green=100%',
'--property', 'blue=50%',
])
actual = getattr(results, 'property', {})
- # Verify green default is changed, format default is unchanged
+ # All should pass through unmolested
expect = {'red': '', 'green': '100%', 'blue': '50%', 'format': '#rgb'}
self.assertDictEqual(expect, actual)
def test_error_values(self):
- parser = argparse.ArgumentParser()
-
- # Set up our typical usage
- parser.add_argument(
- '--property',
- metavar='<key=value>',
- action=parseractions.KeyValueAction,
- default={'green': '20%', 'blue': '40%'},
- help='Property to store for this volume '
- '(repeat option to set multiple properties)',
- )
-
- results = parser.parse_args([
+ results = self.parser.parse_args([
'--property', 'red',
'--property', 'green=100%',
'--property', 'blue',
])
- failhere = None
actual = getattr(results, 'property', {})
- # Verify non-existent red key
- try:
- failhere = actual['red']
- except Exception as e:
- self.assertTrue(type(e) == KeyError)
- # Verify removal of blue key
- try:
- failhere = actual['blue']
- except Exception as e:
- self.assertTrue(type(e) == KeyError)
# There should be no red or blue
- expect = {'green': '100%'}
+ expect = {'green': '100%', 'format': '#rgb'}
self.assertDictEqual(expect, actual)
- self.assertEqual(None, failhere)
class TestNonNegativeAction(utils.TestCase):
- def test_negative_values(self):
- parser = argparse.ArgumentParser()
+
+ def setUp(self):
+ super(TestNonNegativeAction, self).setUp()
+
+ self.parser = argparse.ArgumentParser()
# Set up our typical usage
- parser.add_argument(
+ self.parser.add_argument(
'--foo',
metavar='<foo>',
type=int,
action=parseractions.NonNegativeAction,
)
+ def test_negative_values(self):
self.assertRaises(
argparse.ArgumentTypeError,
- parser.parse_args,
+ self.parser.parse_args,
"--foo -1".split()
)
def test_zero_values(self):
- parser = argparse.ArgumentParser()
-
- # Set up our typical usage
- parser.add_argument(
- '--foo',
- metavar='<foo>',
- type=int,
- action=parseractions.NonNegativeAction,
- )
-
- results = parser.parse_args(
+ results = self.parser.parse_args(
'--foo 0'.split()
)
@@ -141,17 +92,7 @@ class TestNonNegativeAction(utils.TestCase):
self.assertEqual(actual, 0)
def test_positive_values(self):
- parser = argparse.ArgumentParser()
-
- # Set up our typical usage
- parser.add_argument(
- '--foo',
- metavar='<foo>',
- type=int,
- action=parseractions.NonNegativeAction,
- )
-
- results = parser.parse_args(
+ results = self.parser.parse_args(
'--foo 1'.split()
)
diff --git a/openstackclient/tests/test_shell.py b/openstackclient/tests/test_shell.py
index c548d890..c4546d89 100644
--- a/openstackclient/tests/test_shell.py
+++ b/openstackclient/tests/test_shell.py
@@ -76,7 +76,7 @@ CLOUD_2 = {
'project_name': 'heart-o-gold',
'username': 'zaphod',
},
- 'region_name': 'occ-cloud',
+ 'region_name': 'occ-cloud,krikkit,occ-env',
'log_file': '/tmp/test_log_file',
'log_level': 'debug',
}
diff --git a/openstackclient/volume/v1/backup.py b/openstackclient/volume/v1/backup.py
index c668e366..4f2ff8bb 100644
--- a/openstackclient/volume/v1/backup.py
+++ b/openstackclient/volume/v1/backup.py
@@ -95,7 +95,6 @@ class DeleteBackup(command.Command):
backup_id = utils.find_resource(volume_client.backups,
backup).id
volume_client.backups.delete(backup_id)
- return
class ListBackup(lister.Lister):
diff --git a/openstackclient/volume/v1/qos_specs.py b/openstackclient/volume/v1/qos_specs.py
index d1c70113..73e70a21 100644
--- a/openstackclient/volume/v1/qos_specs.py
+++ b/openstackclient/volume/v1/qos_specs.py
@@ -55,8 +55,6 @@ class AssociateQos(command.Command):
volume_client.qos_specs.associate(qos_spec.id, volume_type.id)
- return
-
class CreateQos(show.ShowOne):
"""Create new QoS specification"""
@@ -123,7 +121,6 @@ class DeleteQos(command.Command):
for qos in parsed_args.qos_specs:
qos_spec = utils.find_resource(volume_client.qos_specs, qos)
volume_client.qos_specs.delete(qos_spec.id)
- return
class DisassociateQos(command.Command):
@@ -166,8 +163,6 @@ class DisassociateQos(command.Command):
elif parsed_args.all:
volume_client.qos_specs.disassociate_all(qos_spec.id)
- return
-
class ListQos(lister.Lister):
"""List QoS specifications"""
@@ -230,8 +225,6 @@ class SetQos(command.Command):
else:
self.app.log.error("No changes requested\n")
- return
-
class ShowQos(show.ShowOne):
"""Display QoS specification details"""
@@ -298,5 +291,3 @@ class UnsetQos(command.Command):
parsed_args.property)
else:
self.app.log.error("No changes requested\n")
-
- return
diff --git a/openstackclient/volume/v1/snapshot.py b/openstackclient/volume/v1/snapshot.py
index 93e17eb8..24379a9a 100644
--- a/openstackclient/volume/v1/snapshot.py
+++ b/openstackclient/volume/v1/snapshot.py
@@ -100,7 +100,6 @@ class DeleteSnapshot(command.Command):
snapshot_id = utils.find_resource(volume_client.volume_snapshots,
snapshot).id
volume_client.volume_snapshots.delete(snapshot_id)
- return
class ListSnapshot(lister.Lister):
@@ -226,7 +225,6 @@ class SetSnapshot(command.Command):
return
snapshot.update(**kwargs)
- return
class ShowSnapshot(show.ShowOne):
@@ -291,4 +289,3 @@ class UnsetSnapshot(command.Command):
)
else:
self.app.log.error("No changes requested\n")
- return
diff --git a/openstackclient/volume/v1/volume.py b/openstackclient/volume/v1/volume.py
index 0691d884..17b6c9c8 100644
--- a/openstackclient/volume/v1/volume.py
+++ b/openstackclient/volume/v1/volume.py
@@ -196,7 +196,6 @@ class DeleteVolume(command.Command):
volume_client.volumes.force_delete(volume_obj.id)
else:
volume_client.volumes.delete(volume_obj.id)
- return
class ListVolume(lister.Lister):
@@ -382,8 +381,6 @@ class SetVolume(command.Command):
if not kwargs and not parsed_args.property and not parsed_args.size:
self.app.log.error("No changes requested\n")
- return
-
class ShowVolume(show.ShowOne):
"""Show volume details"""
@@ -454,4 +451,3 @@ class UnsetVolume(command.Command):
)
else:
self.app.log.error("No changes requested\n")
- return
diff --git a/openstackclient/volume/v1/volume_type.py b/openstackclient/volume/v1/volume_type.py
index d7765c79..b664adfb 100644
--- a/openstackclient/volume/v1/volume_type.py
+++ b/openstackclient/volume/v1/volume_type.py
@@ -81,7 +81,6 @@ class DeleteVolumeType(command.Command):
volume_type_id = utils.find_resource(
volume_client.volume_types, parsed_args.volume_type).id
volume_client.volume_types.delete(volume_type_id)
- return
class ListVolumeType(lister.Lister):
@@ -144,8 +143,6 @@ class SetVolumeType(command.Command):
if parsed_args.property:
volume_type.set_keys(parsed_args.property)
- return
-
class UnsetVolumeType(command.Command):
"""Unset volume type properties"""
@@ -182,7 +179,6 @@ class UnsetVolumeType(command.Command):
volume_type.unset_keys(parsed_args.property)
else:
self.app.log.error("No changes requested\n")
- return
class ShowVolumeType(show.ShowOne):
diff --git a/openstackclient/volume/v2/backup.py b/openstackclient/volume/v2/backup.py
index 3525e701..bc919d0b 100644
--- a/openstackclient/volume/v2/backup.py
+++ b/openstackclient/volume/v2/backup.py
@@ -92,7 +92,6 @@ class DeleteBackup(command.Command):
backup_id = utils.find_resource(
volume_client.backups, backup).id
volume_client.backups.delete(backup_id)
- return
class ListBackup(lister.Lister):
diff --git a/openstackclient/volume/v2/qos_specs.py b/openstackclient/volume/v2/qos_specs.py
index b3a34cac..678fde4f 100644
--- a/openstackclient/volume/v2/qos_specs.py
+++ b/openstackclient/volume/v2/qos_specs.py
@@ -55,8 +55,6 @@ class AssociateQos(command.Command):
volume_client.qos_specs.associate(qos_spec.id, volume_type.id)
- return
-
class CreateQos(show.ShowOne):
"""Create new QoS specification"""
@@ -123,7 +121,6 @@ class DeleteQos(command.Command):
for qos in parsed_args.qos_specs:
qos_spec = utils.find_resource(volume_client.qos_specs, qos)
volume_client.qos_specs.delete(qos_spec.id)
- return
class DisassociateQos(command.Command):
@@ -166,8 +163,6 @@ class DisassociateQos(command.Command):
elif parsed_args.all:
volume_client.qos_specs.disassociate_all(qos_spec.id)
- return
-
class ListQos(lister.Lister):
"""List QoS specifications"""
@@ -230,8 +225,6 @@ class SetQos(command.Command):
else:
self.app.log.error("No changes requested\n")
- return
-
class ShowQos(show.ShowOne):
"""Display QoS specification details"""
@@ -298,5 +291,3 @@ class UnsetQos(command.Command):
parsed_args.property)
else:
self.app.log.error("No changes requested\n")
-
- return
diff --git a/openstackclient/volume/v2/snapshot.py b/openstackclient/volume/v2/snapshot.py
index aa7630ae..f939a553 100644
--- a/openstackclient/volume/v2/snapshot.py
+++ b/openstackclient/volume/v2/snapshot.py
@@ -97,7 +97,6 @@ class DeleteSnapshot(command.Command):
snapshot_id = utils.find_resource(
volume_client.volume_snapshots, snapshot).id
volume_client.volume_snapshots.delete(snapshot_id)
- return
class ListSnapshot(lister.Lister):
@@ -217,7 +216,6 @@ class SetSnapshot(command.Command):
volume_client.volume_snapshots.set_metadata(snapshot.id,
parsed_args.property)
volume_client.volume_snapshots.update(snapshot.id, **kwargs)
- return
class ShowSnapshot(show.ShowOne):
@@ -280,4 +278,3 @@ class UnsetSnapshot(command.Command):
)
else:
self.app.log.error("No changes requested\n")
- return
diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py
index bbcceca6..c636cf2f 100644
--- a/openstackclient/volume/v2/volume.py
+++ b/openstackclient/volume/v2/volume.py
@@ -189,7 +189,6 @@ class DeleteVolume(command.Command):
volume_client.volumes.force_delete(volume_obj.id)
else:
volume_client.volumes.delete(volume_obj.id)
- return
class ListVolume(lister.Lister):
@@ -394,8 +393,6 @@ class SetVolume(command.Command):
if not kwargs and not parsed_args.property and not parsed_args.size:
self.app.log.error("No changes requested\n")
- return
-
class ShowVolume(show.ShowOne):
"""Display volume details"""
@@ -452,4 +449,3 @@ class UnsetVolume(command.Command):
volume_client.volumes.delete_metadata(
volume.id, parsed_args.property)
- return
diff --git a/openstackclient/volume/v2/volume_type.py b/openstackclient/volume/v2/volume_type.py
index 583e6ed9..06ab8f82 100644
--- a/openstackclient/volume/v2/volume_type.py
+++ b/openstackclient/volume/v2/volume_type.py
@@ -110,7 +110,6 @@ class DeleteVolumeType(command.Command):
volume_type = utils.find_resource(
volume_client.volume_types, parsed_args.volume_type)
volume_client.volume_types.delete(volume_type.id)
- return
class ListVolumeType(lister.Lister):
@@ -201,8 +200,6 @@ class SetVolumeType(command.Command):
if parsed_args.property:
volume_type.set_keys(parsed_args.property)
- return
-
class ShowVolumeType(show.ShowOne):
"""Display volume type details"""
@@ -258,4 +255,3 @@ class UnsetVolumeType(command.Command):
parsed_args.volume_type,
)
volume_type.unset_keys(parsed_args.property)
- return