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

Embedded ansible provider should allow creation in maintenance zone #19947

Merged
merged 3 commits into from
Mar 10, 2020
Merged

Embedded ansible provider should allow creation in maintenance zone #19947

merged 3 commits into from
Mar 10, 2020

Conversation

djberg96
Copy link
Contributor

Currently you cannot create an embedded Ansible provider in the maintenance zone. Instead, this should be legal, though with the automation manager disabled.

You can see the current behavior here:

# RAILS_ENV=test bundle exec rails c
server = FactoryBot.create(:miq_server, :zone => Zone.seed)
provider = FactoryBot.create(:provider_embedded_ansible, :zone => Zone.maintenance_zone)

result: ActiveRecord::RecordInvalid (Validation failed: ManageIQ::Providers::EmbeddedAnsible::Provider: Zone cannot be the maintenance zone when provider is active)

This PR alters the ensure_managers method to allow it, setting the enabled attribute as appropriate.

Based on ManageIQ/manageiq-providers-ansible_tower#211

@djberg96
Copy link
Contributor Author

@miq-bot add_label bug

@djberg96
Copy link
Contributor Author

@miq-bot add_reviewer @bdunne, @agrare

@djberg96
Copy link
Contributor Author

djberg96 commented Mar 10, 2020

@bdunne, @agrare guess I need some help with this one. Thought it was passing locally, now it looks like the zone isn't getting created properly. What's the proper way to set this up?


context "ensure_managers callback" do
before do
EvmSpecHelper.local_miq_server(:is_master => true, :zone => Zone.seed)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think :zone => Zone.seed is what you're looking for here. I think you want to add

MiqRegion.seed
Zone.seed

here before the assign_embedded_ansible_role(miq_server)

@miq-bot
Copy link
Member

miq-bot commented Mar 10, 2020

Checked commits https://github.com/djberg96/manageiq/compare/0e66f9f8490cb957ff8c487a8e8563942cf4b43b~...092e45510da4f602531182c0e56b2b8d0d74f613 with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.20.0, and yamllint
2 files checked, 0 offenses detected
Everything looks fine. 🍰

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.

4 participants