Skip to content

Commit

Permalink
Create ManageIQ::Providers::AnsibleTower::AutomationManager::Credenti…
Browse files Browse the repository at this point in the history
…al and move api_create there
  • Loading branch information
jameswnl committed Feb 8, 2017
1 parent fe4fd78 commit 55427c6
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
class ManageIQ::Providers::AnsibleTower::AutomationManager::CloudCredential < ManageIQ::Providers::AutomationManager::Authentication
class ManageIQ::Providers::AnsibleTower::AutomationManager::CloudCredential < ManageIQ::Providers::AnsibleTower::AutomationManager::Credential
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class ManageIQ::Providers::AnsibleTower::AutomationManager::Credential < ManageIQ::Providers::AutomationManager::Authentication
extend ApiCreate
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ManageIQ::Providers::AnsibleTower::AutomationManager::MachineCredential
class ManageIQ::Providers::AnsibleTower::AutomationManager::Credential
module ApiCreate
def create_in_provider(manager_id, params)
manager = ExtManagementSystem.find(manager_id)
Expand All @@ -15,15 +15,15 @@ def create_in_provider(manager_id, params)

def create_in_provider_queue(manager_id, params)
task_opts = {
:action => "Creating Ansible Tower MachineCredential",
:action => "Creating #{name}",
:userid => "system"
}

manager = ExtManagementSystem.find(manager_id)

queue_opts = {
:args => [manager_id, params],
:class_name => "ManageIQ::Providers::AnsibleTower::AutomationManager::MachineCredential",
:class_name => name,
:method_name => "create_in_provider",
:priority => MiqQueue::HIGH_PRIORITY,
:role => "ems_operations",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
class ManageIQ::Providers::AnsibleTower::AutomationManager::MachineCredential < ManageIQ::Providers::AutomationManager::Authentication
extend ApiCreate
class ManageIQ::Providers::AnsibleTower::AutomationManager::MachineCredential < ManageIQ::Providers::AnsibleTower::AutomationManager::Credential
end
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
class ManageIQ::Providers::AnsibleTower::AutomationManager::NetworkCredential < ManageIQ::Providers::AutomationManager::Authentication
class ManageIQ::Providers::AnsibleTower::AutomationManager::NetworkCredential < ManageIQ::Providers::AnsibleTower::AutomationManager::Credential
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module MiqAeMethodService
class MiqAeServiceManageIQ_Providers_AnsibleTower_AutomationManager_CloudCredential < MiqAeServiceManageIQ_Providers_AutomationManager_Authentication
class MiqAeServiceManageIQ_Providers_AnsibleTower_AutomationManager_CloudCredential < MiqAeServiceManageIQ_Providers_AnsibleTower_AutomationManager_MachineCredential
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module MiqAeMethodService
class MiqAeServiceManageIQ_Providers_AnsibleTower_AutomationManager_Credential < MiqAeServiceManageIQ_Providers_AutomationManager_Authentication
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module MiqAeMethodService
class MiqAeServiceManageIQ_Providers_AnsibleTower_AutomationManager_MachineCredential < MiqAeServiceManageIQ_Providers_AutomationManager_Authentication
class MiqAeServiceManageIQ_Providers_AnsibleTower_AutomationManager_MachineCredential < MiqAeServiceManageIQ_Providers_AnsibleTower_AutomationManager_Credential
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module MiqAeMethodService
class MiqAeServiceManageIQ_Providers_AnsibleTower_AutomationManager_NetworkCredential < MiqAeServiceManageIQ_Providers_AutomationManager_Authentication
class MiqAeServiceManageIQ_Providers_AnsibleTower_AutomationManager_NetworkCredential < MiqAeServiceManageIQ_Providers_AnsibleTower_AutomationManager_MachineCredential
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe MiqAeMethodService::MiqAeServiceManageIQ_Providers_AnsibleTower_AutomationManager_Credential do
it "get the service model class" do
expect { described_class }.not_to raise_error
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'ansible_tower_client'

describe ManageIQ::Providers::AnsibleTower::AutomationManager::MachineCredential do
describe ManageIQ::Providers::AnsibleTower::AutomationManager::Credential do
context "::ApiCreate" do
let(:provider) { FactoryGirl.create(:provider_ansible_tower, :with_authentication) }
let(:manager) { provider.managers.first }
Expand Down Expand Up @@ -34,10 +34,10 @@
it ".create_in_provider_queue" do
EvmSpecHelper.local_miq_server
task_id = described_class.create_in_provider_queue(manager.id, params)
expect(MiqTask.find(task_id)).to have_attributes(:name => "Creating Ansible Tower MachineCredential")
expect(MiqTask.find(task_id)).to have_attributes(:name => "Creating ManageIQ::Providers::AnsibleTower::AutomationManager::Credential")
expect(MiqQueue.first).to have_attributes(
:args => [manager.id, params],
:class_name => "ManageIQ::Providers::AnsibleTower::AutomationManager::MachineCredential",
:class_name => "ManageIQ::Providers::AnsibleTower::AutomationManager::Credential",
:method_name => "create_in_provider",
:priority => MiqQueue::HIGH_PRIORITY,
:role => "ems_operations",
Expand Down

0 comments on commit 55427c6

Please sign in to comment.