Skip to content

Commit

Permalink
fix: Fixed several attributes and rule reorder logic
Browse files Browse the repository at this point in the history
  • Loading branch information
willguibr committed Apr 30, 2024
1 parent d67cf1e commit d9fe168
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 35 deletions.
6 changes: 3 additions & 3 deletions plugins/modules/zpa_app_protection_custom_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ def core(module):
if key not in fields_to_exclude:
if not deep_equal(current_control.get(key), value):
differences_detected = True
module.warn(
"Difference detected in {key}. Current: {current_control.get(key)}, Desired: {value}"
)
# module.warn(
# "Difference detected in {key}. Current: {current_control.get(key)}, Desired: {value}"
# )

# Validate the desired control values
try:
Expand Down
12 changes: 6 additions & 6 deletions plugins/modules/zpa_application_segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ def core(module):
for key, value in desired_app.items():
if key not in fields_to_exclude and current_app.get(key) != value:
differences_detected = True
module.warn(
f"Difference detected in {key}. Current: {current_app.get(key)}, Desired: {value}"
)
# module.warn(
# f"Difference detected in {key}. Current: {current_app.get(key)}, Desired: {value}"
# )

if existing_app is not None:
id = existing_app.get("id")
Expand Down Expand Up @@ -385,7 +385,7 @@ def core(module):
),
)
)
module.warn("Payload Update for SDK: {}".format(existing_app))
# module.warn("Payload Update for SDK: {}".format(existing_app))
existing_app = client.app_segments.update_segment(
**existing_app
).to_dict()
Expand All @@ -394,7 +394,7 @@ def core(module):
"""No Changes Needed"""
module.exit_json(changed=False, data=existing_app)
else:
module.warn("Creating new rule as no existing rule found")
# module.warn("Creating new rule as no existing rule found")
"""Create"""
app = deleteNone(
dict(
Expand Down Expand Up @@ -423,7 +423,7 @@ def core(module):
udp_port_ranges=convert_ports_list(app.get("udp_port_range", None)),
)
)
module.warn("Payload for SDK: {}".format(app))
# module.warn("Payload for SDK: {}".format(app))
app = client.app_segments.add_segment(**app)
module.exit_json(changed=True, data=app)
elif (
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/zpa_application_segment_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ def core(module):
if key not in fields_to_exclude and current_app.get(key) != value:
differences_detected = True
break
module.warn(
f"Difference detected in {key}. Current: {current_app.get(key)}, Desired: {value}"
)
# module.warn(
# f"Difference detected in {key}. Current: {current_app.get(key)}, Desired: {value}"
# )

if existing_app is not None:
id = existing_app.get("id")
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/zpa_application_segment_pra.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,9 @@ def core(module):
if key not in fields_to_exclude and current_app.get(key) != value:
differences_detected = True
break
module.warn(
f"Difference detected in {key}. Current: {current_app.get(key)}, Desired: {value}"
)
# module.warn(
# f"Difference detected in {key}. Current: {current_app.get(key)}, Desired: {value}"
# )

if existing_app is not None:
id = existing_app.get("id")
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/zpa_policy_access_app_protection_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ def core(module):
for key, value in desired_policy.items():
if key not in fields_to_exclude and current_policy.get(key) != value:
differences_detected = True
module.warn(
f"Difference detected in {key}. Current: {current_policy.get(key)}, Desired: {value}"
)
# module.warn(
# f"Difference detected in {key}. Current: {current_policy.get(key)}, Desired: {value}"
# )

if existing_policy:
desired_order = policy.get("rule_order")
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/zpa_policy_access_forwarding_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ def core(module):
for key, value in desired_policy.items():
if key not in fields_to_exclude and current_policy.get(key) != value:
differences_detected = True
module.warn(
f"Difference detected in {key}. Current: {current_policy.get(key)}, Desired: {value}"
)
# module.warn(
# f"Difference detected in {key}. Current: {current_policy.get(key)}, Desired: {value}"
# )

if existing_policy:
desired_order = policy.get("rule_order")
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/zpa_policy_access_isolation_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ def core(module):
for key, value in desired_policy.items():
if key not in fields_to_exclude and current_policy.get(key) != value:
differences_detected = True
module.warn(
f"Difference detected in {key}. Current: {current_policy.get(key)}, Desired: {value}"
)
# module.warn(
# f"Difference detected in {key}. Current: {current_policy.get(key)}, Desired: {value}"
# )

if existing_policy:
desired_order = policy.get("rule_order")
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/zpa_policy_access_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ def core(module):
for key, value in desired_policy.items():
if key not in fields_to_exclude and current_policy.get(key) != value:
differences_detected = True
module.warn(
f"Difference detected in {key}. Current: {current_policy.get(key)}, Desired: {value}"
)
# module.warn(
# f"Difference detected in {key}. Current: {current_policy.get(key)}, Desired: {value}"
# )

if existing_policy:
desired_order = policy.get("rule_order")
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/zpa_policy_access_timeout_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ def core(module):
for key, value in desired_policy.items():
if key not in fields_to_exclude and current_policy.get(key) != value:
differences_detected = True
module.warn(
f"Difference detected in {key}. Current: {current_policy.get(key)}, Desired: {value}"
)
# module.warn(
# f"Difference detected in {key}. Current: {current_policy.get(key)}, Desired: {value}"
# )

if existing_policy:
desired_order = policy.get("rule_order")
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/zpa_service_edge_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ def core(module):
for key, value in desired_group.items():
if key not in fields_to_exclude and current_group.get(key) != value:
differences_detected = True
module.warn(
f"Difference detected in {key}. Current: {current_group.get(key)}, Desired: {value}"
)
# module.warn(
# f"Difference detected in {key}. Current: {current_group.get(key)}, Desired: {value}"
# )

if existing_group is not None:
id = existing_group.get("id")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/zpa_server_group/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
- name: Verify Server Group is present (again; idempotency check)
ansible.builtin.assert:
that:
- result.changed
- not result.changed

- name: Fetch all Server Groups
zscaler.zpacloud.zpa_server_group_facts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
- name: Ensure Service Edge Group is absent (idempotency check)
ansible.builtin.assert:
that:
- result.changed
- not result.changed

- name: Fetch all Service Edge Groups
zscaler.zpacloud.zpa_service_edge_groups_facts:
Expand Down

0 comments on commit d9fe168

Please sign in to comment.