Skip to content

Commit

Permalink
remove additional keys from actions
Browse files Browse the repository at this point in the history
  • Loading branch information
almenscorner committed Mar 25, 2024
1 parent 5046df7 commit 0dad09f
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/IntuneCD/update/Intune/DeviceCompliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def __init__(self, *args, **kwargs):
"root['assignments']",
"root['scheduledActionsForRule']",
"root['deviceComplianceScriptName']",
"root['scheduledActionConfigurations']",
"root['scheduledActionConfigurations'][0]['id']",
"root['assignments']",
"root['scheduledActionsForRule'][0]['scheduledActionConfigurations']",
]
self.params = {
"expand": "scheduledActionsForRule($expand=scheduledActionConfigurations)"
Expand All @@ -42,9 +46,9 @@ def _set_compliance_script_id(self, data: dict) -> dict[str, any]:
},
)
if compliance_script_id.get("value"):
data["deviceCompliancePolicyScript"][
"deviceComplianceScriptId"
] = compliance_script_id["value"][0]["id"]
data["deviceCompliancePolicyScript"]["deviceComplianceScriptId"] = (
compliance_script_id["value"][0]["id"]
)

return data

Expand Down Expand Up @@ -124,9 +128,9 @@ def _get_notification_template_id(self, rule: dict[str, any]) -> dict[str, any]:
0
]["id"]
else:
action[
"notificationTemplateId"
] = "00000000-0000-0000-0000-000000000000"
action["notificationTemplateId"] = (
"00000000-0000-0000-0000-000000000000"
)

action.pop("notificationTemplateName")

Expand Down Expand Up @@ -168,6 +172,12 @@ def main(self) -> dict[str, any]:
for rule in repo_data.get("scheduledActionsForRule"):
self._get_notification_template_id(rule)

for item in intune_data["value"]:
for action in item["scheduledActionsForRule"][0][
"scheduledActionConfigurations"
]:
self.remove_keys(action)

try:
self.process_update(
downstream_data=intune_data["value"],
Expand Down

0 comments on commit 0dad09f

Please sign in to comment.