Skip to content

Commit

Permalink
[EmbeddedAnsible seeding] assign "manager_ref" for default cred
Browse files Browse the repository at this point in the history
The `manager_ref` column is used by the authentications table to
reference a external resource id for a given provider.  Not required for
all uses, but generally used by provider authentications so we have a
general idea of what uniq id we are referencing when doing a refresh so
we aren't clobbering existing records, and can add/update/delete
properly when doing so.

With EmbeddedAnsible now not using ansible tower, this is no longer
needed by default, but there are certain places where it is still being
called, like `ServiceTemplateAnsiblePlaybook.build_parameter_list`.

With the change to `EmbeddedAnsible::AutomationManager::Credential`'s
`native_ref` method including a `Integer` type casting being ported over
from the `manageiq-provider-ansible_tower` repo (not part of the
original POC by Jason), this caused errors with `nil` `manager_ref` ids
when trying to create a new `ServiceTemplateAnsiblePlaybook` and using
the default credential.

This fix will just make sure the default credential includes a
`manager_ref` value so `native_ref` will work as it previously had.  We
just use the `manager_id` value since it is "technically" true (though,
in practice, redundant).
  • Loading branch information
NickLaMuro committed Jun 19, 2019
1 parent 239686f commit ad52f70
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/manageiq/providers/embedded_ansible/seeding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def seed
manager.authentications.create_with(
:type => "ManageIQ::Providers::EmbeddedAnsible::AutomationManager::MachineCredential"
).find_or_create_by!(
:name => "#{Vmdb::Appliance.PRODUCT_NAME} Default Credential"
:name => "#{Vmdb::Appliance.PRODUCT_NAME} Default Credential",
:manager_ref => manager.id
)

create_local_playbook_repo
Expand Down

0 comments on commit ad52f70

Please sign in to comment.