We need to work around SDK's (intentional) lack of support for Nova's
deprecated '/os-security-groups' API but it's nothing too crazy.
Change-Id: I03ca1a73f98aa77b288148607baff336dae69fb1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This is a little more realistic. We fix a minor bug along the way and
start ignoring some newly added create-only fields.
Change-Id: I93eae610e16e2a3a859f684b889546ace3afa683
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
We don't need to transform one HTTP Forbidden-related error to another:
just use the original one. This also fixes an issue where we would end
up with an undefined variable (server_id) if a non-HTTP 403 exception
was raised, since that would be blindly ignored.
Change-Id: Icdd1764b6f2df4a635e3264ed8f93a115cc52ef2
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-Bug: #2062010
This change is entirely automated save for the update of some mocks from
'io.open' to '__builtins__.open').
We are keeping this change separate from addition of the actual hook so
that we can ignore the commit later.
Change-Id: I0a9d8736632084473b57b57b693322447d7be519
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Most of these skips were unnecessary. The few that did generate warnings
could be skipped.
We also set 'skip_install' since there's no reason to build the package
for linting purposes.
Change-Id: I9644e5c19720b9c41c60e0a5882b7cd7f6a71f7b
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
We have seen users interpret the current output ('Complete') of
'server migrate --wait' as if it meant success as well and be surprised
when later they learned that the migration was complete and failed.
This change adds a pointer to the that output, how to actually check the
success/failure of a migration, hoping to eliminate this user confusion.
Change-Id: I09030705a39405366d6202a5ac743cc4d1ddd63c
An openstacksdk 'find_foo' proxy method will return None by default if a
resource is not found. You can change this behavior by setting
'ignore_missing=False'. We were doing this in most, but not all cases:
correct the issue.
In the event of calling 'image delete' with multiple images, it will no
longer fail on the first missing image and will instead attempt to
delete remaining images before failing.
Change-Id: I1e01d3c096dcaab731c28e496a182dd911229227
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
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>
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>
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>
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>
This removes the need for a number of base test case subclasses. We use
'compute_client' rather than 'client' to avoid conflicts with clients
for other services.
Change-Id: I430214cd79eca481bd8d8c53bf97eaede6766eb4
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
While a relatively small library, this is one import that we really
don't need. Remove it.
Change-Id: I726f3c3548cbd896588ef0613222e36c529f5bcc
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This patch modifes the "server create --boot-from-volume" command
without image option print "'NoneType' object has no attribute 'id'"
story: 2010892
task: 48669
Change-Id: I566f81c285d4ebc1e23ea0762d67492fb6b3bcbe
Dropping the use of 'AddFixedIp' server action entirely in favour of
creating an interface with a fixed IP using the 'os-interface' API. The
reason for doing this is because this mechanism allows us to request an
explicit fixed IP.
Adds back support for using the --fixed-ip-address argument for users
who use older nova-api versions.
Change-Id: Ieac4b0fbcb38fe7207eaaa6a79e0c6770ee11d80
In change Ic253184ee5f911ec2052419d328260dc4664b273, we switched to
using the SDK for the 'server show' command. There were a couple of
issues with this change, which we address here:
- openstacksdk uses different names for fields than the nova API. We
opted to output both the original names and the openstacksdk aliases
in the output. With testing, however, it's become obvious that the
resulting output is very long and rather unfriendly from a UX
perspective. We opt to only show fields with their original names.
- A number of fields included in the output are only valid in requests
and will never be present in responses. These are removed.
- A number of fields are not present in later API microversions or are
only present under certain conditions. These are removed from output
when not included in responses.
- The image and flavor fields both had errant logic that resulted in
unnecessary or incorrect information being show. This logic is
corrected.
With these changes, the output now resembles the output seen before the
migration to openstacksdk. In the future we may wish to build on this
further and switch from a blacklist model (removing the fields we do not
wish to show from output) to a whitelist model (specifically stating
which fields to show) but that's a change for another day.
Change-Id: I7e3eaa0149bff202c8fd4538356cbc75b4f7e708
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
A mistake was introduced during the conversion from novaclient to SDK in
change I5ebfa6b2468d5f20b99ea0eab1aea9377be09b8c. Fix the issue and add
functional tests to prevent it being reintroduced.
Change-Id: I6b314eab31bcf452e88b8b6a239ac2e296497cb9
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Story: 2010750
Task: 48004
currently the command is waiting only for ACTIVE server status,
but if the server was SHUTOFF before, it will be SHUTOFF after
rebuild as well, so the command is stuck in waiting forever.
Additionally, we now also pre-validate the server status on client side,
and raise an error if the server to be rebuilt is not in ACTIVE, ERROR
or SHUTOFF state.
Change-Id: If90a4bbba9a7ecd972f8b594c52fee4f75a0ae5e
Co-Authored-By: Oleksiy Molchanov <omolchanov@mirantis.com>
Story: 2010751
Task: 48005
Black used with the '-l 79 -S' flags.
A future change will ignore this commit in git-blame history by adding a
'git-blame-ignore-revs' file.
Change-Id: I9af45c062d179ab3dc2a5e969e1c467932753a2b
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This one is a little more complicated because we support waiting.
Change-Id: I5bd65b44c23bfee1e0144dbd060563ecc3cfb942
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
We use 'set', not 'update', in command names. An alias is provided.
Change-Id: I7864599e06df055999b975aabf101611cd482753
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>