Skip to content
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

Run a control action to order Ansible Playbook Service #13874

Merged
merged 5 commits into from
Feb 28, 2017

Conversation

mkanoor
Copy link
Contributor

@mkanoor mkanoor commented Feb 10, 2017

Order an Ansible Service for control action run_ansible_playbook

@@ -20,6 +20,7 @@ class MiqAction < ApplicationRecord
"set_custom_attribute" => "Set a Custom Attribute in vCenter",
"inherit_parent_tags" => "Inherit Parent Tags",
"remove_tags" => "Remove Tags",
"run_ansible_playbook" => "Run Ansible Playbook",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgalis
I am calling it Run Ansible Playbook for now

@Fryguy Fryguy changed the title WIP: Run a control action to order Ansible Playbook Service [WIP] Run a control action to order Ansible Playbook Service Feb 10, 2017
@miq-bot miq-bot added the wip label Feb 10, 2017
@miq-bot
Copy link
Member

miq-bot commented Feb 16, 2017

This pull request is not mergeable. Please rebase and repush.

@@ -221,6 +222,11 @@ def action_audit(_action, rec, inputs)
:message => "Policy #{msg}: policy: [#{inputs[:policy].description}], event: [#{inputs[:event].description}]")
end

def action_run_ansible_playbook(action, rec, inputs)
service_template = ServiceTemplate.find(action.options[:service_template_id])
Api::ServiceTemplateWorkflow.create(service_template, {}).submit_request
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abellotti Any thoughts on initiating the service request this way?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a lib/services/api/ helper class. right now only used by Api and probably should stay that way. I wonder if that specific logic should be moved to the model and used by Api and from here.

/cc @imtayadeway

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking the same thing. This change would also support a recent request to enable service ordering from an automate methods. https://www.pivotaltracker.com/story/show/140055813

@mkanoor
Copy link
Contributor Author

mkanoor commented Feb 22, 2017

Depends on #13972

@gmcculloug
Copy link
Member

@mkanoor Dependent PR #13972 has been merged.

@imtayadeway
Copy link
Contributor

@mkanoor has any of Api::ServiceTemplateWorkflow been made redundant now because of this PR?

@mkanoor
Copy link
Contributor Author

mkanoor commented Feb 23, 2017

@imtayadeway
I think so, you can use the ServiceTemplate#provision_workflow and on that workflow you can call the submit_request

@mkanoor mkanoor changed the title [WIP] Run a control action to order Ansible Playbook Service Run a control action to order Ansible Playbook Service Feb 23, 2017
@miq-bot miq-bot removed the wip label Feb 23, 2017
@mkanoor
Copy link
Contributor Author

mkanoor commented Feb 23, 2017

@gmcculloug
Please review

end

def target_user(record)
record.respond_to?(:tenant_identity) ? record.tenant_identity : User.find("admin")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should be called tenant_identity and the "admin" condition should be following the pattern from here: https://github.com/ManageIQ/manageiq/blob/master/app/models/mixins/tenant_identity_mixin.rb#L8

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkanoor Any thoughts on this one remaining comment?

@miq-bot
Copy link
Member

miq-bot commented Feb 27, 2017

Checked commits mkanoor/manageiq@386c470~...5a4e3b5 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks good. ⭐

@gmcculloug gmcculloug merged commit 8710eed into ManageIQ:master Feb 28, 2017
@gmcculloug gmcculloug added this to the Sprint 55 Ending Feb 27, 2017 milestone Feb 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants