Skip to content

Commit

Permalink
Merge pull request #14689 from mkanoor/update_ns_attributes
Browse files Browse the repository at this point in the history
Display name and description not getting updated
  • Loading branch information
gmcculloug authored Apr 7, 2017
2 parents 302e14c + b08f1f6 commit e542416
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/miq_automation_engine/models/miq_ae_yaml_import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e542416

Please sign in to comment.