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 params_for_create and verify_credentials #46

Merged

Conversation

agrare
Copy link
Member

@agrare agrare commented Oct 1, 2019

Add a method to return the needed parameters to add a foreman provider
and a method to verify credentials with these parametes.

ManageIQ/manageiq#18818

# }
# }
def self.verify_credentials(args)
raw_connect(*args.dig("endpoints", "default")&.values_at("base_url", "username", "password", "verify_ssl"))
Copy link
Member

Choose a reason for hiding this comment

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

Needs to return boolean.

Copy link
Member

@Fryguy Fryguy Oct 1, 2019

Choose a reason for hiding this comment

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

Also is verify_ssl supposed to be boolean or one of OpenSSL::VERIFY_*?

Copy link
Member

Choose a reason for hiding this comment

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

Also, also...needs to try_decrypt the password. I've noticed in other providers that's done in the raw_connect method itself, which seems like a nicer place since it allows decrypting from other entrypoints as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, was in WIP until I got it to verify the connection not just return it even if everything was wrong.

Addressed all of those PTAL

@agrare agrare force-pushed the add_params_for_create_and_verify_credentials branch from 6faaec1 to c3bf25a Compare October 2, 2019 17:53
@agrare agrare changed the title [WIP] Add params_for_create and verify_credentials Add params_for_create and verify_credentials Oct 2, 2019
@miq-bot miq-bot removed the wip label Oct 2, 2019
@agrare agrare force-pushed the add_params_for_create_and_verify_credentials branch 2 times, most recently from 2e92c5b to 2524116 Compare October 2, 2019 17:59
@@ -25,13 +25,66 @@ class ManageIQ::Providers::Foreman::Provider < ::Provider
validates :name, :presence => true, :uniqueness => true
validates :url, :presence => true

def self.params_for_create
@params_for_create ||= {
:title => "Configure AWS",
Copy link
Member

Choose a reason for hiding this comment

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

Typo AWS

Copy link
Member Author

Choose a reason for hiding this comment

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

🤦‍♂️ thanks, fixed

@agrare agrare force-pushed the add_params_for_create_and_verify_credentials branch from 2524116 to 60ee1cf Compare October 3, 2019 23:09
@@ -25,13 +25,66 @@ class ManageIQ::Providers::Foreman::Provider < ::Provider
validates :name, :presence => true, :uniqueness => true
validates :url, :presence => true

def self.params_for_create
@params_for_create ||= {
:title => "Configure Foreman",
Copy link
Member

Choose a reason for hiding this comment

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

So, downstream we rename this to Satellite via monkey patching the description method, so this needs to use description, I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay there's no description on the provider class so I'll add one, but we'll have to update the downstream monkeypatching to include the provider

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Add a method to return the needed parameters to add a foreman provider
and a method to verify credentials with these parametes.
@agrare agrare force-pushed the add_params_for_create_and_verify_credentials branch from 60ee1cf to 13ed808 Compare October 4, 2019 19:44
@miq-bot
Copy link
Member

miq-bot commented Oct 4, 2019

Checked commit agrare@13ed808 with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
3 files checked, 0 offenses detected
Everything looks fine. ⭐

@Fryguy
Copy link
Member

Fryguy commented Oct 8, 2019

Merging...can you do the downstream patching?

@Fryguy Fryguy merged commit 6f8ec27 into ManageIQ:master Oct 8, 2019
@Fryguy Fryguy added this to the Sprint 122 Ending Oct 14, 2019 milestone Oct 8, 2019
@agrare agrare deleted the add_params_for_create_and_verify_credentials branch October 8, 2019 16:28
@agrare
Copy link
Member Author

agrare commented Oct 8, 2019

Yes will have an MR in shortly

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.

3 participants