Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credential.manager_ref need to be an integer for Tower 3.3 #18155

Merged
merged 2 commits into from
Nov 5, 2018

Conversation

lfu
Copy link
Member

@lfu lfu commented Nov 1, 2018

Follow up of ManageIQ/manageiq-providers-ansible_tower#134.

Change the callers of credential.manager_ref to use native_ref.

Includes ManageIQ/manageiq-providers-ansible_tower#138.
Fix https://bugzilla.redhat.com/show_bug.cgi?id=1640533

@miq-bot assign @gmcculloug
@miq-bot add_label blocker, bug, hammer/yes

let(:auth_one) { FactoryGirl.create(:authentication, :manager_ref => 6) }
let(:auth_two) { FactoryGirl.create(:authentication, :manager_ref => 8) }
let(:auth_one) { FactoryGirl.create(:embedded_ansible_credential, :manager_ref => 6) }
let(:auth_two) { FactoryGirl.create(:embedded_ansible_credential, :manager_ref => 8) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous code was setting manager_ref as an integer, but it be a string to match the column type.

let(:auth_three) { FactoryGirl.create(:authentication, :manager_ref => 14) }
let(:auth_one) { FactoryGirl.create(:embedded_ansible_credential, :manager_ref => 6) }
let(:auth_two) { FactoryGirl.create(:embedded_ansible_credential, :manager_ref => 10) }
let(:auth_three) { FactoryGirl.create(:embedded_ansible_credential, :manager_ref => 14) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, manager_ref always be set to a string. Then native_ref converts to the expected type based on the sub-class.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually funny: in inventory refresh code, we do assign the manager_ref with whatever Tower sends us, which is an integer. But it will be converted to string in db record somehow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should actually update the parser to convert to match the Db column then. Standard graph refresh will do the casting but batch graph refresh will not

:class => "ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ScmCredential"

factory :embedded_ansible_credential,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jameswnl I think all these Authentication factory changes look correct. Could you give it a quick review?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find where :embedded_ansible_credential is defined

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, nvm, it's right here. (was expecting it defined ahead of being used)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you move this up before the beginning of other embedded_ansible*?

:class => "ManageIQ::Providers::AnsibleTower::AutomationManager::NetworkCredential"

factory :ansible_scm_credential,
:parent => :automation_manager_authentication,
:parent => :ansible_credential,
:class => "ManageIQ::Providers::AnsibleTower::AutomationManager::ScmCredential"

factory :embedded_ansible_amazon_credential,
:parent => :automation_manager_authentication,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong :parent here

@miq-bot
Copy link
Member

miq-bot commented Nov 5, 2018

Checked commits lfu/manageiq@026f4f1~...bf62a8c with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
7 files checked, 0 offenses detected
Everything looks fine. 🍪

Copy link
Member

@gmcculloug gmcculloug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. @jameswnl Any other thoughts on this one?

@jameswnl
Copy link
Contributor

jameswnl commented Nov 5, 2018

LGTM

@gmcculloug gmcculloug merged commit 9ac7cfa into ManageIQ:master Nov 5, 2018
@gmcculloug gmcculloug added this to the Sprint 98 Ending Nov 5, 2018 milestone Nov 5, 2018
simaishi pushed a commit that referenced this pull request Nov 5, 2018
Credential.manager_ref need to be an integer for Tower 3.3

(cherry picked from commit 9ac7cfa)

https://bugzilla.redhat.com/show_bug.cgi?id=1640533
@simaishi
Copy link
Contributor

simaishi commented Nov 5, 2018

Hammer backport details:

$ git log -1
commit 2031d474ae4465f2fc9cafbba13e8614e0750cc5
Author: Greg McCullough <gmccullo@redhat.com>
Date:   Mon Nov 5 11:00:25 2018 -0500

    Merge pull request #18155 from lfu/ansible_cred_ref_1640533
    
    Credential.manager_ref need to be an integer for Tower 3.3
    
    (cherry picked from commit 9ac7cfad0cccb0109fdb53f4425e34f4ab7a023b)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1640533

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants