Commit graph

4103 commits

Author SHA1 Message Date
Zuul
50544ae78b Merge "compute: Fix formatting of 'server show'" 2024-01-18 14:12:32 +00:00
Zuul
4bafc32616 Merge "Fix clearing of dns_domain and description on a network by setting to empty strings" 2024-01-10 18:31:42 +00:00
Zuul
b740f2f6bd Merge "Correct error message for "create server --wait"" 2024-01-10 16:09:48 +00:00
Bence Romsics
cc2a0bab24 Correct error message for "create server --wait"
Error message should say "Error creating server" and not "unshelving".

Change-Id: I49dc6160f47a13d38128b3da1ba16437bd089c86
Closes-Bug: #2048896
2024-01-10 14:19:35 +01:00
Brian Haley
e7bc3d9b82 Fix --use-prefix-delegation subnet create argument
The --use-prefix-delegation argument when creating a
subnet should not take an argument of True/False, it
should simply trigger the code to set subnetpool_id
value to 'prefix_delegation'. Change action to correct
this.

Added unit test to cover missing checks.

Related-bug: #2028159
Change-Id: Ib7ee80100327b8611d4a354c7f4eb0e696c953da
2024-01-09 17:23:03 -05:00
Stephen Finucane
be3d438ed2 trivial: Place positional opts last
Change-Id: I5479e71223c8c224e0bba387348e740c997cc7bf
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-14 12:31:26 +00:00
Stephen Finucane
1b6b639c9f network: Clarify purpose of default sg rules
These only apply to newly created default security groups i.e. when you
create a new project. They do not apply to existing default security
groups.

Change-Id: Ie01bf47dd8a0392354d17d984b41c1fad504e659
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-14 12:30:03 +00:00
Pavlo Shchelokovskyy
f3207bdf3f Fix availability zone list command
there are two problems currently:
- SDK's `availability_zones()` returns a generator that raises errors
  only when actually accessing its items
- the error raised is the sdk exception, not nova one, and thus is not
  being handled correctly

As a result, currently nova AZs can not be listed by non-admins.

Story: 2010989
Task: 49220
Change-Id: Ia299faea85857d3fc3a9b539800f3483f84ccbc0
2023-12-07 16:24:34 +00:00
Zuul
2642b070db Merge "compute: Add 'server create --server-group' option" 2023-12-05 18:43:15 +00:00
Zuul
2957f28ff1 Merge "tests: Enable logging fixture" 2023-12-05 18:43:13 +00:00
Zuul
ca0473815f Merge "tests: Remove prints" 2023-12-05 18:43:11 +00:00
Zuul
ac2bd42372 Merge "test: Ignore 'OS_' environment variables" 2023-12-05 18:43:02 +00:00
Zuul
b458e78694 Merge "tests: Remove unused flag" 2023-12-05 18:43:01 +00:00
Zuul
519596dcb7 Merge "parseactions: Use ArgumentError, not ArgumentTypeError" 2023-12-05 18:42:59 +00:00
Zuul
b1548d9f3c Merge "Remove unnecessary file" 2023-12-05 18:35:48 +00:00
Zuul
2d32d87c16 Merge "Use CommandError, not SystemExit, to exit" 2023-12-05 18:35:47 +00:00
Zuul
0ac2e2f630 Merge "compute: Address bug in shelve offload logic" 2023-12-05 18:15:08 +00:00
Zuul
1da22d0de4 Merge "tests: Handle missing extensions in network tests" 2023-11-29 18:19:43 +00:00
Florian Streibelt
ce0765facb
Fix clearing of dns_domain and description on a network by setting to empty strings
After setting a default dns_domain on a network

 openstack net set --dns-domain 'example.com.' <NETWORKID>

the setting could not be reverted back to an empty string using

 openstack net set --dns-domain '' <NETWORKID>

and the call also does not emit any error.

The same is true for the description of a network.

Reason was using the parsed argument directly as a condition instead of
comparing against None -- dropping the empty string as valid value.

The name parameter already accepted an empty string.

This change also adds a testcase for dns_domain, description and the
network name parameter, checking if the empty string is forwarded.

Change-Id: Ia7b9738205002b028c19e4f397411c86469cba1a
2023-11-24 12:36:07 +01:00
Zuul
127b49d45e Merge "tests: Check for DHCP agents first in DHCP test" 2023-11-22 13:46:42 +00:00
Zuul
19896ec720 Merge "Adds command `image metadef object delete`" 2023-11-22 11:05:26 +00:00
ArtofBugs
6d3490ed7c tests: Handle missing extensions in network tests
Some tests still assume extensions are enabled; those tests are now skipped if the extension is not enabled. Change I25b8811fe09f2a4a9fc20ca5459f5a404b88a337 addressed some but not all of these.

