Added minor changes (documentation) and indentation for readability.

Readme correct referencing to new docs directory its file.
    couple comments and indentations to improve readability.
    Added a dummy Ubuntu 22 and MacOS categories as an example.
This commit is contained in:
Daan Selen
2025-02-13 12:29:06 +01:00
parent ab1105b058
commit b7b9fdaea7
3 changed files with 8 additions and 7 deletions

View File

@@ -102,14 +102,10 @@ The tasks you want to run should be contained under the `tasks:` with two fields
The name field is for the user of meshbook, to clarify what the following command does in a summary.<br>
The command field actually gets executed on the end-point.<br>
### Granual Operating System control:
### Granual Operating System filtering:
I have made the program so it can have a basic filter with the Operating systems. If you have a mixed group, then you need to match the image below like this:
<img src="./assets/meshcentral_os.png" alt="MeshCentral Operating System Version" width="600"/><br>
<img src="./assets/meshbook_yaml_os.png" alt="MeshBook yaml example" width="600"/>
This will filter the nodes/machines in the MeshCentral group to the ones matching this. Very basic and open for feedback. This must match the full string, not case sensitive.
I have made the program so it can have a filter with the Operating systems. If you have a mixed group, please read:
[This explanation](./docs/operating_system_filtering.md)
# Example:

View File

@@ -101,6 +101,7 @@ async def filter_targets(devices: list[dict], os_categories: dict, target_os: st
def get_os_variants(category: str, os_map: dict) -> set:
"""Extracts all OS names under a given category if it exists."""
for key, value in os_map.items():
if key == category:
if isinstance(value, dict): # Expand nested categories
@@ -124,6 +125,7 @@ async def filter_targets(devices: list[dict], os_categories: dict, target_os: st
allowed_os = get_os_variants(target_os, os_categories[key])
break # Stop searching once a match is found
# Filter out unreachable devices
for device in devices:
if not device["reachable"]:
continue # Skip unreachable devices.

View File

@@ -6,6 +6,9 @@
],
"Ubuntu": [
"Ubuntu 24.04.1 LTS"
],
"Ubuntu 22": [
"Ubuntu 22.04.1 LTS"
]
},
"MacOS": {