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

Add raw_connect? method to ExtManagementSystem #16636

Merged
merged 1 commit into from
Dec 14, 2017

Conversation

jntullo
Copy link

@jntullo jntullo commented Dec 11, 2017

When validating credentials on the queue, existing raw_connect methods return the actual connection, which is then being placed into the logs on callback. It should not be present in the logs. The credential validation only cares about a success or failure, not the connection, so this raw_connect? wrapper method will return a true value on successful validation, rather than the connection itself.

Log Before where you will see #<Aws::EC2::Resource> in the result:

[----] I, [2017-12-11T10:46:29.647721 #56400:3ff011c666f0]  INFO -- : MIQ(MiqTask.generic_action_with_callback) Task: [10000000125494] Queued the action: [Validate EMS Provider Credentials] being run for user: [admin]
[----] I, [2017-12-11T10:46:29.681968 #56450:3fcc1203f9d0]  INFO -- : MIQ(MiqQueue#deliver) Message id: [10000066183441], Delivering...
[----] I, [2017-12-11T10:46:31.450052 #56450:3fcc1203f9d0]  INFO -- : MIQ(MiqQueue#delivered) Message id: [10000066183441], State: [ok], Delivered in [1.768087] seconds
[----] I, [2017-12-11T10:46:31.453199 #56450:3fcc1203f9d0]  INFO -- : MIQ(MiqQueue#m_callback) Message id: [10000066183441], Invoking Callback with args: ["Finished", "ok", "Message delivered successfully", "#<Aws::EC2::Resource>"]
[----] I, [2017-12-11T10:46:32.972244 #56450:3fcc1203f9d0]  INFO -- : MIQ(MiqTask#update_status) Task: [10000000125494] [Finished] [Ok] [Task completed successfully]

Log after where you will only see true:

[----] I, [2017-12-11T12:09:19.744378 #61224:3fce65664554]  INFO -- : MIQ(MiqTask.generic_action_with_callback) Task: [10000000125503] Queued the action: [Validate EMS Provider Credentials] being run for user: [admin]
[----] I, [2017-12-11T12:09:23.710034 #61242:3ff0c203f9d8]  INFO -- : MIQ(MiqQueue#deliver) Message id: [10000066183450], Delivering...
[----] I, [2017-12-11T12:09:26.380073 #61242:3ff0c203f9d8]  INFO -- : MIQ(MiqQueue#delivered) Message id: [10000066183450], State: [ok], Delivered in [2.670068] seconds
[----] I, [2017-12-11T12:09:26.407804 #61242:3ff0c203f9d8]  INFO -- : MIQ(MiqQueue#m_callback) Message id: [10000066183450], Invoking Callback with args: ["Finished", "ok", "Message delivered successfully", "true"]
[----] I, [2017-12-11T12:09:26.478115 #61242:3ff0c203f9d8]  INFO -- : MIQ(MiqTask#update_status) Task: [10000000125503] [Finished] [Ok] [Task completed successfully]

Resolves ManageIQ/manageiq-providers-openstack#174

@miq-bot add_label gaprindashvili/yes, bug
@miq-bot assign @Fryguy
cc: @aufi @Ladas @dikonoor

@aufi
Copy link
Member

aufi commented Dec 11, 2017

From OpenStack provider point of view, LGTM!

@@ -217,6 +217,10 @@ def self.create_discovered_ems(ost)
end
end

def self.raw_connect!(*params)
!!raw_connect(*params)
Copy link
Member

Choose a reason for hiding this comment

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

My only issue is that ! as a suffix usually implies an Exception or side effect could occur. I'm thinking this should be raw_connect? instead, which implies it will return a boolean.

@jntullo jntullo changed the title Add raw_connect! method to ExtManagementSystem Add raw_connect? method to ExtManagementSystem Dec 12, 2017
When validating credentials on the queue, existing raw_connect methods return the actual connection, which is then being placed into the logs on callback. It should not be present in the logs. The credential validation only cares about a success or failure, not the connection, so this raw_connect? wrapper method will return a true value on successful validation, rather than the connection itself.
@miq-bot
Copy link
Member

miq-bot commented Dec 12, 2017

Checked commit jntullo@835b837 with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0
4 files checked, 0 offenses detected
Everything looks fine. 🍰

@bdunne bdunne merged commit 13ce272 into ManageIQ:master Dec 14, 2017
@bdunne bdunne added this to the Sprint 76 Ending Jan 1, 2018 milestone Dec 14, 2017
@bdunne bdunne assigned bdunne and unassigned Fryguy Dec 14, 2017
simaishi pushed a commit that referenced this pull request Dec 14, 2017
Add raw_connect? method to ExtManagementSystem
(cherry picked from commit 13ce272)
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit 4d1e11d5dc9081c6a653c8f0a80456d23cca6109
Author: Brandon Dunne <brandondunne@hotmail.com>
Date:   Thu Dec 14 08:01:02 2017 -0500

    Merge pull request #16636 from jntullo/raw_connect!
    
    Add raw_connect? method to ExtManagementSystem
    (cherry picked from commit 13ce27232cbae46b400f4765fed80fb7e9f7a3dc)

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