Change-Id: If36550650f143a7efe4190e60961c51a8cd20fb3
2023-11-21 09:50:51 -08:00
Stephen Finucane
e44d8017ec tests: Check for DHCP agents first in DHCP test
If there are no agents with type=dhcp, the neutron-dhcp-agent service is
likely not enabled on the deployment.

Change-Id: I1253f35e71cf996c559f2a2d8d1d8cde6b41a519
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-21 10:31:01 +00:00
Mridula Joshi
5d1afcee68 Adds command `image metadef object delete`
Change-Id: Ib94b7ba625ca0679ae4ae841e217ea251baff371
2023-11-17 10:46:35 +00:00
Stephen Finucane
e9d3a7bb13 test: Ignore 'OS_' environment variables
Our functional tests are inherently dependent on 'clouds.yaml' files.
The presence of 'OS_*' environment variables can cause weird test
failures. Simply don't pass them through to our test environment.

Change-Id: I7d24cdff5f1f5798118816b12d7398b87a5f5ed4
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-15 11:41:13 +00:00
Stephen Finucane
c08d6e0391 parseactions: Use ArgumentError, not ArgumentTypeError
If you use the former, you get a pretty error message when there's a
failure. If you use the latter, you get an ugly traceback when used with
the '--debug' flag.

Without this change:

  $ openstack flavor create ... --property '' foo
  ...
  Traceback (most recent call last):
    File "/tmp/venv/lib/python3.11/site-packages/cliff/app.py", line 402, in run_subcommand
      parsed_args = cmd_parser.parse_args(sub_argv)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib64/python3.11/argparse.py", line 1862, in parse_args
      args, argv = self.parse_known_args(args, namespace)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib64/python3.11/argparse.py", line 1895, in parse_known_args
      namespace, args = self._parse_known_args(args, namespace)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib64/python3.11/argparse.py", line 2107, in _parse_known_args
      start_index = consume_optional(start_index)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib64/python3.11/argparse.py", line 2047, in consume_optional
      take_action(action, args, option_string)
    File "/usr/lib64/python3.11/argparse.py", line 1971, in take_action
      action(self, namespace, argument_values, option_string)
    File "/tmp/venv/lib/python3.11/site-packages/osc_lib/cli/parseractions.py", line 45, in __call__
      raise argparse.ArgumentTypeError(msg % str(values))
  argparse.ArgumentTypeError: Expected 'key=value' type, but got:
  clean_up CreateFlavor: Expected 'key=value' type, but got:

With this change:

  $ openstack flavor create ... --property '' foo
  ...
  usage: openstack flavor create [-h] [-f {json,shell,table,value,yaml}] [-c COLUMN]
                                 [--noindent] [--prefix PREFIX] [--max-width <integer>]
                                 [--fit-width] [--print-empty] [--id <id>]
                                 [--ram <size-mb>] [--disk <size-gb>]
                                 [--ephemeral <size-gb>] [--swap <size-mb>]
                                 [--vcpus <vcpus>] [--rxtx-factor <factor>]
                                 [--public | --private] [--property <key=value>]
                                 [--project <project>] [--description <description>]
                                 [--project-domain <project-domain>]
                                 <flavor-name>
  openstack flavor create: error: argument --property: Expected 'key=value' type, but got:
  clean_up CreateFlavor:

Change-Id: I9e78b35ad9d016d7a33655141ec579397c5344c0
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-15 11:33:19 +00:00
Stephen Finucane
3057997cae Remove unnecessary file
This is testing things now found in osc-lib. Remove it.

Change-Id: Iccbd540fa340c77a957486d16d352d3fe4c3ddb2
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-15 11:29:06 +00:00
Stephen Finucane
432698fea2 Use CommandError, not SystemExit, to exit
Change-Id: Id2bcc18420b17cf3afed5584ef5104c3ef413830
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-15 11:28:49 +00:00
Stephen Finucane
885f5912eb compute: Address bug in shelve offload logic
We were reusing a variable from a previous loop, which meant this would
never work with multiple servers. Correct the mistake.

Change-Id: I52246e183fb2cf0d855d92058dd305b48783589d
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-15 11:26:02 +00:00
Stephen Finucane
900fad5360 tests: Remove unused flag
Nothing is setting 'merge_stderr'. It looks like a carry-over from the
legacy clients.

