Skip to content

Commit

Permalink
[EmbeddedAnsible::Credential] remove native_ref overwrite
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
mapping to a unique id on the provider side when doing a refresh so
we aren't clobbering existing records, allowing add/update/delete
operations to function properly when doing a refresh.

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` via
the `native_ref` method.

With the change to `EmbeddedAnsible::AutomationManager::Credential`'s
`native_ref` method to include a `Integer` type cast that was 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.  The purpose of this type casting originally was
to enforce a validation that was expected on the Ansible Tower side that
required Integer values when communicating through it's API and
referencing primary keys:

https://github.com/ManageIQ/manageiq-providers-ansible_tower/blob/487b4aef/spec/support/ansible_shared/automation_manager/credential.rb#L8

Since `manager_ref` no longer has value to `EmbeddedAnsible`, as it
isn't tied to a tower instance, we can remove the overwritten form of
this method (with the `Integer` type casting) since it is more trouble
than it is worth, and this method already defaults to just returning a
raw `manager_ref` in the parent classes.

Also, the uses of `native_ref` in our codebase overall are limited:

https://github.com/search?q=org%3AManageIQ+native_ref&type=Code

(10 code locations across the ManageIQ org at the time of writing)
  • Loading branch information
NickLaMuro committed Jun 19, 2019
1 parent dbd6f04 commit 74f8f52
Showing 1 changed file with 0 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@ def self.provider_params(params)
def self.notify_on_provider_interaction?
true
end

def native_ref
Integer(manager_ref)
end
end

0 comments on commit 74f8f52

Please sign in to comment.