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

Stop nils from appearing in list of hosts to test OSP ssh keys against #13159

Conversation

mansam
Copy link
Contributor

@mansam mansam commented Dec 13, 2016

This fixes a scenario when validating a new SSH key where Openstack Infra hosts that were powered off would cause validation to throw an exception. The enumeration used to collection hosts was returning nil for powered off hosts instead of excluding them from the list, resulting in an attempt to call verify_credentials against nil.

This fixes the issue described in https://bugzilla.redhat.com/show_bug.cgi?id=1376605

@petrblaho
@tzumainn

@petrblaho
Copy link

@mansam you are right about that nil that can appear. This is bug in that code I wrote :-)

But I am not happy with removing that sorting and slicing by cluster_id. This code caused that only 1 host of each cluster will be tried. In real life scenario it can take a lot of time to try sshing into all powered hosts so we settled with using only 1 host from each cluster. Did this requirement changed, @tzumainn ?

If we settle on using all hosts I am happy to ack this. If we still need to use only 1 host from each cluster I think appending .compact to remove nils should work.

@mansam
Copy link
Contributor Author

mansam commented Dec 15, 2016

@petrblaho Ah, I see. Yes, compact would work as well if that is a requirement to test only one host per cluster.

@tzumainn
Copy link
Contributor

@miq-bot add_label euwe/yes
@miq-bot add_label blocker

@petrblaho
Copy link

Works for me 👍

@tzumainn
Copy link
Contributor

@miq-bot add_label euwe/yes
@miq-bot add_label blocker

@tzumainn
Copy link
Contributor

tzumainn commented Jan 3, 2017

@petrblaho thanks for taking a look! looks good to me as well.

@tzumainn
Copy link
Contributor

tzumainn commented Jan 3, 2017

@miq-bot assign @blomquisg

@miq-bot miq-bot assigned blomquisg and unassigned tzumainn Jan 5, 2017
@blomquisg
Copy link
Member

@mansam can you throw a test together for this? I think I understand what the problem was, but would be nice to see a test validate it.

@mansam mansam force-pushed the fix-openstack-infra-verify_ssh_keypair_credentials branch from dd0b8da to 96c7e28 Compare January 10, 2017 16:36
@mansam
Copy link
Contributor Author

mansam commented Jan 10, 2017

@blomquisg tests added. :)

@miq-bot
Copy link
Member

miq-bot commented Jan 10, 2017

Some comments on commits mansam/manageiq@3c80a31~...96c7e28

spec/models/manageiq/providers/openstack/infra_manager_spec.rb

  • ⚠️ - 21 - Detected allow_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.
  • ⚠️ - 28 - Detected allow_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.
  • ⚠️ - 35 - Detected allow_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.

@miq-bot
Copy link
Member

miq-bot commented Jan 10, 2017

Checked commits mansam/manageiq@3c80a31~...96c7e28 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
2 files checked, 3 offenses detected

spec/models/manageiq/providers/openstack/infra_manager_spec.rb

@petrblaho
Copy link

Code from this PR is included in #13445

@mansam you can close this PR.

@mansam mansam closed this Jan 11, 2017
@mansam
Copy link
Contributor Author

mansam commented Jan 11, 2017

Thanks @petrblaho!

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.

7 participants