diff --git a/lib/miq_automation_engine/models/miq_ae_yaml_import.rb b/lib/miq_automation_engine/models/miq_ae_yaml_import.rb index 369ebaa5faf..72a68ee3274 100644 --- a/lib/miq_automation_engine/models/miq_ae_yaml_import.rb +++ b/lib/miq_automation_engine/models/miq_ae_yaml_import.rb @@ -147,7 +147,7 @@ def import_namespace(namespace_folder, domain_obj, domain_name) process_namespace(domain_obj, namespace_folder, load_file(namespace_file), domain_name) end - def process_namespace(domain_obj, namespace_folder, _namespace_yaml, domain_name) + def process_namespace(domain_obj, namespace_folder, namespace_yaml, domain_name) fqname = if @domain_name == '.' "#{domain_name}/#{namespace_folder}" else @@ -157,6 +157,8 @@ def process_namespace(domain_obj, namespace_folder, _namespace_yaml, domain_name namespace_obj = MiqAeNamespace.find_by_fqname(fqname, false) track_stats('namespace', namespace_obj) namespace_obj ||= add_namespace(fqname) unless @preview + attrs = namespace_yaml.fetch_path('object', 'attributes').slice('display_name', 'description') + namespace_obj.update_attributes(attrs) unless @preview if @options['class_name'] import_class(File.join(namespace_folder, "#{@options['class_name']}#{CLASS_DIR_SUFFIX}"), namespace_obj) else diff --git a/spec/lib/miq_automation_engine/models/miq_ae_yaml_import_export_spec.rb b/spec/lib/miq_automation_engine/models/miq_ae_yaml_import_export_spec.rb index d5f47c9fe16..14db1cec7f4 100644 --- a/spec/lib/miq_automation_engine/models/miq_ae_yaml_import_export_spec.rb +++ b/spec/lib/miq_automation_engine/models/miq_ae_yaml_import_export_spec.rb @@ -267,6 +267,14 @@ def add_extra_items_to_customer_domain expect(dom).not_to be_enabled end + it "check attributes in namespace" do + options = {'yaml_file' => @yaml_file} + assert_single_domain_import(options, options) + ns = MiqAeNamespace.find_by(:name => 'customer_namespace_1') + expect(ns.description).to eq("test") + expect(ns.display_name).to eq("test") + end + it "import single system domain" do options = {'yaml_file' => @yaml_file} @customer_domain.update_attributes(:source => MiqAeDomain::SYSTEM_SOURCE) @@ -733,7 +741,7 @@ def create_fields(class_obj, instance_obj, method_obj) def create_factory_data(domain_name, priority, source = MiqAeDomain::USER_SOURCE) domain = FactoryGirl.create(:miq_ae_domain_enabled, :name => domain_name, :source => source, :priority => priority) - n1 = FactoryGirl.create(:miq_ae_namespace, :name => "#{domain_name}_namespace_1", :parent_id => domain.id) + n1 = FactoryGirl.create(:miq_ae_namespace, :name => "#{domain_name}_namespace_1", :parent_id => domain.id, :description => "test", :display_name => "test") n1_c1 = FactoryGirl.create(:miq_ae_class, :name => "#{domain_name}_test_class_1", :namespace_id => n1.id) n1_1 = FactoryGirl.create(:miq_ae_namespace, :name => "#{domain_name}_namespace_1_1", :parent_id => n1.id) n1_1_c1 = FactoryGirl.create(:miq_ae_class, :name => "#{domain_name}_test_class_4", :namespace_id => n1_1.id)