Skip to content

Commit

Permalink
Merge pull request #212 from almenscorner/dev
Browse files Browse the repository at this point in the history
v2.3.5
  • Loading branch information
almenscorner authored Sep 2, 2024
2 parents 555bc63 + fb2a280 commit 7fd33c2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 28 deletions.
10 changes: 5 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = IntuneCD
version = 2.3.4
version = 2.3.5
author = Tobias Almén
author_email = [email protected]
description = Tool to backup and update configurations in Intune
Expand All @@ -20,12 +20,12 @@ package_dir =
packages = find:
python_requires = >=3.9
install_requires =
deepdiff>=5.6.0
pyyaml>=6.0
deepdiff==8.0.1
pyyaml>=6.0.2
msrest>=0.6.21
markdown_toclify>=0.1.7
pytablewriter>=0.64.1
msal >= 1.20.0
pytablewriter>=1.2.0
msal>=1.30.0

[options.packages.find]
where = src
Expand Down
9 changes: 3 additions & 6 deletions src/IntuneCD/backup/Intune/Roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def main(self) -> dict[str, any]:
f"{self.endpoint}/beta/deviceManagement/roleAssignments/{assignment['id']}",
)

item["roleAssignments"].append(role_assignment)
item["roleAssignments"].append(role_assignment)

# Get the scopeMembers and resourceScopes ids
scope_member_names = ""
Expand All @@ -103,11 +103,8 @@ def main(self) -> dict[str, any]:
assignment["scopeMembers"] = scope_member_names
assignment.pop("resourceScopes", None)

for assignment in item["roleAssignments"]:
if assignment.get("members"):
member_names = self._get_group_names(
assignment["members"]
)
if assignment.get("members"):
member_names = self._get_group_names(assignment["members"])

assignment["members"] = member_names

Expand Down
16 changes: 10 additions & 6 deletions src/IntuneCD/update/Intune/CustomAttributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,18 @@ def _get_script_file(self, filename: str, repo_data: dict[str, any]) -> str:
if len(fname_id) > 1:
fname_id = fname_id[1].replace(".json", "").replace(".yaml", "")
else:
fname_id = ""
fname_id = None
script_files = os.listdir(self.script_data_path)
script_file = [
x for x in script_files if fname_id in x or repo_data["fileName"] in x
]

if script_file:
if not fname_id:
script_file = [x for x in script_files if repo_data["fileName"] in x]
else:
script_file = [x for x in script_files if fname_id in x]

if len(script_file) == 1:
return script_file[0]

return ""
return None

def _handle_script_diffs(
self, repo_script: str, intune_script: str, repo_data: dict[str, any]
Expand Down Expand Up @@ -102,6 +104,8 @@ def main(self) -> dict[str, any]:
)

for filename in os.listdir(self.path):
self.notify = True
script_data = None
repo_data = self.load_repo_data(filename)
if repo_data:
self.match_info = {
Expand Down
13 changes: 8 additions & 5 deletions src/IntuneCD/update/Intune/PowerShellScripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ def _get_script_file(self, filename: str, repo_data: dict[str, any]) -> str:
if len(fname_id) > 1:
fname_id = fname_id[1].replace(".json", "").replace(".yaml", "")
else:
fname_id = ""
fname_id = None
script_files = os.listdir(self.script_data_path)
script_file = [
x for x in script_files if fname_id in x or repo_data["fileName"] in x
]

if script_file:
if not fname_id:
script_file = [x for x in script_files if repo_data["fileName"] in x]
else:
script_file = [x for x in script_files if fname_id in x]

if len(script_file) == 1:
return script_file[0]

return ""
Expand Down Expand Up @@ -97,6 +99,7 @@ def main(self) -> dict[str, any]:

for filename in os.listdir(self.path):
self.notify = True
script_data = None
repo_data = self.load_repo_data(filename)
if repo_data:
self.match_info = {
Expand Down
16 changes: 10 additions & 6 deletions src/IntuneCD/update/Intune/ShellScripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,18 @@ def _get_script_file(self, filename: str, repo_data: dict[str, any]) -> str:
if len(fname_id) > 1:
fname_id = fname_id[1].replace(".json", "").replace(".yaml", "")
else:
fname_id = ""
fname_id = None
script_files = os.listdir(self.script_data_path)
script_file = [
x for x in script_files if fname_id in x or repo_data["fileName"] in x
]

if script_file:
if not fname_id:
script_file = [x for x in script_files if repo_data["fileName"] in x]
else:
script_file = [x for x in script_files if fname_id in x]

if len(script_file) == 1:
return script_file[0]

return ""
return None

def _handle_script_diffs(
self, repo_script: str, intune_script: str, repo_data: dict[str, any]
Expand Down Expand Up @@ -96,6 +98,8 @@ def main(self) -> dict[str, any]:
)

for filename in os.listdir(self.path):
self.notify = True
script_data = None
repo_data = self.load_repo_data(filename)
if repo_data:
self.match_info = {
Expand Down

0 comments on commit 7fd33c2

Please sign in to comment.