!feature(util/commit_push): Refactor Commit/Push script#54
Open
pimielowski wants to merge 1 commit intomainfrom
Open
!feature(util/commit_push): Refactor Commit/Push script#54pimielowski wants to merge 1 commit intomainfrom
pimielowski wants to merge 1 commit intomainfrom
Conversation
sebastianczech
approved these changes
Nov 20, 2023
| } | ||
|
|
||
| if mode == "lock" { | ||
| log.Printf("Set mode to lock for dg: %s \n", deviceGroup) |
Contributor
There was a problem hiding this comment.
Function deviceLocking is already quite long , so what do you think about extracting whole logic after if mode == "lock" into dedicated function e.g. lockConfig() ?
| } | ||
|
|
||
| if mode == "unlock" { | ||
| dgLocks, _ := panorama.Client.ShowConfigLocks(deviceGroup) |
Contributor
There was a problem hiding this comment.
Similar like previous comment - function deviceLocking is already quite long , so what do you think about extracting whole logic after if mode == "unlock" into dedicated function e.g. unlockConfig()?
| } | ||
|
|
||
| log.Printf("Check for Commit lock for dg: %s", deviceGroup) | ||
| for maxRetries > 0 { |
Contributor
There was a problem hiding this comment.
Maybe we could extract whole part with for maxRetries > 0 into dedicated function e.g. checkCommitLock()?
This file contains hidden or 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
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.
Description
This PR largely improve current commit/push script logic. We introduce new options plus refactor current ones to fit Go standard.
Motivation and Context
We was focused on fixed current code and improve its capabilities. This version of the code deduplicate pieces that we can merge into one function. Also we introduce locking mechanism based on Pango repository PR (PaloAltoNetworks/pango#113 and PaloAltoNetworks/pango#111).
In proposed way we can use this script to lock Panorama config for provided Device Group and do changes in it. This feature can improve usage of the script in the CI/CD and highly automated environment.
For testing purposes you can use forked version with all feature/fixes added to Pango https://github.com/pimielowski/pango
Example usages:
How Has This Been Tested?
We run multiple combination of this script to found any edge cases that we can.
Types of changes
Checklist