From f7f5bc1e50816adde65b5bc07e26c0f35e821358 Mon Sep 17 00:00:00 2001 From: Gilbert Cherrie Date: Wed, 21 Aug 2024 15:06:18 -0400 Subject: [PATCH] Fix dialog tag specs --- .byebug_history | 104 ++++++++++++++++++ .../provision_tagging.rb | 2 +- spec/models/dialog_field_tag_control_spec.rb | 2 +- .../provision_tagging_spec.rb | 6 +- 4 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 .byebug_history diff --git a/.byebug_history b/.byebug_history new file mode 100644 index 00000000000..833ac755606 --- /dev/null +++ b/.byebug_history @@ -0,0 +1,104 @@ +c + build_tags_for_provisioning(@edit[:wf], @edit[:new][:vm_tags], true) +@edit[:new][:vm_tags] +@edit[:new][:current_tab_key] +@edit = session[:edit] +@edit[:new][:current_tab_key] +session[:edit][:req_id] +params +session[:edit] +c +fetch_name_from_object(ManageIQ::Providers::ExternalAutomationManager::ConfigurationScript, options[:ansible_template_id]) if options[:ansible_template_id] +record +c +record + if location == "ansible_workflow_template" + ManageIQ::Providers::ExternalAutomationManager::ConfigurationWorkflow.find_by(:id => ansible_template_id)&.manager&.name + else + ManageIQ::Providers::ExternalAutomationManager::ConfigurationScript.find_by(:id => ansible_template_id)&.manager&.name + end +record +ManageIQ::Providers::ExternalAutomationManager::ConfigurationScript.find_by(:id => ansible_template_id)&.manager&.name +fetch_manager_name(options[:ansible_template_id]) +record.name +record +c +options = @record.options +options = record.options +@record +@playbook_details +c +method +method&.options[:ansible_template_id] +c + manager_id = ManageIQ::Providers::ExternalAutomationManager::ConfigurationWorkflow + .find_by(:id => method.options[:ansible_template_id])&.manager_id +ManageIQ::Providers::ExternalAutomationManager::ConfigurationScript + .find_by(:id => method.options[:ansible_template_id]) +ManageIQ::Providers::ExternalAutomationManager::ConfigurationScript + .find_by(:id => method.options[:ansible_template_id])&.manager_id +method +c +MiqAeMethod.find(params[:id]) +method = MiqAeMethod.find(params[:id]) +method +MiqAeMethod.find(params[:id]) +method = MiqAeMethod.find(params[:id]) +method +method = MiqAeMethod.find(params[:id]) +MiqAeMethod.find(params[:id]) +params +method +method = MiqAeMethod.find(params[:id]) + method = MiqAeMethod.find(params[:id]) +c +params +c +params +c +params +c +params +c +params +c +params +c +set_playbook_data +params +c +list_of_managers + list_of_managers = [] + ManageIQ::Providers::ExternalAutomationManager.where(:enabled => true).each do |provider| + byebug + list_of_managers.push({:id => provider.id, :name => provider.name}) + end +list_of_managers[2].name +list_of_managers[2] +list_of_managers = ManageIQ::Providers::ExternalAutomationManager + .where(:enabled => true) +ManageIQ::Providers::ExternalAutomationManager + .where(:enabled => true) +c +record.class.method(:name) +record.class.method(:name).source_location +record.class.method(:name) +record.class.method(:name).source_location +record.class.method(:name).source_lication +Record.class.method(:name).source_lication +c +record.name +record +c +@record.name +@record +@record.keys +@record.name +@record +c +@ems +c +@ems +c +@ems +c diff --git a/app/models/service_orchestration/provision_tagging.rb b/app/models/service_orchestration/provision_tagging.rb index 96a17d3bbea..c99062379c6 100644 --- a/app/models/service_orchestration/provision_tagging.rb +++ b/app/models/service_orchestration/provision_tagging.rb @@ -1,5 +1,5 @@ module ServiceOrchestration::ProvisionTagging - DIALOG_TAG_KEY_REGEX = /^Array::dialog_tag_(?\d*)_(?.*)/i + DIALOG_TAG_KEY_REGEX = /^dialog_tag_(?\d*)_(?.*)/i DIALOG_TAG_VALUE_REGEX = /Classification::(\d*)/ private diff --git a/spec/models/dialog_field_tag_control_spec.rb b/spec/models/dialog_field_tag_control_spec.rb index d1b714e2719..475210d08f0 100644 --- a/spec/models/dialog_field_tag_control_spec.rb +++ b/spec/models/dialog_field_tag_control_spec.rb @@ -139,7 +139,7 @@ def add_entry(cat, options) it "automate_output_value with an single value" do tag = Classification.first @df.value = tag.id.to_s - expect(@df.automate_output_value).to eq("#{tag.class.name}::#{tag.id}") + expect(@df.automate_output_value).to eq(["#{tag.class.name}::#{tag.id}"]) end it "automate_output_value with multiple values" do diff --git a/spec/models/service_orchestration/provision_tagging_spec.rb b/spec/models/service_orchestration/provision_tagging_spec.rb index b5d08356cc4..1d022f22d74 100644 --- a/spec/models/service_orchestration/provision_tagging_spec.rb +++ b/spec/models/service_orchestration/provision_tagging_spec.rb @@ -20,9 +20,9 @@ let(:service) { FactoryBot.build(:service_orchestration, :miq_request_task => miq_request_task) } let(:dialog_tag_options) do {:dialog => { - 'Array::dialog_tag_0_env' => 'Classification::1', - 'Array::dialog_tag_1_network' => 'Classification::11', - 'Array::dialog_tag_2_dept' => 'Classification::21,Classification::22,Classification::23' + 'dialog_tag_0_env' => 'Classification::1', + 'dialog_tag_1_network' => 'Classification::11', + 'dialog_tag_2_dept' => 'Classification::21,Classification::22,Classification::23' }} end