Skip to content

Commit

Permalink
Use MiqRegion#role_active? method over private method on Provider
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonin committed May 15, 2017
1 parent 601f965 commit 5e1e9eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
7 changes: 1 addition & 6 deletions app/models/manageiq/providers/embedded_ansible/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ class ManageIQ::Providers::EmbeddedAnsible::Provider < ::Provider
:autosave => true

def self.raw_connect(base_url, username, password, verify_ssl)
return super if role_enabled?
return super if MiqRegion.my_region.role_active?('embedded_ansible')
raise StandardError, 'Embedded ansible is disabled'
end

def self.role_enabled?
MiqServer.all.any? { |x| x.has_active_role?('embedded_ansible') }
end
private_class_method :role_enabled?
end
1 change: 1 addition & 0 deletions spec/support/evm_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def self.vmware_nested_folders(ems)
end

def self.assign_embedded_ansible_role(miq_server = nil)
MiqRegion.seed
miq_server ||= local_miq_server
FactoryGirl.create(:server_role, :name => 'embedded_ansible', :max_concurrent => 0)
miq_server.assign_role('embedded_ansible').update_attributes(:active => true)
Expand Down

0 comments on commit 5e1e9eb

Please sign in to comment.