-
Notifications
You must be signed in to change notification settings - Fork 81
NC | Online Upgrade CLI | Validate expected_version
on upgrade start
#8867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4f243a9
to
92cd6e2
Compare
@shirady |
@romayalon I added a case for throwing an error on the message "config_dir_version on system.json and config_fs.config_dir_version match, nothing to upgrade". In their case in the issue they used RPM |
9c81e8a
to
e5d1d38
Compare
1. Add the function of validate_expected_version that would check that we have the flag of expected_version and it is from the supported versions we allow. Also, add specific errors to the CLI (MissingExpectedVersionFlag and InvalidArgumentType) so that eventually we would not report it as UpgradeFailed. 2. Move functions that are related to versions to versions_utils, and added a helper function is_valid_sematic_version to check the structure of the string. 3. Throw an error instead of the message "config_dir_version on system.json and config_fs.config_dir_version match, nothing to upgrade" and change the tests accordingly. 4. Add the skip_verification to BOOLEAN_STRING_OPTIONS and use it to in validate_expected_version. Signed-off-by: shirady <[email protected]>
Describe the Problem
Currently, we do not validate the value of the argument of
expected_version
in noobaa-cli when usingupgrade start
command.Explain the Changes
validate_expected_version
that would check that we have the flag ofexpected_version
and it is from the supported versions we allow. Also, add specific errors to the CLI (MissingExpectedVersionFlag
andInvalidArgumentType
) so that eventually we would not report it asUpgradeFailed
.versions_utils
, and added a helper functionis_valid_sematic_version
to check the structure of the string.skip_verification
toBOOLEAN_STRING_OPTIONS
and use it to invalidate_expected_version
.Issues: Fixed #8852, Fixed #8851
upgrade start --expected_version <expected_version>
whenexpected_version
is not supported: either lower than expected, or at the same version.Testing Instructions:
Automatic Testing
Please run:
sudo rm -rf /etc/noobaa.conf.d/; sudo npx jest test_cli_upgrade.test
(only in a test environment).sudo npx jest test_nc_upgrade_manager.test.js
Manual Testing
You can recreate the failing flag options, for example:
sudo node src/cmd/manage_nsfs upgrade start #invalid, missing --expected_version
sudo node src/cmd/manage_nsfs upgrade start --expected_version 9 #invalid (number and not string)
sudo node src/cmd/manage_nsfs upgrade start --expected_version bla #invalid not semver structure
sudo node src/cmd/manage_nsfs upgrade start --expected_version '6.18.0' #invalid version (higher)
sudo node src/cmd/manage_nsfs upgrade start --expected_version '4.18.0' #invalid version (lower)
sudo node src/cmd/manage_nsfs upgrade start --expected_version '5.19.0' #nothing to upgrade
, for the following case, we need to havesystem.json
created, therefore before running it please create an account and start the NSFS server: (1) Create an account with the CLI:sudo node src/cmd/manage_nsfs account add --name <account-name> --new_buckets_path /Users/buckets/ --access_key <access-key> --secret_key <secret-key> --uid <uid> --gid <gid>
- before creating the account need to give permission to thenew_buckets_path
:chmod 777 /Users/buckets/
(2) Start the NSFS server with:
sudo node src/cmd/nsfs --debug 5
Doc added/updated
Tests added