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:
@@ -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 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>
|
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:
|
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)
|
||||||
<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.
|
|
||||||
|
|
||||||
# Example:
|
# Example:
|
||||||
|
|
||||||
|
|||||||
@@ -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:
|
def get_os_variants(category: str, os_map: dict) -> set:
|
||||||
"""Extracts all OS names under a given category if it exists."""
|
"""Extracts all OS names under a given category if it exists."""
|
||||||
|
|
||||||
for key, value in os_map.items():
|
for key, value in os_map.items():
|
||||||
if key == category:
|
if key == category:
|
||||||
if isinstance(value, dict): # Expand nested categories
|
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])
|
allowed_os = get_os_variants(target_os, os_categories[key])
|
||||||
break # Stop searching once a match is found
|
break # Stop searching once a match is found
|
||||||
|
|
||||||
|
# Filter out unreachable devices
|
||||||
for device in devices:
|
for device in devices:
|
||||||
if not device["reachable"]:
|
if not device["reachable"]:
|
||||||
continue # Skip unreachable devices.
|
continue # Skip unreachable devices.
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
],
|
],
|
||||||
"Ubuntu": [
|
"Ubuntu": [
|
||||||
"Ubuntu 24.04.1 LTS"
|
"Ubuntu 24.04.1 LTS"
|
||||||
|
],
|
||||||
|
"Ubuntu 22": [
|
||||||
|
"Ubuntu 22.04.1 LTS"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"MacOS": {
|
"MacOS": {
|
||||||
|
|||||||
Reference in New Issue
Block a user