Skip to content

Commit

Permalink
Fixed initialization for default inventory value
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalis committed Feb 17, 2017
1 parent f0e294e commit cb1d4fb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/controllers/miq_policy_controller/miq_actions.rb
Expand Up @@ -289,6 +289,7 @@ def action_build_edit_screen
@edit[:cats] = MiqAction.inheritable_cats.sort_by { |c| c.description.downcase }.collect { |c| [c.name, c.description] }

@edit[:ansible_playbooks] = ServiceTemplateAnsiblePlaybook.order(:name).pluck(:name, :id) || {}
@edit[:new][:inventory_type] = 'localhost'
action_build_playbook_variables if @action.action_type == "run_ansible_playbook"

@edit[:current] = copy_hash(@edit[:new])
Expand Down Expand Up @@ -345,7 +346,10 @@ def action_set_record_vars(action)
def action_build_playbook_variables
@edit[:new][:inventory_type] = 'manual' if @edit[:new][:options][:hosts]
@edit[:new][:inventory_type] = 'event_target' if @edit[:new][:options][:use_event_target]
@edit[:new][:inventory_type] ||= 'localhost'
if @edit[:new][:inventory_type].nil? || @edit[:new][:inventory_type].empty?
@edit[:new][:inventory_type] = 'localhost'
@edit[:new][:options][:localhost] = true
end
end

# Check action record variables
Expand Down

0 comments on commit cb1d4fb

Please sign in to comment.