The limit on the hostnames should be easily done using globbing, as you suggest. Basically, we need to propragate an optional globbing expression into the storage module's inventory()/_list_inventory() method. For yaml_fs, this glob filter then gets applied/evaluated within the register_fn callback.
To make this reasonably future-proof, I suggest that the filter argument be a dictionary, and glob be a key in the dictionary, such that filter['glob'] gets applied during the os.walk iteration, if defined. There could also be a filter['filelist'] with exact filenames, which then would make os.walk unnecessary.
However, limiting on classes will still require the whole inventory to be loaded and then filtered according to class membership. This is because we do not have a mapping from classes to nodenames until after we scanned the whole inventory. This would have to take place after the storage class returns, i.e. in the CLI or the adapters, via a common filter function probably best defined in reclass/__init__.py.
It is good to not load whole inventory, but only part of it.
Some simple expression to limit hosts/classes to display would help.
For example: reclass -i -c class1,class2 -h "w.*host.domain"
The text was updated successfully, but these errors were encountered: