Skip to content

Commit a453934

Browse files
authored
Merge pull request grahampugh#96 from autopkg/jcds_mode
expand user for search_dir_path
2 parents c950b0a + f5ba156 commit a453934

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

JamfUploaderProcessors/JamfUploaderLib/JamfUploaderBase.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,12 @@ def get_api_obj_id_from_name(
459459
if r.status_code == 200:
460460
object_list = json.loads(r.output)
461461
self.output(
462-
object_list,
463-
verbose_level=4,
462+
object_list, verbose_level=4,
464463
)
465464
obj_id = 0
466465
for obj in object_list[self.object_list_types(object_type)]:
467466
self.output(
468-
obj,
469-
verbose_level=4,
467+
obj, verbose_level=4,
470468
)
471469
# we need to check for a case-insensitive match
472470
if obj["name"].lower() == object_name.lower():
@@ -502,9 +500,7 @@ def substitute_assignable_keys(self, data, xml_escape=False):
502500
replacement_key = self.env.get(found_key)
503501
data = data.replace(f"%{found_key}%", replacement_key)
504502
else:
505-
self.output(
506-
f"WARNING: '{found_key}' has no replacement object!",
507-
)
503+
self.output(f"WARNING: '{found_key}' has no replacement object!",)
508504
raise ProcessorError("Unsubstitutable key in template found")
509505
return data
510506

@@ -531,7 +527,7 @@ def get_path_to_file(self, filename):
531527
):
532528
self.output(f"Matching dir: {override_dir_path}", verbose_level=3)
533529
matched_override_dir = override_dir_path
534-
for path in Path(d).rglob(filename):
530+
for path in Path(os.path.expanduser(d)).rglob(filename):
535531
matched_filepath = str(path)
536532
break
537533
if matched_filepath:
@@ -555,7 +551,7 @@ def get_path_to_file(self, filename):
555551
):
556552
# matching search dir, look for file in here
557553
self.output(f"Matching dir: {search_dir_path}", verbose_level=3)
558-
for path in Path(d).rglob(filename):
554+
for path in Path(os.path.expanduser(d)).rglob(filename):
559555
matched_filepath = str(path)
560556
break
561557
if matched_filepath:
@@ -579,7 +575,7 @@ def get_path_to_file(self, filename):
579575
):
580576
# matching parent dir, look for file in here
581577
self.output(f"Matching dir: {search_dir_path}", verbose_level=3)
582-
for path in Path(d).rglob(filename):
578+
for path in Path(os.path.expanduser(d)).rglob(filename):
583579
matched_filepath = str(path)
584580
break
585581
if matched_filepath:
@@ -645,9 +641,7 @@ def substitute_limited_assignable_keys(
645641
replacement_key = cli_custom_keys[found_key]
646642
data = data.replace(f"%{found_key}%", replacement_key)
647643
else:
648-
self.output(
649-
f"WARNING: '{found_key}' has no replacement object!",
650-
)
644+
self.output(f"WARNING: '{found_key}' has no replacement object!",)
651645
return data
652646

653647
def pretty_print_xml(self, xml):

0 commit comments

Comments
 (0)