chore: fix apparent missing reference
This commit is contained in:
+1
-1
@@ -189,7 +189,7 @@ async def main():
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
group_list = await Transform.compile_group_list(session)
|
group_list = await Transform.compile_group_list(session)
|
||||||
compiled_device_list = await Utilities.gather_targets(args, meshbook, group_list, os_categories)
|
compiled_device_list = await Utilities.gather_targets(args.silent, meshbook, group_list, os_categories)
|
||||||
|
|
||||||
# Check if we have reachable targets on the MeshCentral host
|
# Check if we have reachable targets on the MeshCentral host
|
||||||
if "target_list" not in compiled_device_list or len(compiled_device_list["target_list"]) == 0:
|
if "target_list" not in compiled_device_list or len(compiled_device_list["target_list"]) == 0:
|
||||||
|
|||||||
+30
-28
@@ -6,6 +6,8 @@ import os
|
|||||||
import shlex
|
import shlex
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from modules.console import Console
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Creation and compilation of the MeshCentral nodes list (list of all nodes available to the user in the configuration) is handled in the following section.
|
Creation and compilation of the MeshCentral nodes list (list of all nodes available to the user in the configuration) is handled in the following section.
|
||||||
'''
|
'''
|
||||||
@@ -48,7 +50,7 @@ class Utilities:
|
|||||||
return meshbook
|
return meshbook
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def gather_targets(args: argparse.Namespace,
|
async def gather_targets(silent: bool,
|
||||||
meshbook: dict,
|
meshbook: dict,
|
||||||
group_list: dict[str, list[dict]],
|
group_list: dict[str, list[dict]],
|
||||||
os_categories: dict) -> dict:
|
os_categories: dict) -> dict:
|
||||||
@@ -99,19 +101,19 @@ class Utilities:
|
|||||||
await process_group_helper(group_list[pseudo_target])
|
await process_group_helper(group_list[pseudo_target])
|
||||||
|
|
||||||
elif pseudo_target not in group_list:
|
elif pseudo_target not in group_list:
|
||||||
console.nice_print(
|
Console.print_text(
|
||||||
args,
|
silent,
|
||||||
console.text_color.yellow + "Targeted group not found on the MeshCentral server."
|
Console.text_color.yellow + "Targeted group not found on the MeshCentral server."
|
||||||
)
|
)
|
||||||
elif isinstance(pseudo_target, list):
|
elif isinstance(pseudo_target, list):
|
||||||
console.nice_print(
|
Console.print_text(
|
||||||
args,
|
silent,
|
||||||
console.text_color.yellow + "Please use groups (Notice the plural with 'S') for multiple groups."
|
Console.text_color.yellow + "Please use groups (Notice the plural with 'S') for multiple groups."
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
console.nice_print(
|
Console.print_text(
|
||||||
args,
|
silent,
|
||||||
console.text_color.yellow + "The 'group' key is being used, but an unknown data type was found, please check your values."
|
Console.text_color.yellow + "The 'group' key is being used, but an unknown data type was found, please check your values."
|
||||||
)
|
)
|
||||||
|
|
||||||
case {"groups": pseudo_target}:
|
case {"groups": pseudo_target}:
|
||||||
@@ -124,28 +126,28 @@ class Utilities:
|
|||||||
for group in group_list.values():
|
for group in group_list.values():
|
||||||
await process_group_helper(group)
|
await process_group_helper(group)
|
||||||
elif isinstance(pseudo_target, str):
|
elif isinstance(pseudo_target, str):
|
||||||
console.nice_print(
|
Console.print_text(
|
||||||
args,
|
silent,
|
||||||
console.text_color.yellow + "The 'groups' key is being used, but only one string is given. Did you mean 'group'?"
|
Console.text_color.yellow + "The 'groups' key is being used, but only one string is given. Did you mean 'group'?"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
console.nice_print(
|
Console.print_text(
|
||||||
args,
|
silent,
|
||||||
console.text_color.yellow + "The 'groups' key is being used, but an unknown data type was found, please check your values."
|
Console.text_color.yellow + "The 'groups' key is being used, but an unknown data type was found, please check your values."
|
||||||
)
|
)
|
||||||
|
|
||||||
case {"device": pseudo_target}:
|
case {"device": pseudo_target}:
|
||||||
if isinstance(pseudo_target, str):
|
if isinstance(pseudo_target, str):
|
||||||
await process_device_helper(pseudo_target)
|
await process_device_helper(pseudo_target)
|
||||||
elif isinstance(pseudo_target, list):
|
elif isinstance(pseudo_target, list):
|
||||||
console.nice_print(
|
Console.print_text(
|
||||||
args,
|
silent,
|
||||||
console.text_color.yellow + "Please use devices (Notice the plural with 'S') for multiple devices."
|
Console.text_color.yellow + "Please use devices (Notice the plural with 'S') for multiple devices."
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
console.nice_print(
|
Console.print_text(
|
||||||
args,
|
silent,
|
||||||
console.text_color.yellow + "The 'device' key is being used, but an unknown data type was found, please check your values."
|
Console.text_color.yellow + "The 'device' key is being used, but an unknown data type was found, please check your values."
|
||||||
)
|
)
|
||||||
|
|
||||||
case {"devices": pseudo_target}:
|
case {"devices": pseudo_target}:
|
||||||
@@ -153,14 +155,14 @@ class Utilities:
|
|||||||
for sub_device in pseudo_target:
|
for sub_device in pseudo_target:
|
||||||
await process_device_helper(sub_device)
|
await process_device_helper(sub_device)
|
||||||
elif isinstance(pseudo_target, str):
|
elif isinstance(pseudo_target, str):
|
||||||
console.nice_print(
|
Console.print_text(
|
||||||
args,
|
silent,
|
||||||
console.text_color.yellow + "The 'devices' key is being used, but only one string is given. Did you mean 'device'?"
|
Console.text_color.yellow + "The 'devices' key is being used, but only one string is given. Did you mean 'device'?"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
console.nice_print(
|
Console.print_text(
|
||||||
args,
|
silent,
|
||||||
console.text_color.yellow + "The 'devices' key is being used, but an unknown data type was found, please check your values."
|
Console.text_color.yellow + "The 'devices' key is being used, but an unknown data type was found, please check your values."
|
||||||
)
|
)
|
||||||
|
|
||||||
return {"target_list": target_list, "offline_list": offline_list}
|
return {"target_list": target_list, "offline_list": offline_list}
|
||||||
|
|||||||
Reference in New Issue
Block a user