Change-Id: I32b65830e11b27ba83dfba002bf996af561b0768
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-14 12:19:06 +00:00
Stephen Finucane
89a8f72960 tests: Enable logging fixture
Quieten the output of our test runs significantly.

Change-Id: Ie32c919bb987eb0b9bc4c5b2ec54ee20a6841c03
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-11-13 17:31:07 +00:00
Stephen Finucane
d0d4077e1d tests: Remove prints
Change-Id: I35adac1199769fd73978b6457044191d02bb5bd4
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-13 17:31:07 +00:00
Stephen Finucane
1678f87d7a tests: Handle missing extensions in network tests
This is mostly a case of skipping tests where the extension is missing,
but some tests are updated to remove a reliance on optional tests.

Change-Id: I25b8811fe09f2a4a9fc20ca5459f5a404b88a337
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-12 10:35:38 +00:00
Stephen Finucane
c251cb89a5 tests: Fix API extension check
The check for extensions was not using a machine readable format for
output. This meant an API check could match on a substring, e.g. a check
for 'qos' would match on 'qos-specs'. Address this issue by switching
our command invocation to use JSON output and migrating the check
function from the general base class to the networking base class.

Change-Id: Idc6dc54503031ddf3e148f50ed53ad8898f7a7e3
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-12 10:34:41 +00:00
Zuul
7dbe6e6d3d Merge "tests: Centralise check for networking service" 2023-11-10 13:55:41 +00:00
Stephen Finucane
20490dcd10 tests: Centralise check for networking service
No point duplicating this across functional tests.

Change-Id: I9502be8b4e718885c6f854c7f5b19f6cacf51055
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-10 10:06:58 +00:00
Zuul
1ac5d63c53 Merge "Adds command `image metadef object list`" 2023-11-08 18:01:44 +00:00
Zuul
8aee1a2889 Merge "Adds command `image metadef object show`" 2023-11-08 18:01:42 +00:00
Zuul
71f232aafa Merge "Add "image metadef property set" command" 2023-11-08 10:46:35 +00:00
Mridula Joshi
4bb6efa8f8 Adds command `image metadef object list`
Depends-on: https://review.opendev.org/c/openstack/openstacksdk/+/858350
Change-Id: I0691f7519e8fb9f01836e6232e0bcebd2c428ac3
2023-11-08 10:44:31 +00:00
Zuul
c09c1fbf51 Merge "Add "image metadef property delete" command" 2023-11-08 10:35:38 +00:00
Mridula Joshi
78ef009a3a Adds command `image metadef object show`
Depends-on: https://review.opendev.org/c/openstack/openstacksdk/+/858350
Change-Id: I97bcb0ccee9d25fb26475ec9e10660556e6072a6
2023-11-08 09:57:02 +00:00
Zuul
0439f17ed3 Merge "image: Add support for cache commands" 2023-11-07 09:31:24 +00:00
Zuul
e54bdfbba3 Merge "Adds command `image metadef object create`" 2023-11-07 09:31:21 +00:00
Zuul
0b78dfe30b Merge "Add pagination helpers" 2023-11-07 08:47:24 +00:00
Zuul
30462f57d4 Merge "Removed start, end time format. Before fix, openstack usage list command resulted 'str' object has no attribute 'isoformat' error." 2023-11-07 08:38:13 +00:00
Stephen Finucane
c7e3529dea Add pagination helpers
Add some pagination helpers to configure pagination parameters for
various commands. Two pagination schemes are supported, based on what we
currently support across OSC commands: marker-based pagination and
offset-based pagination.

Change-Id: I551bb4c3ff0568c6df5244a1d0f0669497bee58f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-11-03 23:16:18 +00:00
Stephen Finucane
7708106cf0 compute: Add 'server create --server-group' option
Add an alias for requesting a server group. This is more syntactic
sugar, though it comes with the added bonus of letting users request a
server group by name instead of just ID.

Change-Id: I3d9a7ce04a02fdf374b7a8082618eccdea8c3217
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-02 17:48:03 +00:00
Mridula Joshi
f8c708900c Adds command `image metadef object create`
Depends-on: https://review.opendev.org/c/openstack/openstacksdk/+/858350
Change-Id: Ie74231c823d6128d149d5f01c90a66ed3afa3d1a
2023-11-01 07:15:59 +00:00
Zuul
dfcb8b0ee7 Merge "trivial: Make better use of argparse" 2023-10-31 15:00:24 +00:00