Skip to content

Commit

Permalink
Merge pull request #14432 from durandom/ansible_refresh_jt_playbook
Browse files Browse the repository at this point in the history
ansible refresh job_template -> playbook connection
(cherry picked from commit e15393a)
  • Loading branch information
blomquisg authored and simaishi committed Apr 6, 2017
1 parent 82a691c commit 6034a20
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def configuration_scripts
inventory_object.survey_spec = job_template.survey_spec_hash
inventory_object.variables = job_template.extra_vars_hash
inventory_object.inventory_root_group = persister.inventory_root_groups.lazy_find(job_template.inventory_id.to_s)
inventory_object.parent = persister.configuration_script_payloads.lazy_find(
:configuration_script_source => job_template.project_id,
:manager_ref => job_template.playbook
)

inventory_object.authentications = []
%w(credential_id cloud_credential_id network_credential_id).each do |credential_attr|
Expand Down
2 changes: 1 addition & 1 deletion app/models/manager_refresh/inventory/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def has_configuration_scripts(options = {})
has_inventory({
:model_class => ::ConfigurationScript,
:manager_ref => [:manager_ref],
:inventory_object_attributes => %i(name description survey_spec variables inventory_root_group authentications),
:inventory_object_attributes => %i(name description survey_spec variables inventory_root_group authentications parent),
}.merge(options))
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/manager_refresh/inventory_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def find(manager_uuid)
when :local_db_find_missing_references
data_index[manager_uuid] || find_in_db(manager_uuid)
else
data_index[manager_uuid]
manager_uuid.kind_of?(Hash) ? find_by(manager_uuid) : data_index[manager_uuid]
end
end

Expand Down
2 changes: 2 additions & 0 deletions spec/support/ansible_shared/automation_manager/refresher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ def assert_configuration_script_with_nil_survey_spec
:variables => {'abc' => 123},
)
expect(expected_configuration_script.inventory_root_group).to have_attributes(:ems_ref => "2")
expect(expected_configuration_script.parent.name).to eq('hello_world.yml')
expect(expected_configuration_script.parent.configuration_script_source.manager_ref).to eq('37')
end

def assert_configuration_script_with_survey_spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def assert_configuration_script_with_nil_survey_spec
:variables => {'abc' => 123},
)
expect(expected_configuration_script.inventory_root_group).to have_attributes(:ems_ref => "2")
expect(expected_configuration_script.parent.name).to eq('language_features/group_commands.yml')
expect(expected_configuration_script.parent.configuration_script_source.manager_ref).to eq('75')
end

def assert_configuration_script_with_survey_spec
Expand Down

0 comments on commit 6034a20

Please sign in to comment.