Skip to content

Commit

Permalink
Merge pull request #23217 from agrare/service_template_ansible_playbo…
Browse files Browse the repository at this point in the history
…ok_private_send

Make ServiceTemplateAnsiblePlaybook create_dialogs public
  • Loading branch information
Fryguy authored Oct 3, 2024
2 parents f5bd15c + a580a91 commit 1521858
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app/models/service_template_ansible_playbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def self.create_catalog_item(options, _auth_user)

transaction do
create_from_options(options).tap do |service_template|
dialog_ids = service_template.send(:create_dialogs, config_info)
dialog_ids = service_template.create_dialogs(config_info)
config_info.deep_merge!(dialog_ids)
service_template.options[:config_info].deep_merge!(dialog_ids)
service_template.create_resource_actions(config_info)
Expand Down Expand Up @@ -105,6 +105,15 @@ def retirement_potential?
retirement_jt_exists && services.where(:retired => false).exists?
end

def create_dialogs(config_info)
[:provision, :retirement, :reconfigure].each_with_object({}) do |action, hash|
info = config_info[action]
next unless new_dialog_required?(info)

hash[action] = {:dialog_id => create_new_dialog(info[:new_dialog_name], info[:extra_vars], info[:hosts]).id}
end
end

private

def check_retirement_potential
Expand All @@ -115,15 +124,6 @@ def check_retirement_potential
throw :abort
end

def create_dialogs(config_info)
[:provision, :retirement, :reconfigure].each_with_object({}) do |action, hash|
info = config_info[action]
next unless new_dialog_required?(info)

hash[action] = {:dialog_id => create_new_dialog(info[:new_dialog_name], info[:extra_vars], info[:hosts]).id}
end
end

def new_dialog_required?(info)
info && info.key?(:new_dialog_name) && !info.key?(:dialog_id)
end
Expand Down

0 comments on commit 1521858

Please sign in to comment.