-
Notifications
You must be signed in to change notification settings - Fork 5
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
!feature(util/commit_push): Refactor Commit/Push script #54
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job 👍
} | ||
|
||
if mode == "lock" { | ||
log.Printf("Set mode to lock for dg: %s \n", deviceGroup) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could extract whole part with for maxRetries > 0
into dedicated function e.g. checkCommitLock()
?
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