Previously, retrieving the default strategy configuration required
using "RegionOne" as the subcloud_ref. Since the concept of "RegionOne"
will be removed in the future, and the system controller will only have
a UUID region and the "SystemController" region, this commit updates
references from "RegionOne" to "SystemController" when requesting the
default strategy configuration.
Test Plan:
01. PASS - Run 'dcmanager strategy-config update' using different
region names: "RegionOne", "SystemController", and without
specifying a region name. Verify that the default options are
modified accordingly.
02. PASS - Run the previous test but using 'dcmanager strategy-config
show' instead.
Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/945580
Story: 2011312
Task: 51862
Change-Id: I371fd2550b521943da93c3817c35785bde470cd6
Signed-off-by: Gustavo Herzmann <gustavo.herzmann@windriver.com>
To accommodate the upgraded subcloud from previous releases where the
kube-rootca_sync_status can be in-sync even without matching
certificates between subcloud and system controller, the kube-rootca
audit was changed to alarm based. Since the user might want to update
the cert for it to match between the two systems even with
kube-rootca_sync_status being in-sync, this commit adds the --force
parameter back to kube-rootca update strategy.
Test plan:
- PASS: Perform a kube-rootca update strategy without --force in an
out-of-sync subcloud and verify it completes successfully.
- PASS: Perform a kube-rootca update strategy without --force in an
in-sync subcloud and verify an exception is raised.
- PASS: Perform a kube-rootca update strategy with --force in an
in-sync subcloud and verify it completes successfully.
Depends-on: https://review.opendev.org/c/starlingx/distcloud/+/937874
Closes-bug: 2092069
Change-Id: I4dabe9811eaef8f82608576b0e70af109c57bc51
Signed-off-by: Victor Romano <victor.gluzromano@windriver.com>
This commit removes the `force` parameter from all strategies and
re-adds it only to the required prestage strategy. This change
prevents misuse of the `force` parameter and improves the help
message.
Note: VIM Client uses the force parameter internally by default:
https://review.opendev.org/c/starlingx/nfv/+/913827
Test Plan:
PASS: Verify that only the prestage strategy includes the `force`
parameter.
PASS: Confirm that other strategies no longer accept or display
the `force` parameter.
PASS: Ensure functionality for strategies with `force` remains
intact and works as expected.
Story: 2010676
Task: 51099
Change-Id: Ie510314be3eeade56e21e52d5b020518d462d21b
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit adds the logic to parse the region_name field returned by the API,
in order to be able to display it in the output of the subcloud show and
subcloud show detail commands according to the release to which the client is
trying to communicate.
Test Plan:
PASS - Run dcmanager subcloud show X
- Run dcmanager subcloud show --detail X
- Verify that the region_name field is displayed with that format.
PASS - Get a 24.09 client and connect to a 24.09 System Controller.
- Run dcmanager subcloud show X
- Run dcmanager subcloud show --detail X
- Verify that the region_name field is displayed with that format.
PASS - Get a 24.09 client and connect to a 22.12 System Controller.
- Run dcmanager subcloud show X
- Verify that the region_name field is not displayed.
- Run dcmanager subcloud show X --detail
- Verify that the region_name field is displayed with that format.
PASS - Get a 22.12 client and connect to a 24.09 System Controller.
- Run dcmanager subcloud show X
- Verify that the region_name field is not displayed.
- Run dcmanager subcloud show X --detail
- Verify that the region_name field is displayed with that format.
Closes-bug: 2083459
Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/931160
Change-Id: I906b3d10bae543c2601745ebba408b5715316112
Signed-off-by: Cristian Mondo <cristian.mondo@windriver.com>
This command handles an exception that can be raised when
running phased deploy enroll command.
Test Plan:
PASS: Force an exception in subcloud_deploy_enroll api call.
Verify that the message "Unable to enroll subcloud" is shown.
Closes-bug: 2082008
Change-Id: I155a6a25d1dec47f9a0e1769f4d81a299f58a6b5
Signed-off-by: Gustavo Pereira <gustavo.lyrapereira@windriver.com>
This commit introduces a new `--remove` parameter to the
`patch-strategy` CLI, enabling users to remove a patch by specifying
the `patch_id`.
Test Plan:
PASS: Verify `dcmanager patch-strategy create` work with and without
--remove.
Failure Path:
PASS: Verify CLI error when --remove is used with --upload-only.
Story: 2010676
Task: 51058
Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/929566
Change-Id: Iaa2d68339a4c76665ec1f5aff9e9673f32bc64ae
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
The default bash completion script generated by cliff replaces spaces
and dashes to underscores, causing it to return incorrect bash
completion for some commands, examples:
'dcmanager subcloud-deploy <tab>' and 'dcmanager subcloud deploy <tab>'
shows the completion for both commands.
'dcmanager subcloud group <tab>' shows the 'subcloud-group' completion,
even though 'subcloud group' with a space is not a valid command.
This commit fixes it by replacing dashes with double underscores to
better distinguish a space from a dash.
Test Plan:
PASS: Type the command "dcmanager subcloud deploy <tab>". Verify
that the command returns valid subcloud deploy options (abort,
bootstrap, complete, config, create, delete, install and resume).
PASS: Type command "dcmanager subcloud-deploy <tab>". Verify
that the command returns only "show" and "upload".
PASS: Type command "dcmanager subcloud group <tab>". Verify
that the command doesn't complete since it's not a valid command.
PASS: Deploy a system controller with the change applied before
bootstrapping it. Verify that the system controller is bootstrapped
correctly.
Closes-bug: 2080278
Change-Id: I2318f2c52e3a6862347d89d684d7bb8f8d21a8c9
Signed-off-by: Gustavo Pereira <gustavo.lyrapereira@windriver.com>
This commit fixes the -h/--help functionality for subcommands.
Previously, using -h/--help with subcommands returned the help message
for the base dcmanager command. Now, it correctly displays the help
output specific to the subcommand, as if you had used 'dcmanager help
<subcommand>'.
Additionally, this commit improves the no-auth verification for help
and bash completion commands, resolving an issue where the help
command for subcommands required authentication.
Test Plan:
1. PASS: Verify that the following commands still display the help
message for the base dcmanager command:
- dcmanager -h/--help
- dcmanager help
2. PASS: Verify that the following commands correctly display the help
message for the subcommand:
- dcmanager subcloud list -h/--help
- dcmanager help subcloud list
3. PASS: Without sourcing openrc, run the help and bash completion
commands and confirm that they display the help message without
requiring authentication.
Closes-Bug: 2078944
Change-Id: I04dbf996f5c3efa570d4ed4841f526cfb15e02ff
Signed-off-by: Gustavo Herzmann <gustavo.herzmann@windriver.com>
This commit addresses a bug that occurs when "dcmanager subcloud show"
is executed with an empty string as the subcloud parameter.
The client formats the request URL as 'f"/subclouds/{subcloud_ref}"',
leading to a call to "/subclouds/" instead of the intended
subcloud-specific URL. This resulted in the API interpreting the request
as a "subcloud list" instead of a "subcloud show".
The fix raises an error when an empty subcloud parameter is provided.
Test Plan:
PASS: Run dcmanager subcloud show command passing "" as subcloud
value. Verify that an error with message "Subcloud cannot be an empty
value" is raised.
PASS: Run dcmanager subcloud error command passing "" as subcloud
value. Verify that an error with message "Subcloud cannot be an empty
value" is raised.
Closes-Bug: 2077422
Change-Id: Ie62e4e23604cceee7beb5dc7c8586404720e5196
Signed-off-by: Gustavo Pereira <gustavo.lyrapereira@windriver.com>
This commit enhances the error messages returned by the API by
printing the explanation and details separately. It also fixes
an issue where an unhandled exception on the server side would
result in the CLI printing "ERROR (app) b''".
Before (unhandled exception):
ERROR (app) b''
After (unhandled exception):
ERROR (app) <explanation>
Before:
ERROR (app) <explanation> <details>
After:
ERROR (app) <explanation>.
Details: <details>
NOTE: Horizon pop-up error messages replace the newline character with
a space, so there are no line breaks. However, it's still correct,
e.g.: <explanation>. Details: <details>
Test Plan:
1. PASS - Insert an unhandled exception on the API side and verify that
the following message is printed in the CLI output:
"The server has either erred or is incapable of performing
the requested operation."
2. PASS - Insert a pecan.abort(500) on the API side and verify that the
following message is printed in the CLI output:
"The server has either erred or is incapable of performing
the requested operation."
3. PASS - Attempt to create a firmware strategy while one already
exists and verify that the output is printed correctly:
"ERROR (app) Unable to process the contained instructions.
Details: Unable to create a strategy of type 'firmware': Bad
strategy request: Strategy of type 'firmware' already
exists."
4. PASS - Using the Horizon web interface, attempt to create a strategy
while one already exists and verify that the message is
displayed correctly.
5. PASS - Force an exception during HTML content parsing and verify
that the raw response content is printed instead:
"
ERROR (app) <html>
<head>
<title>422 Unprocessable Entity</title>
</head>
<body>
<h1>422 Unprocessable Entity</h1>
Unable to process the contained instructions<br /><br />
Unable to create strategy of type 'firmware': Bad
strategy request: Strategy of type: 'firmware'
already exists
</body>
</html>
"
Closes-bug: 2077119
Change-Id: Ia7e4dd2ce77c1a217e17bde05423b2df8ac5c1d5
Signed-off-by: Gustavo Herzmann <gustavo.herzmann@windriver.com>
This commit changes the --patch argument, previously used
for patch file path, to a required positional parameter patch_id.
Note: This also updates the .git-blame-ignore-revs file with
tox configuration and pylint fixes.
Test Plan:
PASS - Create a patch-strategy
- `dcmanager patch-strategy create stx-10.1`
or
- `dcmanager patch-strategy create stx-10.1 --upload-only`
Failure Path:
PASS - Command `dcmanager patch-strategy create` fail
- error: the following arguments are required: patch_id
Depends-on: https://review.opendev.org/c/starlingx/distcloud/+/924879
Story: 2010676
Task: 50014
Change-Id: If6726f0b5e05f4e842ddc6801b225e5a6c129686
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit addresses an intermittent error in the
`test_show_subcloud_with_subcloud_id` test by ensuring
that resources used in the test are created specifically
for the test case.
Test Plan:
- PASS: Run tox command 100+ times
Story: 2011149
Task: 50657
Change-Id: I85b75e0fdf6d5fa48e1c07152ff55ab481f8a440
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
To avoid conflicts with the --release parameter used to
retrieve the software version, this commit changes the sw-deploy
positional parameter to release_id.
TEST PLAN:
PASS - Create a sw-deploy-strategy using <release_id>
Failure Path:
PASS - Create a sw-deploy-strategy without <release_id>
- error: the following arguments are required: release_id
Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/923894
Story: 2010676
Task: 50355
Change-Id: Idbbddd95f4a1f9b2a8af812c5856c4da05c12479
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
The `upgrade-strategy` command is no longer required. Users should
now use `sw-deploy-strategy` to perform upgrade orchestration.
Test Plan:
PASS: Check dcmanager upgrade-strategy commands no longer exists
Story: 2010676
Task: 50396
Change-Id: I0aad22cf7d05081bd64feb464522aa5d40d51885
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit removes the six library from the repo, as
the only supported Python version is 3.9.
Test Plan:
PASS: Success on tox command.
Story: 2011149
Task: 50395
Change-Id: I44942ba91791c3ea541c7642107b48e8b2b2d457
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
Create a Zuul job to check Black Formatter in the code.
This commit also applies the Black formatter to the entire project.
Test Plan
Pass - Success on stx-distcloud-client-tox-black
Pass - Success on tox command
Story: 2011149
Task: 50393
Change-Id: I5d7b537e83931304ffd5f67ce51e8ebb44f7e65b
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
Add --for-sw-deploy and --for-install option to dcmanager prestage
command.
The --for-install option is the default value. In the future we may want
to remove the --for-install switch entirely, as it is superfluous. For
now, we will leave it in - it can either be explicitly used or omitted
entirely.
Test Cases
NOTE: Testing is only complete for the 'dcmanager subcloud prestage'
commands. There has been no testing with any of the prestage
orchestration commands.
PASS:
- Invoke dcmanager prestage with --for-sw-deploy. Ensure
for_sw_deploy=true is added to the payload.
- Invoke dcmanager prestage with --for-install. Ensure
for_install=true is added to the payload.
- Invoke dcmanager prestage with neither option. Ensure
for_install=true is added to the payload.
- Invoke dcmanager prestage with both options. Ensure
the prestage operation is rejected.
Story: 2010676
Task: 50323
Depends-on: https://review.opendev.org/c/starlingx/distcloud/+/921634
Change-Id: I9185a4382d00efa32146412a66b0c89b725f29ad
Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com>
This commit renames the following to be consistent with other
repos:
- Command from `software-deploy-strategy` to `sw-deploy-strategy`
- Strategy from `software` to `sw-deploy`
- Parameter `release-id` to `release`
The `release` parameter is now positional and no longer optional.
Test Plan:
PASS - Perform a software deploy strategy
Story: 2010676
Task: 50355
Depends-on: https://review.opendev.org/c/starlingx/distcloud/+/921520
Change-Id: I6a8aa404286e1809277b8d560aa5665f054e3da2
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit updates the max-line-length of the project to
88 characters to reflect Black formatter default config.
Test Plan:
PASS: tox -e pylint,pep8
Story: 2011149
Task: 50313
Change-Id: Ib9b0265b54f7924417315e764e7dcdd90bcce672
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit introduces the enroll command for subclouds.
Test Plan
PASS: Deploy a system controller and run subcloud add
enroll command with migrate command. Verify that an
error is thrown informing that enroll and migrate
cannot run together.
PASS: Deploy a system controller and run subcloud add
enroll command. Verify that the dcmanager API returns
a success.
PASS: Verify that the dcmanager help subcloud deploy resume
shows the correct help message containing all options.
Story: 2011100
Task: 50006
Depends-on: https://review.opendev.org/c/starlingx/distcloud/+/915928
Change-Id: Icbebdafa746b87cd8b906a9394f161991da9a123
Signed-off-by: Gustavo Pereira <gustavo.lyrapereira@windriver.com>
This commit introduces a new parameter (--patch) to the patch strategy.
This enhancement allows the patch orchestration to execute using a
specific patch file.
Test Pass:
PASS: Fail if use --patch without the patch file
PASS: Get the path to patch file when using --patch
Story: 2010676
Task: 50014
Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/917793
Change-Id: Ibbdf9120946818f344cc4c2c793e216e04ebbb1f
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
The implementation [1] to deprecate commands in dcmanager's client
raised an exception when dcmanager help <command> was executed
which happened to break the dcmanager complete command used during
bootstrap.
This fix solves the issue and adds the deprecation message as a
notice in the relevant commands.
[1]: https://review.opendev.org/c/starlingx/distcloud-client/+/917493
Test plan:
1. PASS: Run dcmanager help <command> displays the relevant
deprecation message
2. PASS: Run dcmanager <command> displays the relevant
deprecation message and does not execute
3. PASS: Run dcmanager complete command
Closes-Bug: 2064677
Change-Id: Icbe6e6f5e8145bb786d4b6aebb804416959cbb67
Signed-off-by: Raphael Lima <Raphael.Lima@windriver.com>
Deprecated commands in dcmanager are not allowed to execute
when requested, but their help was displayed.
In this commit, the dcmanager help <command> is disabled for
subcloud reinstall, subcloud-deploy show, subcloud-deploy upload,
subcloud reconfig and subcloud restore.
Test plan:
1. PASS: Run dcmanager help <command> displays the relevant
deprecation message
2. PASS: Run dcmanager <command> displays the relevant
deprecation message and does not execute
Closes-Bug: 2064294
Change-Id: I2cbe4b79d83b157413fd46337f4437f0a27717f6
Signed-off-by: Raphael Lima <Raphael.Lima@windriver.com>
StarlingX stopped supporting CentOS builds in the after release 7.0.
This update will strip CentOS from our code base. It will also remove
references to the failed OpenSUSE feature as well.
Story: 2011110
Task: 49948
Change-Id: Ib27a001b8ca05a8aef74c703ea9a79cfed92448d
Signed-off-by: Scott Little <scott.little@windriver.com>
Add a minor enhancement to GEO-redundancy. Output an informative message
after running below out-of-sync operations, informing the operator that
a sync command should be executed.
Adding subcloud(s) to the SPG.
Removing subcloud(s) from the SPG.
Updating subcloud(s) in the SPG.
Test plan:
Pre-Steps: 1. Create the system peer from Site A to Site B
2. Create System peer from Site B to Site A
3. Create the subcloud peer group in the Site A
4. Add subcloud(s) to the peer group
5. Create peer group association to associate system peer
and subcloud peer group - Site A
6. Check current sync status on Sites A and B. Verify
they are 'in-sync'.
PASS: Verify that the corresponding informative message is printed out
after running below out-of-sync operations:
1. Adding subcloud to the SPG.
2. Removing subcloud from the SPG.
3. Updating subcloud in the SPG, for example, bootstrap address,
bootstrap values or install values.
PASS: Verify that informative message is not printed when running any
operation on the sublcoud which does not belong to an SPG.
Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/909277
Closes-Bug: 2054124
Change-Id: I1614a719190b2645eb8139b158b0bab257d0f91d
Signed-off-by: lzhu1 <li.zhu@windriver.com>
This commit addresses the issue encountered when updating the
subcloud fields directly with a file introduced by [1]. This
caused issues because the file would be closed, making the content
inaccessible. Now, we update the fields using the file content.
An intermittent error, introduced by [2], was fixed in the
test_prestage_with_subcloud_id test.
[1]: https://review.opendev.org/c/starlingx/distcloud-client/+/909454
[2]: https://review.opendev.org/c/starlingx/distcloud-client/+/909975
Test Plan:
PASS: Create a subcloud
PASS: Update a subcloud
PASS: Create a subcloud backup
PASS: Subcloud deploy create
PASS: Subcloud deploy upload
Closes-bug: 2055446
Change-Id: Ib8b831353dba9d073131eb1c12ccd57513c63e7f
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
Fixed some class names that were in snake_case because
it's not right according to PEP8/PyLint. Now they're all camelCase.
Also, did a direct assignment to client_manager attributes.
Test Plan:
PASS: Run tox command.
- pylint success
- pep8 success
- py39 success
PASS: Check if all commands are working properly.
Closes-bug: 2053023
Change-Id: Iba489e23eb27015f27c6b8d5231f5d6002fa6876
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit enables the `R` (refactor) checkers in `pylint`
configuration. This will help ensure code maintainability
and adherence to best practices.
Black formatter was applied in the modified files.
Test Plan:
PASS: Execute tox command
- pylint success
- py39 success
- pep8 success
Partial-Bug: 2053023
Change-Id: I9946eaee33e4691fc212a852079ba0ca851a6ccd
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
Cleanup the tox configuration and requirements.
Black formatter was applied in the modified files.
Test Plan:
Verify that all Tox tests pass without errors.
1. Successfully executed on the distributedcloud dir
- tox -e docs,releasenotes,api-ref,bandit,linters
- tox -e newnote -- new-note
2. Successfully executed on the distributedcloud/distributedcloud dir
- tox -e py39,pylint,pep8,cover
Partial-Bug: 2053023
Change-Id: Ib25f31f8607e46e51dfbda0a6b3a36e9e11151df
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
In this commit, the dcmanager subcloud show command was updated
to display region_name as default.
Test Plan:
PASS: run dcmanager subcloud show <subcloud name> and verify that
region name is displayed
PASS: run dcmanager subcloud show <subcloud name> -d and verify that
region name is displayed
Closes-bug: 2054803
Change-Id: I4481b34a9406d84c28f0230385eee79b9cc82753
Signed-off-by: Christopher de Oliveira Souza <Christopher.DeOliveiraSouza@windriver.com>
Added a new command: dcmanager software-deploy-strategy to
manage software orchestration. This command requires
a --release-id parameter for specifying the release to deploy.
Test Plan:
1. Verify that command software-deploy-strategy create without
--release-id option fails
2. Verify that command software-deploy-strategy create --release-id
is processed successfully
3. Verify that command software-deploy-strategy show/delete/abort/apply
is processed successfully.
Story: 2010676
Task: 49548
Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/908538
Change-Id: I389bac227833b5f63e19a136d0f13b75f9fb8866
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This reverts commit f7487d291f663a151f1042c9adda211e62abc390.
Reason for revert: This change no longer will be necessary
Change-Id: I4b8b60044b95f6c5f91703274a408f4235df9f15
The prestage release can be either the previous or current release for
a subcloud. Checking the prestage release individually on thousands of
subclouds is impractical. Therefore, a new column called "prestage
versions" is added to the output of the "dcmanager subcloud list'
command. Besides, decoupling prestage status from deploy status.
This commit also introduces the following changes:
- 'backup datetime' column removal and addition of 'prestage status'
column to 'dcmanager subcloud list' output.
- 'dcmanager subcloud show' and similar commands now display 'prestage
status' and 'prestage versions' columns in their output.
- New '-d/--detail' option is added to 'dcmanager subcloud list' to
display all columns of the subclouds.
- '-c/--column' option of 'dcmanager subcloud list' can be used to
specify the column(s) of the subclouds. eg. -c column1 -c column2 ...
Test plan:
PASS: Verify the correct "prestage status" and "prestage versions"
output of the "dcmanager subcloud list" command.
PASS: Verify the correct output of the new arguments -d/--detail and
-c/--column.
Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/904541
Story: 2010611
Task: 49369
Change-Id: I8d127220fcd705dca542afeca2ac8f19f20172a1
Signed-off-by: lzhu1 <li.zhu@windriver.com>
This commit removes "subcloud migrate" command since
"subcloud-peer-group migrate" command can be re-executed to migrate
a single subcloud that failed to migrate in the previous attempt.
Test Plan:
PASS - Verify that "dcmanager subcloud migrate" and "dcmanager help
subcloud migrate" return an error (dcmanager: 'subcloud migrate'
is not a dcmanager command. See 'dcmanager --help'.)
Closes-Bug: 2049336
Change-Id: I793bee7d680d59a4d29a585c88c8c1689976ee1b
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>