-
Notifications
You must be signed in to change notification settings - Fork 38
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
dcnm_image_upgrade (ready to merge). #269
Merged
mikewiebe
merged 300 commits into
CiscoDevNet:develop
from
allenrobel:dcnm-image-upgrade
Mar 27, 2024
Merged
dcnm_image_upgrade (ready to merge). #269
mikewiebe
merged 300 commits into
CiscoDevNet:develop
from
allenrobel:dcnm-image-upgrade
Mar 27, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allenrobel
changed the title
Dcnm image upgrade
Dcnm image upgrade (work in progress). Don't merge.
Nov 14, 2023
Run thru black/isort
If have upgrade == "Failed" we should try to upgrade again, else the user would have to use the GUI (or policy management playbook) to reset the upgrade status.
If options.epld.golden is True, then upgrade.nxos must be false or NX-OS throws an error which doesn't appear in any CLI output after the event. So, catch this combination, and fail_json with an explanation.
If method_name is global to a class, the wrong method name is logged if a method calls another method.
Add logging to image_upgrade.py to obtain controller responses for future tests. Remove these later...
epld_module - Accept a module number in str() form and silently convert to int()
ImageUpgrade.nxos_mode: sort valid_nxos_mode so that the match in corresponding unit-test works consistently.
Removing since install_options will fail_json in the event of failure.
Give the user some leeway in setting boolean-like items e.g. instead of True, let the user enter "true" or "TRUE"
This testcase didn't used to be a duplicate, but we changed the code and then changed this testcase without realizing that it's now a duplicate of 00005. Renumber all subsequent testcases to make room for one additional testcase (next commit)
test_image_upgrade_ImageUpgrade.py - Add summary for all tests - Add tests for: - upgrade.nxos invalid value (00018) - upgrade.epld invalid value (00033) - Fix 00015 (options.reboot.config_reload) test description
…operties Removed the following properties which are inherited from ImageUpgradeCommon: - response_data - response - result Add unit tests for: - ImagePolicies._get (two tests) - ImagePolicies.all_policies (two tests) Improve docstrings for existing tests.
RestSend will be used by both dcnm_image_upgrade and dcnm_image_policy in the future, so moving it into module_utils/common for sharing between these modules.
Also fix some debug lines that were too long.
Also: test_image_upgrade_switch_details.py: - Improve test docstrings switch_details.py (SwitchDetails class): - initialize self.path and self.verb in __init__() and use these in refresh()
Also: test_image_upgrade_switch_details.py: Run thru black
Also: ImagePolicyAction._attach_policy: fix KeyError in fail_json message. ImagePolicyAction.query_result: remove checking for value == dict since we don't know 100% what the controller will return. ImagePolicyAction.serial_numbers: enforce list must be at least one element.
We moved initialization of self.path and self.verb to __init__(), which is covered by test_image_upgrade_validate_00001 Hence, we no longer need test_image_upgrade_validate_00021
Also: SwitchDetails.info: self.propertiies should be self.properties test_image_upgrade_switch_details.py: Fix a few docstring typos
test_image_upgrade_stage_00001: add path,verb asserts test_image_upgrade_stage_00071: remove this test case now that it's covered in 00001 above
ImageValidate.commit: Add unit test to verify diff ImageValidate: Improve unit test docstrings image_upgrade_responses_imageStage.json: Fix unit test 00075 key ImageStage.commit: remove self.path and self.verb initializations (these are initialized in __init__() ImageStage.commit: add return value type hint
InstallOptions.policy_name: minor edit to fail_json message. ImageInstallOptions.policy_name: Add unit test test_image_upgrade_image_install_options.py: - rename unit test test_image_upgrade_install_options_00003 to test_image_upgrade_install_options_00070 Run all other test_image_*.py files through black/isort
'include' is deprecated in Ansible roles and is now 'include_tasks'
Also: dcnm_image_upgrade.py: Add a boolean, enable_logging, so that users don't have to comment/uncomment lines to disable/enable logging. Rename image_upgrade_utils.py to utils.py to align with the convention in dcnm_image_policy Modify the match regex in several unit test cases to align with the check_mode changes.
Since dcnm_image_upgrade is the single source of truth (prior to commiting these new modules) for everything in module_utils/common, we need to update a couple files that were enhanced during development of dcnm_image_policy. This commit removes the dependency that rest_send.py had on module_utils/image_upgrade/image_upgrade_task_result, since this file will go away in a future version of this repo. rest_send.py now imports failed_result from module_utils/common/results.py Also: module_utils/params_validate.py : fix a sanity test error with type hinting
This adds an "ok_result" property to results.py Results() class.
This aligns the result output with existing modules. However, it doesn't leverage the Result() class. For expediency's sake, I'll save those changes to a later version of this module since it'll be a larger effort that would require changes to many unit tests.
allenrobel
changed the title
Dcnm image upgrade (ready to merge).
dcnm_image_upgrade (ready to merge).
Mar 24, 2024
mikewiebe
approved these changes
Mar 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adding dcnm_image_upgrade module.
Caveats
package install is not idempotent
Tracking Issue: #260