Skip to content

Commit

Permalink
fix windowsenrollmentprofile assignment removal
Browse files Browse the repository at this point in the history
  • Loading branch information
almenscorner committed Jun 24, 2024
1 parent 1e6e458 commit f68344e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = IntuneCD
version = 2.3.4.beta1
version = 2.3.4.beta2
author = Tobias Almén
author_email = almenscorner@outlook.com
description = Tool to backup and update configurations in Intune
Expand Down
21 changes: 11 additions & 10 deletions src/IntuneCD/intunecdlib/BaseUpdateModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,16 +387,17 @@ def create_downstream_data(
self.log(msg=f"Created with id: {self.create_request['id']}")

if self.handle_assignment:
self.handle_assignments(
repo_assignments, [], self.assignment_key, self.create_request["id"]
)
if self.handle_iterable_assignment:
self.handle_iterable_assignments(
repo_assignments,
[],
self.assignment_key,
self.create_request["id"],
)
if self.config_type == "Windows Enrollment Profile":
self.handle_iterable_assignments(
repo_assignments,
[],
self.assignment_key,
self.create_request["id"],
)
else:
self.handle_assignments(
repo_assignments, [], self.assignment_key, self.create_request["id"]
)

def get_match_data(self, intune_data: dict, match_info: dict) -> tuple:
"""Gets the matching data
Expand Down
7 changes: 4 additions & 3 deletions src/IntuneCD/update/Intune/WindowsEnrollmentProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ def main(self) -> dict[str, any]:
self.reset_diffs_and_count()

for item in intune_data["value"]:
# Remvoe any assignments before removing the profile
endpoint = f"{self.endpoint}{self.CONFIG_ENDPOINT}{item['id']}{self.assignment_extra_url}"
self.make_graph_request(endpoint, method="delete", status_code=200)
if self.remove:
# Remvoe any assignments before removing the profile
endpoint = f"{self.endpoint}{self.CONFIG_ENDPOINT}{item['id']}{self.assignment_extra_url}"
self.make_graph_request(endpoint, method="delete", status_code=200)
self.remove_downstream_data(self.CONFIG_ENDPOINT, intune_data["value"])

return self.diff_summary

0 comments on commit f68344e

Please sign in to comment.