pyinfra
pyinfra copied to clipboard
Add informations on cli output about module when fact or operation was not found
Hello folks,
If the operation or fact was not found, it will display the ones available, and if no one is available, Warn the user about the possibility that he have a py file or a folder with the same name as the module
If you have a directory wich have the same name as the pyinfra module you want to use, pyinfra will try to look inside form the operations/facts (wich seems to be the wanted behavior)
So I added a message to inform about this possibility if the module/fact is not found:
find . -name incus
./incus
pyinfra inventory.py --debug --limit=lx1 fact incus.IncusProfiles
--> pyinfra error: No such attribute in module incus: IncusProfiles
No facts found. Maybe you have a file or folder named `incus` in the current folder ?
In the same time I added this:
pyinfra inventory.py --debug --limit=lx1 fact incus.IncusProfilesNOEXIST
--> pyinfra error: No such attribute in module incus: IncusProfilesNOEXIST
Available facts in module are: IncusInstances, IncusProfiles, IncusTestFact
This is a suggestion, tell me what you think.
It does not work as expected for operations in case of misspelling