mirror of
https://github.com/linux-system-roles/network.git
synced 2026-07-28 21:40:43 +00:00
Simplify persistent state handling
Since the order of the actions list does not matter anymore because the role iterates over all actions in a defined order, simplify the handling for persistent states.
This commit is contained in:
parent
e0c7d550a9
commit
fb99ae6777
2 changed files with 5 additions and 11 deletions
|
|
@ -1083,10 +1083,6 @@ class ArgValidator_DictConnection(ArgValidatorDict):
|
|||
if not persistent_state:
|
||||
persistent_state = "present"
|
||||
|
||||
# If the profile is present, it should be ensured first
|
||||
if persistent_state == "present":
|
||||
actions.append(persistent_state)
|
||||
|
||||
# If the profile should be absent at the end, it needs to be present in
|
||||
# the meantime to allow to (de)activate it. This is only possible if it
|
||||
# is completely defined, for which `type` needs to be specified.
|
||||
|
|
@ -1094,14 +1090,12 @@ class ArgValidator_DictConnection(ArgValidatorDict):
|
|||
if persistent_state == "absent" and state and result.get("type"):
|
||||
actions.append("present")
|
||||
|
||||
actions.append(persistent_state)
|
||||
|
||||
# Change the runtime state if necessary
|
||||
if state:
|
||||
actions.append(state)
|
||||
|
||||
# Remove the profile in the end if requested
|
||||
if persistent_state == "absent":
|
||||
actions.append(persistent_state)
|
||||
|
||||
result["state"] = state
|
||||
result["persistent_state"] = persistent_state
|
||||
result["actions"] = actions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue