-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function to run playbook on a host #49
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Job. Some changes are required
|
||
Args: | ||
playbook_path (str): Playbook path to run. | ||
path (str): The full path of the file/object to get the facts of. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path (str): The full path of the file/object to get the facts of. | |
playbook_path (str): The full path of the file/object to get the facts of. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 416a12a
except Exception as e: | ||
raise Exception(f"Run playbook fails due to an unexpected error: {e}") | ||
|
||
return runner.rc == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is necessary this return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ok to know if the playbook runs successfully. Why do you think it's not necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if it fails it should raise an Exception, so the return statement does not provide extra information.
IMHO is better to return the runner object instead to gather stdout, stderr, events, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 20f7457
except Exception as e: | ||
raise Exception(f"Run playbook fails due to an unexpected error: {e}") | ||
|
||
return runner.rc == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if it fails it should raise an Exception, so the return statement does not provide extra information.
IMHO is better to return the runner object instead to gather stdout, stderr, events, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Add function to run playbook on a host
Testing
Run:
Windows agent
Linux agent
Manager