-
Notifications
You must be signed in to change notification settings - Fork 120
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
Order Ansible Playbook from a Custom Button using a Method #113
Conversation
@gmcculloug @tinaafitz |
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.
@mkanoor Looks good.
@mkanoor I can see this quickly expanding to support other resources like hosts and containers. Instead of overloading the We also have the attribute Would it make sense to use the |
@gmcculloug |
I was thinking if someone passed a My point was this method could be used for a custom_button on a vm, host, container or even multi-object in the near future. And the vmdb_object_type already tells us the target object type to go after in the root object. I think this method could be re-usable for different objects types and require less configuration. |
vmdb_object.try(:ipaddresses).try(:first).tap do |ip| | ||
if ip.nil? | ||
@handle.log(:error, "IP address not specified for vmdb_object") | ||
raise "IP address not specified for vmdb_object" |
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.
@mkanoor Is there a reason to log and raise on every error? Since the message is the same is raise not informative enough? If both are needed I would suggest creating a method so we do not have to dup every error string.
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.
@gmcculloug
Yes I think the raise would be good enough since it would show in the Automate log
Checked commits mkanoor/manageiq-content@00f4a46~...552927d with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
Order Ansible Playbook from a Custom Button using a Method (cherry picked from commit 3220db0) https://bugzilla.redhat.com/show_bug.cgi?id=1450485
Fine backport details:
|
https://bugzilla.redhat.com/show_bug.cgi?id=1449361
Allows for using a single dialog that is shared between the Custom Button and the Service Template Ordering.
The Request instance is called Order_Ansible_Playbook
The button needs 2 parameters along with the tie up to the Service Dialog
vmdb_object refers to the context of the current object being selected from the button it could be a host or vm. The method would figure out the object to use at runtime.