diff options
| -rw-r--r-- | doc/source/command-objects/ip-fixed.rst | 45 | ||||
| -rw-r--r-- | doc/source/command-objects/ip-floating-pool.rst | 15 | ||||
| -rw-r--r-- | doc/source/command-objects/ip-floating.rst (renamed from doc/source/command-objects/floatingip.rst) | 36 | ||||
| -rw-r--r-- | doc/source/command-objects/security-group-rule.rst | 65 | ||||
| -rw-r--r-- | doc/source/command-objects/security-group.rst | 95 | ||||
| -rw-r--r-- | doc/source/command-objects/server.rst | 27 | ||||
| -rw-r--r-- | doc/source/commands.rst | 16 | ||||
| -rw-r--r-- | functional/tests/common/test_configuration.py | 12 | ||||
| -rw-r--r-- | openstackclient/common/utils.py | 4 | ||||
| -rw-r--r-- | openstackclient/compute/v2/fixedip.py | 12 | ||||
| -rw-r--r-- | openstackclient/compute/v2/floatingip.py | 18 | ||||
| -rw-r--r-- | openstackclient/compute/v2/floatingippool.py | 2 | ||||
| -rw-r--r-- | openstackclient/compute/v2/security_group.py | 20 | ||||
| -rw-r--r-- | openstackclient/compute/v2/server.py | 53 | ||||
| -rw-r--r-- | openstackclient/compute/v2/usage.py | 17 | ||||
| -rw-r--r-- | openstackclient/tests/compute/v2/test_server.py | 54 | ||||
| -rw-r--r-- | requirements.txt | 4 | ||||
| -rw-r--r-- | setup.cfg | 3 | ||||
| -rw-r--r-- | test-requirements.txt | 2 |
19 files changed, 404 insertions, 96 deletions
diff --git a/doc/source/command-objects/ip-fixed.rst b/doc/source/command-objects/ip-fixed.rst new file mode 100644 index 00000000..3a55b995 --- /dev/null +++ b/doc/source/command-objects/ip-fixed.rst @@ -0,0 +1,45 @@ +======== +ip fixed +======== + +Compute v2 + +ip fixed add +------------ + +Add fixed IP address to server + +.. program:: ip fixed add +.. code:: bash + + os ip fixed add + <network> + <server> + +.. describe:: <network> + + Network to fetch an IP address from (name or ID) + +.. describe:: <server> + + Server to receive the IP address (name or ID) + +ip fixed remove +--------------- + +Remove fixed IP address from server + +.. program:: ip fixed remove +.. code:: bash + + os ip fixed remove + <ip-address> + <server> + +.. describe:: <ip-address> + + IP address to remove from server (name only) + +.. describe:: <server> + + Server to remove the IP address from (name or ID) diff --git a/doc/source/command-objects/ip-floating-pool.rst b/doc/source/command-objects/ip-floating-pool.rst new file mode 100644 index 00000000..63a450eb --- /dev/null +++ b/doc/source/command-objects/ip-floating-pool.rst @@ -0,0 +1,15 @@ +================ +ip floating pool +================ + +Compute v2 + +ip floating pool list +--------------------- + +List pools of floating IP addresses + +.. program:: ip floating pool list +.. code:: bash + + os ip floating pool list diff --git a/doc/source/command-objects/floatingip.rst b/doc/source/command-objects/ip-floating.rst index 1ae3041e..6bfd7f44 100644 --- a/doc/source/command-objects/floatingip.rst +++ b/doc/source/command-objects/ip-floating.rst @@ -1,24 +1,24 @@ -========== -floatingip -========== +=========== +ip floating +=========== Compute v2 ip floating add --------------- -Add floating-ip to server +Add floating IP address to server .. program:: ip floating add .. code:: bash os ip floating add - <ip_address> + <ip-address> <server> -.. describe:: <ip_address> +.. describe:: <ip-address> - IP address to add to server + IP address to add to server (name only) .. describe:: <server> @@ -27,7 +27,7 @@ Add floating-ip to server ip floating create ------------------ -Create new floating-ip +Create new floating IP address .. program:: ip floating create .. code:: bash @@ -37,27 +37,27 @@ Create new floating-ip .. describe:: <pool> - Pool to fetch floating IP from + Pool to fetch IP address from (name or ID) ip floating delete ------------------ -Delete a floating-ip +Delete a floating IP address .. program:: ip floating delete .. code:: bash os ip floating delete - <ip_address> + <ip-address> -.. describe:: <ip_address> +.. describe:: <ip-address> - IP address to delete + IP address to delete (ID only) ip floating list ---------------- -List floating-ips +List floating IP addresses .. program:: ip floating list .. code:: bash @@ -67,18 +67,18 @@ List floating-ips ip floating remove ------------------ -Remove floating-ip from server +Remove floating IP address from server .. program:: ip floating remove .. code:: bash os ip floating remove - <ip_address> + <ip-address> <server> -.. describe:: <ip_address> +.. describe:: <ip-address> - IP address to remove from server + IP address to remove from server (name only) .. describe:: <server> diff --git a/doc/source/command-objects/security-group-rule.rst b/doc/source/command-objects/security-group-rule.rst new file mode 100644 index 00000000..8bd0d061 --- /dev/null +++ b/doc/source/command-objects/security-group-rule.rst @@ -0,0 +1,65 @@ +=================== +security group rule +=================== + +Compute v2 + +security group rule create +-------------------------- + +Create a new security group rule + +.. program:: security group rule create +.. code:: bash + + os security group rule create + [--proto <proto>] + [--src-ip <ip-address>] + [--dst-port <port-range>] + <group> + +.. option:: --proto <proto> + + IP protocol (icmp, tcp, udp; default: tcp) + +.. option:: --src-ip <ip-address> + + Source IP (may use CIDR notation; default: 0.0.0.0/0) + +.. option:: --dst-port <port-range> + + Destination port, may be a range: 137:139 (default: 0; only required for proto tcp and udp) + +.. describe:: <group> + + Create rule in this security group (name or ID) + +security group rule delete +-------------------------- + +Delete a security group rule + +.. program:: security group rule delete +.. code:: bash + + os security group rule delete + <rule> + +.. describe:: <rule> + + Security group rule to delete (ID only) + +security group rule list +------------------------ + +List security group rules + +.. program:: security group rule list +.. code:: bash + + os security group rule list + <group> + +.. describe:: <group> + + List all rules in this security group (name or ID) diff --git a/doc/source/command-objects/security-group.rst b/doc/source/command-objects/security-group.rst new file mode 100644 index 00000000..60de41d8 --- /dev/null +++ b/doc/source/command-objects/security-group.rst @@ -0,0 +1,95 @@ +============== +security group +============== + +Compute v2 + +security group create +--------------------- + +Create a new security group + +.. program:: security group create +.. code:: bash + + os security group create + [--description <description>] + <name> + +.. option:: --description <description> + + Security group description + +.. describe:: <name> + + New security group name + +security group delete +--------------------- + +Delete a security group + +.. program:: security group delete +.. code:: bash + + os security group delete + <group> + +.. describe:: <group> + + Security group to delete (name or ID) + +security group list +------------------- + +List security groups + +.. program:: security group list +.. code:: bash + + os security group list + [--all-projects] + +.. option:: --all-projects + + Display information from all projects (admin only) + +security group set +------------------ + +Set security group properties + +.. program:: security group set +.. code:: bash + + os security group set + [--name <new-name>] + [--description <description>] + <group> + +.. option:: --name <new-name> + + New security group name + +.. option:: --description <description> + + New security group description + +.. describe:: <group> + + Security group to modify (name or ID) + +security group show +------------------- + +Display security group details + +.. program:: security group show +.. code:: bash + + os security group show + <group> + +.. describe:: <group> + + Security group to display (name or ID) diff --git a/doc/source/command-objects/server.rst b/doc/source/command-objects/server.rst index 4aeef4d0..6ae4d254 100644 --- a/doc/source/command-objects/server.rst +++ b/doc/source/command-objects/server.rst @@ -483,17 +483,32 @@ a revert to release the new server and restart the old one. server resume ------------- -Resume server +Resume server(s) .. program:: server resume .. code:: bash os server resume - <server> + <server> [<server> ...] .. describe:: <server> - Server (name or ID) + Server(s) to resume (name or ID) + +server shelve +------------- + +Shelve server(s) + +.. program:: server shelve +.. code:: bash + + os server shelve + <server> [<server> ...] + +.. describe:: <server> + + Server(s) to shelve (name or ID) server set ---------- @@ -628,17 +643,17 @@ Stop server(s) server suspend -------------- -Suspend server +Suspend server(s) .. program:: server suspend .. code:: bash os server suspend - <server> + <server> [<server> ...] .. describe:: <server> - Server (name or ID) + Server(s) to suspend (name or ID) server unlock ------------- diff --git a/doc/source/commands.rst b/doc/source/commands.rst index e69699b1..971739de 100644 --- a/doc/source/commands.rst +++ b/doc/source/commands.rst @@ -91,13 +91,14 @@ referring to both Compute and Volume quotas. * ``hypervisor stats``: (**Compute**) hypervisor statistics over all compute nodes * ``identity provider``: (**Identity**) a source of users and authentication * ``image``: (**Image**) a disk image -* ``ip fixed``: Compute, Network - an internal IP address assigned to a server -* ``ip floating``: Compute, Network - a public IP address that can be mapped to a server +* ``ip fixed``: (**Compute**, **Network**) - an internal IP address assigned to a server +* ``ip floating``: (**Compute**, **Network**) - a public IP address that can be mapped to a server +* ``ip floating pool``: (**Compute**, **Network**) - a pool of public IP addresses * ``keypair``: (**Compute**) an SSH public key * ``limits``: (**Compute**, **Volume**) resource usage limits * ``mapping``: (**Identity**) a definition to translate identity provider attributes to Identity concepts * ``module``: internal - installed Python modules in the OSC process -* ``network``: Network - a virtual network for connecting servers and other resources +* ``network``: (**Network**) - a virtual network for connecting servers and other resources * ``object``: (**Object Store**) a single file in the Object Store * ``policy``: (**Identity**) determines authorization * ``project``: (**Identity**) owns a group of resources @@ -106,8 +107,8 @@ referring to both Compute and Volume quotas. * ``request token``: (**Identity**) temporary OAuth-based token * ``role``: (**Identity**) a policy object used to determine authorization * ``role assignment``: (**Identity**) a relationship between roles, users or groups, and domains or projects -* ``security group``: Compute, Network - groups of network access rules -* ``security group rule``: Compute, Network - the individual rules that define protocol/IP/port access +* ``security group``: (**Compute**, **Network**) - groups of network access rules +* ``security group rule``: (**Compute**, **Network**) - the individual rules that define protocol/IP/port access * ``server``: (**Compute**) virtual machine instance * ``server image``: (**Compute**) saved server disk image * ``service``: (**Identity**) a cloud service @@ -178,14 +179,15 @@ Those actions with an opposite action are noted in parens if applicable. * ``remove`` (``add``) - remove an object from a group of objects * ``rescue`` (``unrescue``) - reboot a server in a special rescue mode allowing access to the original disks * ``resize`` - change a server's flavor -* ``resume`` (``suspend``) - return a suspended server to running state +* ``resume`` (``suspend``) - return one or more suspended servers to running state * ``revoke`` (``issue``) - revoke a token * ``save`` - download an object locally * ``set`` (``unset``) - set a property on the object, formerly called metadata +* ``shelve`` (``unshelve``) - shelve one or more server * ``show`` - display detailed information about the specific object * ``start`` (``stop``) - start one or more servers * ``stop`` (``start``) - stop one or more servers -* ``suspend`` (``resume``) - stop a server and save to disk freeing memory +* ``suspend`` (``resume``) - stop one or more servers and save to disk freeing memory * ``unlock`` (``lock``) - unlock one or more servers * ``unpause`` (``pause``) - return one or more paused servers to running state * ``unrescue`` (``rescue``) - return a server to normal boot mode diff --git a/functional/tests/common/test_configuration.py b/functional/tests/common/test_configuration.py index f4a02099..801ee10d 100644 --- a/functional/tests/common/test_configuration.py +++ b/functional/tests/common/test_configuration.py @@ -30,9 +30,15 @@ class ConfigurationTests(test.TestCase): def test_configuration_show_unmask(self): raw_output = self.openstack('configuration show --unmask ' + self.opts) - passwd = os.environ['OS_PASSWORD'] - self.assertOutput(passwd + '\n', raw_output) + # If we are using os-client-config, this will not be set. Rather than + # parse clouds.yaml to get the right value, just make sure + # we are not getting redacted. + passwd = os.environ.get('OS_PASSWORD') + if passwd: + self.assertEqual(passwd + '\n', raw_output) + else: + self.assertNotEqual(configuration.REDACTED + '\n', raw_output) def test_configuration_show_mask(self): raw_output = self.openstack('configuration show --mask ' + self.opts) - self.assertOutput(configuration.REDACTED + '\n', raw_output) + self.assertEqual(configuration.REDACTED + '\n', raw_output) diff --git a/openstackclient/common/utils.py b/openstackclient/common/utils.py index 0a1f8e0e..4da8e320 100644 --- a/openstackclient/common/utils.py +++ b/openstackclient/common/utils.py @@ -145,7 +145,6 @@ def format_dict(data): """Return a formatted string of key value pairs :param data: a dict - :param format: optional formatting hints :rtype: a string formatted to key='value' """ @@ -305,8 +304,9 @@ def wait_for_status(status_f, :param status_f: a status function that takes a single id argument :param res_id: the resource id to watch - :param success_status: a list of status strings for successful completion :param status_field: the status attribute in the returned resource object + :param success_status: a list of status strings for successful completion + :param error_status: a list of status strings for error :param sleep_time: wait this long (seconds) :param callback: called per sleep cycle, useful to display progress :rtype: True on success diff --git a/openstackclient/compute/v2/fixedip.py b/openstackclient/compute/v2/fixedip.py index d105e391..da9d85c3 100644 --- a/openstackclient/compute/v2/fixedip.py +++ b/openstackclient/compute/v2/fixedip.py @@ -23,7 +23,7 @@ from openstackclient.common import utils class AddFixedIP(command.Command): - """Add fixed-ip command""" + """Add fixed IP address to server""" log = logging.getLogger(__name__ + ".AddFixedIP") @@ -32,12 +32,12 @@ class AddFixedIP(command.Command): parser.add_argument( "network", metavar="<network>", - help="Name of the network to fetch an IP address from", + help="Network to fetch an IP address from (name or ID)", ) parser.add_argument( "server", metavar="<server>", - help="Name of the server to receive the IP address", + help="Server to receive the IP address (name or ID)", ) return parser @@ -56,7 +56,7 @@ class AddFixedIP(command.Command): class RemoveFixedIP(command.Command): - """Remove fixed-ip command""" + """Remove fixed IP address from server""" log = logging.getLogger(__name__ + ".RemoveFixedIP") @@ -65,12 +65,12 @@ class RemoveFixedIP(command.Command): parser.add_argument( "ip_address", metavar="<ip-address>", - help="IP address to remove from server", + help="IP address to remove from server (name only)", ) parser.add_argument( "server", metavar="<server>", - help="Name of the server to remove the IP address from", + help="Server to remove the IP address from (name or ID)", ) return parser diff --git a/openstackclient/compute/v2/floatingip.py b/openstackclient/compute/v2/floatingip.py index c557c24b..65fe5910 100644 --- a/openstackclient/compute/v2/floatingip.py +++ b/openstackclient/compute/v2/floatingip.py @@ -26,7 +26,7 @@ from openstackclient.common import utils class AddFloatingIP(command.Command): - """Add floating-ip to server""" + """Add floating IP address to server""" log = logging.getLogger(__name__ + ".AddFloatingIP") @@ -35,7 +35,7 @@ class AddFloatingIP(command.Command): parser.add_argument( "ip_address", metavar="<ip-address>", - help="IP address to add to server", + help="IP address to add to server (name only)", ) parser.add_argument( "server", @@ -56,7 +56,7 @@ class AddFloatingIP(command.Command): class CreateFloatingIP(show.ShowOne): - """Create new floating-ip""" + """Create new floating IP address""" log = logging.getLogger(__name__ + '.CreateFloatingIP') @@ -65,7 +65,7 @@ class CreateFloatingIP(show.ShowOne): parser.add_argument( 'pool', metavar='<pool>', - help='Pool to fetch floating IP from', + help='Pool to fetch IP address from (name or ID)', ) return parser @@ -80,7 +80,7 @@ class CreateFloatingIP(show.ShowOne): class DeleteFloatingIP(command.Command): - """Delete a floating-ip""" + """Delete a floating IP address""" log = logging.getLogger(__name__ + '.DeleteFloatingIP') @@ -89,7 +89,7 @@ class DeleteFloatingIP(command.Command): parser.add_argument( "ip_address", metavar="<ip-address>", - help="IP address to delete", + help="IP address to delete (ID only)", ) return parser @@ -107,7 +107,7 @@ class DeleteFloatingIP(command.Command): class ListFloatingIP(lister.Lister): - """List floating-ips""" + """List floating IP addresses""" log = logging.getLogger(__name__ + '.ListFloatingIP') @@ -127,7 +127,7 @@ class ListFloatingIP(lister.Lister): class RemoveFloatingIP(command.Command): - """Remove floating-ip from server""" + """Remove floating IP address from server""" log = logging.getLogger(__name__ + ".RemoveFloatingIP") @@ -136,7 +136,7 @@ class RemoveFloatingIP(command.Command): parser.add_argument( "ip_address", metavar="<ip-address>", - help="IP address to remove from server", + help="IP address to remove from server (name only)", ) parser.add_argument( "server", diff --git a/openstackclient/compute/v2/floatingippool.py b/openstackclient/compute/v2/floatingippool.py index cc485552..39a2d8fe 100644 --- a/openstackclient/compute/v2/floatingippool.py +++ b/openstackclient/compute/v2/floatingippool.py @@ -23,7 +23,7 @@ from openstackclient.common import utils class ListFloatingIPPool(lister.Lister): - """List floating-ip-pools""" + """List pools of floating IP addresses""" log = logging.getLogger(__name__ + '.ListFloatingIPPool') diff --git a/openstackclient/compute/v2/security_group.py b/openstackclient/compute/v2/security_group.py index 3dd0c49b..0ba51d68 100644 --- a/openstackclient/compute/v2/security_group.py +++ b/openstackclient/compute/v2/security_group.py @@ -103,7 +103,7 @@ class DeleteSecurityGroup(command.Command): parser.add_argument( 'group', metavar='<group>', - help='Name or ID of security group to delete', + help='Security group to delete (name or ID)', ) return parser @@ -120,7 +120,7 @@ class DeleteSecurityGroup(command.Command): class ListSecurityGroup(lister.Lister): - """List all security groups""" + """List security groups""" log = logging.getLogger(__name__ + ".ListSecurityGroup") @@ -185,7 +185,7 @@ class SetSecurityGroup(show.ShowOne): parser.add_argument( 'group', metavar='<group>', - help='Name or ID of security group to change', + help='Security group to modify (name or ID)', ) parser.add_argument( '--name', @@ -195,7 +195,7 @@ class SetSecurityGroup(show.ShowOne): parser.add_argument( "--description", metavar="<description>", - help="New security group name", + help="New security group description", ) return parser @@ -227,7 +227,7 @@ class SetSecurityGroup(show.ShowOne): class ShowSecurityGroup(show.ShowOne): - """Show a specific security group""" + """Display security group details""" log = logging.getLogger(__name__ + '.ShowSecurityGroup') @@ -236,7 +236,7 @@ class ShowSecurityGroup(show.ShowOne): parser.add_argument( 'group', metavar='<group>', - help='Name or ID of security group to change', + help='Security group to display (name or ID)', ) return parser @@ -275,7 +275,7 @@ class CreateSecurityGroupRule(show.ShowOne): parser.add_argument( 'group', metavar='<group>', - help='Create rule in this security group', + help='Create rule in this security group (name or ID)', ) parser.add_argument( "--proto", @@ -333,7 +333,7 @@ class DeleteSecurityGroupRule(command.Command): parser.add_argument( 'rule', metavar='<rule>', - help='Security group rule ID to delete', + help='Security group rule to delete (ID only)', ) return parser @@ -346,7 +346,7 @@ class DeleteSecurityGroupRule(command.Command): class ListSecurityGroupRule(lister.Lister): - """List all security group rules""" + """List security group rules""" log = logging.getLogger(__name__ + ".ListSecurityGroupRule") @@ -355,7 +355,7 @@ class ListSecurityGroupRule(lister.Lister): parser.add_argument( 'group', metavar='<group>', - help='List all rules in this security group', + help='List all rules in this security group (name or ID)', ) return parser diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index aa4569c3..875b9a13 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -1268,7 +1268,7 @@ class ResizeServer(command.Command): class ResumeServer(command.Command): - """Resume server""" + """Resume server(s)""" log = logging.getLogger(__name__ + '.ResumeServer') @@ -1277,7 +1277,8 @@ class ResumeServer(command.Command): parser.add_argument( 'server', metavar='<server>', - help=_('Server (name or ID)'), + nargs='+', + help=_('Server(s) to resume (name or ID)'), ) return parser @@ -1285,10 +1286,11 @@ class ResumeServer(command.Command): def take_action(self, parsed_args): compute_client = self.app.client_manager.compute - utils.find_resource( - compute_client.servers, - parsed_args.server, - ) .resume() + for server in parsed_args.server: + utils.find_resource( + compute_client.servers, + server, + ).resume() class SetServer(command.Command): @@ -1387,6 +1389,31 @@ class ShowServer(show.ShowOne): return zip(*sorted(six.iteritems(data))) +class ShelveServer(command.Command): + """Shelve server(s)""" + + log = logging.getLogger(__name__ + '.ShelveServer') + + def get_parser(self, prog_name): + parser = super(ShelveServer, self).get_parser(prog_name) + parser.add_argument( + 'server', + metavar='<server>', + nargs='+', + help=_('Server(s) to shelve (name or ID)'), + ) + return parser + + @utils.log_method(log) + def take_action(self, parsed_args): + compute_client = self.app.client_manager.compute + for server in parsed_args.server: + utils.find_resource( + compute_client.servers, + server, + ).shelve() + + class SshServer(command.Command): """Ssh to server""" @@ -1585,7 +1612,7 @@ class StopServer(command.Command): class SuspendServer(command.Command): - """Suspend server""" + """Suspend server(s)""" log = logging.getLogger(__name__ + '.SuspendServer') @@ -1594,7 +1621,8 @@ class SuspendServer(command.Command): parser.add_argument( 'server', metavar='<server>', - help=_('Server (name or ID)'), + nargs='+', + help=_('Server(s) to suspend (name or ID)'), ) return parser @@ -1602,10 +1630,11 @@ class SuspendServer(command.Command): def take_action(self, parsed_args): compute_client = self.app.client_manager.compute - utils.find_resource( - compute_client.servers, - parsed_args.server, - ).suspend() + for server in parsed_args.server: + utils.find_resource( + compute_client.servers, + server, + ).suspend() class UnlockServer(command.Command): diff --git a/openstackclient/compute/v2/usage.py b/openstackclient/compute/v2/usage.py index 6d5d678f..4e7cf100 100644 --- a/openstackclient/compute/v2/usage.py +++ b/openstackclient/compute/v2/usage.py @@ -196,20 +196,3 @@ class ShowUsage(show.ShowOne): float("%.2f" % usage.total_local_gb_usage) if hasattr(usage, "total_local_gb_usage") else None) return zip(*sorted(six.iteritems(info))) - - -# This is out of order due to the subclass, will eventually be removed - -class ListProjectUsage(ListUsage): - """List resource usage per project""" - - deprecated = True - - log = logging.getLogger('DEPRECATED:') - - def take_action(self, parsed_args): - self.log.warning( - "%s is deprecated, use 'usage list'", - getattr(self, 'cmd_name', 'this command'), - ) - return super(ListProjectUsage, self).take_action(parsed_args) diff --git a/openstackclient/tests/compute/v2/test_server.py b/openstackclient/tests/compute/v2/test_server.py index 791a90ab..61e098a8 100644 --- a/openstackclient/tests/compute/v2/test_server.py +++ b/openstackclient/tests/compute/v2/test_server.py @@ -766,3 +766,57 @@ class TestServerGeneral(testtools.TestCase): server._get_ip_address, self.OLD, 'public', [4, 6]) self.assertRaises(exceptions.CommandError, server._get_ip_address, self.OLD, 'private', [6]) + + +class TestShelveServer(TestServer): + + def setUp(self): + super(TestShelveServer, self).setUp() + + # Get the command object to test + self.cmd = server.ShelveServer(self.app, None) + + # Set shelve method to be tested. + self.methods = { + 'shelve': None, + } + + def setup_servers_mock(self, count=1): + servers = fakes.FakeServer.create_servers(methods=self.methods, + count=count) + + self.servers_mock.get = fakes.FakeServer.get_servers(servers, 1) + + return servers + + def test_shelve_one_server(self): + server = self.setup_servers_mock(1)[0] + + arglist = [ + server.id, + ] + verifylist = [ + ('server', [server.id]), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + self.cmd.take_action(parsed_args) + + server.shelve.assert_called_with() + + def test_shelve_multi_servers(self): + servers = self.setup_servers_mock(3) + arglist = [] + verifylist = [] + + for i in range(0, len(servers)): + arglist.append(servers[i].id) + verifylist = [ + ('server', arglist), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + self.cmd.take_action(parsed_args) + + for i in range(0, len(servers)): + servers[i].shelve.assert_called_with() diff --git a/requirements.txt b/requirements.txt index a710d6fb..215874cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,9 +8,9 @@ Babel>=1.3 cliff>=1.14.0 # Apache-2.0 keystoneauth1>=1.0.0 os-client-config!=1.6.2,>=1.4.0 -oslo.config>=2.6.0 # Apache-2.0 +oslo.config>=2.7.0 # Apache-2.0 oslo.i18n>=1.5.0 # Apache-2.0 -oslo.utils!=2.6.0,>=2.4.0 # Apache-2.0 +oslo.utils>=2.8.0 # Apache-2.0 python-glanceclient>=0.18.0 python-keystoneclient!=1.8.0,>=1.6.0 python-novaclient!=2.33.0,>=2.29.0 @@ -104,8 +104,6 @@ openstack.compute.v2 = keypair_list = openstackclient.compute.v2.keypair:ListKeypair keypair_show = openstackclient.compute.v2.keypair:ShowKeypair - project_usage_list = openstackclient.compute.v2.usage:ListProjectUsage - security_group_create = openstackclient.compute.v2.security_group:CreateSecurityGroup security_group_delete = openstackclient.compute.v2.security_group:DeleteSecurityGroup security_group_list = openstackclient.compute.v2.security_group:ListSecurityGroup @@ -132,6 +130,7 @@ openstack.compute.v2 = server_resize = openstackclient.compute.v2.server:ResizeServer server_resume = openstackclient.compute.v2.server:ResumeServer server_set = openstackclient.compute.v2.server:SetServer + server_shelve = openstackclient.compute.v2.server:ShelveServer server_show = openstackclient.compute.v2.server:ShowServer server_ssh = openstackclient.compute.v2.server:SshServer server_start = openstackclient.compute.v2.server:StartServer diff --git a/test-requirements.txt b/test-requirements.txt index 27f72bbe..c02ebf0e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -7,7 +7,7 @@ coverage>=3.6 discover fixtures>=1.3.1 mock>=1.2 -oslosphinx>=2.5.0 # Apache-2.0 +oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 requests-mock>=0.6.0 # Apache-2.0 sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 |
