Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EmbeddedAnsible::Credential] use id for manager_ref
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 just assign the `id` value to `manager_ref` on create to give it a unique value that can be used in places where searching by `native_ref` or `manager_ref` is required. 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