fix: object_handling method for overriding defaults #589
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 is an alternative approach for mitigating issues on passing
None
value to sdk for params which have default values in order to remove an xpath.#587 PR and relevant pan-os-python changes would not be needed if we prefer this approach.
Motivation and Context
We are using default values for
None
provided params for newly created/replaced objects which can cause issue when SDK requires an actualNone
type input to remove an xpath.For example pan-os-python does not accept
'none'
string value for the nexthop type in StaticRoute but it requires nexthop type to beNone
type in order to be removed (in order words set to"None"
in GUI), although it has a default value of'ip-address'
. Normally we expect to use default values from SDK when the param isNone
type but this kind of cases breaks this approach.With the proposed
object_handling()
method, it is possible to override values after defaults are assigned so we can mitigate this kind of issues.Also fixes #584
How Has This Been Tested?
Tested with manually written ansible playbooks.
Types of changes
Checklist