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

[evm:ansible_runner:seed] Add missing require #18891

Conversation

NickLaMuro
Copy link
Member

This was changed as a part of #18844 but without the explicit require, it fails to run.

Also as a part of this, I deferred the rest of the requires to inside of the method, so we aren't loading them when just initializing the Rake::Application.

Links

Steps for Testing/QA

On master, running bin/rake evm:ansible_runner:seed will fail with the following:

$ bin/rake evm:ansible_runner:seed
rake aborted!
NameError: uninitialized constant Ansible
/var/www/miq/vmdb/lib/tasks/evm_ansible_runner.rake:9:in `block (4 levels) in <top (required)>'
/var/www/miq/vmdb/lib/tasks/evm_ansible_runner.rake:8:in `each'
/var/www/miq/vmdb/lib/tasks/evm_ansible_runner.rake:8:in `block (3 levels) in <top (required)>'
Tasks: TOP => evm:ansible_runner:seed
(See full trace by running task with --trace)
$

With the fix, it works as expected:

$ bin/rake evm:ansible_runner:seed
Seeding roles for ManageIQ::Providers::Lenovo::Engine...
Seeding roles for ManageIQ::Providers::Lenovo::Engine...Complete
Seeding roles for ManageIQ::Providers::Nuage::Engine...
Seeding roles for ManageIQ::Providers::Nuage::Engine...Complete
$

Also defers the rest of the requires to inside of the method, so we
aren't loading them unless they are called on.
Copy link
Member

@carbonin carbonin left a comment

Choose a reason for hiding this comment

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

🤦‍♂️ Thanks @NickLaMuro

@NickLaMuro
Copy link
Member Author

Seems like the 🤦‍♂ emoji gets a lot of use these days 😄

@carbonin
Copy link
Member

@simaishi think this will fix your issue

namespace :evm do
namespace :ansible_runner do
desc "Seed galaxy roles for provider playbooks"
task :seed do
require 'awesome_spawn'
require "vmdb/plugins"
require 'ansible/content'
Copy link
Member Author

Choose a reason for hiding this comment

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

Just to be clear: This is the only line change that is required.

The rest is just my pedantic self getting the best of me...

@miq-bot
Copy link
Member

miq-bot commented Jun 18, 2019

Checked commit NickLaMuro@f14df64 with ruby 2.3.3, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 👍

@carbonin
Copy link
Member

Merging while red because the spec failure is unrelated.

@carbonin carbonin merged commit 239686f into ManageIQ:master Jun 19, 2019
@mfeifer mfeifer added this to the Sprint 114 Ending Jun 24, 2019 milestone Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants