diff --git a/setup.cfg b/setup.cfg index 1a13326..be72711 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = IntuneCD -version = 2.3.0 +version = 2.3.1 author = Tobias Almén author_email = almenscorner@outlook.com description = Tool to backup and update configurations in Intune diff --git a/src/IntuneCD/backup/Intune/Applications.py b/src/IntuneCD/backup/Intune/Applications.py index 99b0b60..9ea3f77 100644 --- a/src/IntuneCD/backup/Intune/Applications.py +++ b/src/IntuneCD/backup/Intune/Applications.py @@ -66,7 +66,8 @@ def main(self) -> dict[str, any]: self.audit_data = self.make_audit_request(self.audit_filter) for app in self.graph_data["value"]: - self.platform_path = "" + platform = None + base_path = self.path app.pop("description", None) scope_tag_data = [v for v in scope_tag_responses if app["id"] == v["id"]] if scope_tag_data: @@ -124,13 +125,14 @@ def generate_app_name(app, app_type, suffix=""): app_name = generate_app_name(app, app_type.split(".")[2]) self.preset_filename = app_name - self.platform_path = f"{self.path}{platform}/" + + self.path = f"{self.path}{platform}/" try: app_results = self.process_data( data=app, filetype=self.filetype, - path=self.platform_path, + path=self.path, name_key="displayName", log_message=self.LOG_MESSAGE, audit_compare_info={"type": "resourceId", "value_key": "id"}, @@ -140,4 +142,6 @@ def generate_app_name(app, app_type, suffix=""): self.log(tag="error", msg=f"Error processing Application data: {e}") return None + self.path = base_path + return self.results diff --git a/src/IntuneCD/backup/Intune/ManagementIntents.py b/src/IntuneCD/backup/Intune/ManagementIntents.py index bd8ff5d..f7bbc7a 100644 --- a/src/IntuneCD/backup/Intune/ManagementIntents.py +++ b/src/IntuneCD/backup/Intune/ManagementIntents.py @@ -65,11 +65,13 @@ def main(self) -> dict[str, any]: intent_responses = self.batch_intents(self.intents_graph_data) for item in intent_responses["value"]: + template_type = None + base_path = self.path for template in self.template_graph_data["value"]: if item["templateId"] == template["id"]: template_type = template["displayName"] - self.type_path = f"{self.path}/{template_type}/" + self.path = f"{self.path}{template_type}/" for setting in item["settingsDelta"]: setting.pop("id", None) @@ -78,7 +80,7 @@ def main(self) -> dict[str, any]: results = self.process_data( data=item, filetype=self.filetype, - path=self.type_path, + path=self.path, name_key="displayName", log_message=self.LOG_MESSAGE, audit_compare_info={"type": "resourceId", "value_key": "id"}, @@ -90,4 +92,6 @@ def main(self) -> dict[str, any]: ) return None + self.path = base_path + return self.results diff --git a/src/IntuneCD/intunecdlib/process_audit_data.py b/src/IntuneCD/intunecdlib/process_audit_data.py index e1c4c5b..cc91075 100644 --- a/src/IntuneCD/intunecdlib/process_audit_data.py +++ b/src/IntuneCD/intunecdlib/process_audit_data.py @@ -171,7 +171,7 @@ def _git_commit_changes(self, audit_record, path, file): self.log( function="_git_commit_changes", tag="error", - msg=f"Commit was not successful, error: {commit.stderr}", + msg=f"Commit was not successful, error: {commit.stderr[:200] or commit.stdout[:200]}", ) def _get_payload_from_audit_data(self, audit_data, compare_data):