diff --git a/lib/miq_automation_engine/engine/miq_ae_engine.rb b/lib/miq_automation_engine/engine/miq_ae_engine.rb index 461656f06..fa0957468 100644 --- a/lib/miq_automation_engine/engine/miq_ae_engine.rb +++ b/lib/miq_automation_engine/engine/miq_ae_engine.rb @@ -119,7 +119,7 @@ def self.deliver(*args) if ws.nil? || ws.root.nil? message = "Error delivering #{options[:attrs].inspect} for object [#{object_name}] with state [#{state}] to Automate: Empty Workspace" - _log.error("#{message}") + _log.error(message) return nil end @@ -138,12 +138,12 @@ def self.deliver(*args) options[:ae_state_previous] = YAML.dump(ws.current_state_info) unless ws.current_state_info.empty? message = "Requeuing #{options.inspect} for object [#{object_name}] with state [#{options[:state]}] to Automate for delivery in [#{ae_retry_interval}] seconds" - _log.info("#{message}") + _log.info(message) deliver_queue(options, :deliver_on => deliver_on) else if ae_result.casecmp('error').zero? message = "Error delivering #{options[:attrs].inspect} for object [#{object_name}] with state [#{state}] to Automate: #{ws.root['ae_message']}" - _log.error("#{message}") + _log.error(message) end MiqAeEvent.process_result(ae_result, automate_attrs) if options[:instance_name].to_s.casecmp('EVENT').zero? end @@ -152,7 +152,7 @@ def self.deliver(*args) return ws rescue MiqAeException::Error => err message = "Error delivering #{automate_attrs.inspect} for object [#{object_name}] with state [#{state}] to Automate: #{err.message}" - _log.error("#{message}") + _log.error(message) ensure vmdb_object.after_ae_delivery(ae_result.to_s.downcase) if vmdb_object.respond_to?(:after_ae_delivery) end @@ -212,7 +212,7 @@ def self.create_automation_attribute_name(object) def self.create_automation_attribute_key(object, attr_name = nil) klass_name = create_automation_attribute_class_name(object) - return "#{klass_name}" if automation_attribute_is_array?(klass_name) + return klass_name.to_s if automation_attribute_is_array?(klass_name) attr_name ||= create_automation_attribute_name(object) "#{klass_name}::#{attr_name}" end diff --git a/lib/miq_automation_engine/models/miq_ae_method_yaml.rb b/lib/miq_automation_engine/models/miq_ae_method_yaml.rb index 8a90055e3..5ff0e1a78 100644 --- a/lib/miq_automation_engine/models/miq_ae_method_yaml.rb +++ b/lib/miq_automation_engine/models/miq_ae_method_yaml.rb @@ -10,7 +10,7 @@ def initialize(filename = nil) def define_instance_variables @ae_method_obj['object']['attributes'].each do |k, v| instance_variable_set("@#{k}", v) - singleton_class.class_eval { attr_accessor "#{k}" } + singleton_class.class_eval { attr_accessor k.to_s } send("#{k}=", v) end end diff --git a/lib/miq_automation_engine/service_models/miq_ae_service_methods.rb b/lib/miq_automation_engine/service_models/miq_ae_service_methods.rb index 9a1fab1ea..9803b885f 100644 --- a/lib/miq_automation_engine/service_models/miq_ae_service_methods.rb +++ b/lib/miq_automation_engine/service_models/miq_ae_service_methods.rb @@ -121,7 +121,7 @@ def self.service_now_eccq_insert(server, username, password, agent, queue, topic $log.error hserr.backtrace.join("\n") raise rescue => err - _log.error "#{err}" + _log.error err.to_s $log.error err.backtrace.join("\n") raise end diff --git a/lib/miq_automation_engine/service_models/mixins/miq_ae_service_miq_provision_mixin.rb b/lib/miq_automation_engine/service_models/mixins/miq_ae_service_miq_provision_mixin.rb index a25c36f45..fe0297d3f 100644 --- a/lib/miq_automation_engine/service_models/mixins/miq_ae_service_miq_provision_mixin.rb +++ b/lib/miq_automation_engine/service_models/mixins/miq_ae_service_miq_provision_mixin.rb @@ -57,7 +57,7 @@ def set_dvs(portgroup, switch = portgroup) end def set_vlan(vlan) - set_option(:vlan, ["#{vlan}", "#{vlan}"]) + set_option(:vlan, [vlan.to_s, vlan.to_s]) end def get_folder_paths diff --git a/spec/miq_ae_object_spec.rb b/spec/miq_ae_object_spec.rb index b8e557fe3..9b515fc0a 100644 --- a/spec/miq_ae_object_spec.rb +++ b/spec/miq_ae_object_spec.rb @@ -63,7 +63,7 @@ def value_match(value, xml_value) end it "#process_args_as_attributes with a hash with an object reference" do - result = @miq_obj.process_args_as_attributes("VmOrTemplate::vm" => "#{@vm.id}") + result = @miq_obj.process_args_as_attributes("VmOrTemplate::vm" => @vm.id.to_s) expect(result["vm_id"]).to eq(@vm.id.to_s) expect(result["vm"]).to be_kind_of(MiqAeMethodService::MiqAeServiceVmOrTemplate) end diff --git a/spec/service_methods/miq_ae_service_manageiq-providers-cloud_manager-provision_spec.rb b/spec/service_methods/miq_ae_service_manageiq-providers-cloud_manager-provision_spec.rb index b224af25e..60bd7e90b 100644 --- a/spec/service_methods/miq_ae_service_manageiq-providers-cloud_manager-provision_spec.rb +++ b/spec/service_methods/miq_ae_service_manageiq-providers-cloud_manager-provision_spec.rb @@ -35,7 +35,7 @@ module MiqAeServiceManageIQ_Providers_CloudManager_ProvisionSpec end %w(template clone_to_vm).each do |provision_type| - it "#{provision_type}" do + it provision_type.to_s do @miq_provision.update_attributes(:provision_type => provision_type) expect(ae_svc_prov.target_type).to eq('vm') end