Skip to content

Commit

Permalink
add azure_classic_credential, plus spec update
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswnl authored and d-m-u committed Jun 6, 2018
1 parent f782192 commit 8d3ca9c
Show file tree
Hide file tree
Showing 5 changed files with 3,840 additions and 7,845 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class ManageIQ::Providers::AnsibleTower::AutomationManager::AzureClassicCredential < ManageIQ::Providers::AnsibleTower::AutomationManager::CloudCredential
include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::AzureClassicCredential
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This corresponds to Ansible Tower's Azure Resource Manager (azure_rm) type credential. We are not modeling the deprecated Azure classic
# This corresponds to Ansible Tower's Azure Resource Manager (azure_rm) type credential
class ManageIQ::Providers::AnsibleTower::AutomationManager::AzureCredential < ManageIQ::Providers::AnsibleTower::AutomationManager::CloudCredential
include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::AzureCredential
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::AzureClassicCredential
COMMON_ATTRIBUTES = {
:userid => {
:type => :string,
:label => N_('Subscription ID'),
:help_text => N_('The Subscription UUID for the Microsoft Azure Classic account'),
:max_length => 1024,
:required => true
}
}.freeze

EXTRA_ATTRIBUTES = {
:ssh_key_data => {
:type => :password,
:multiline => true,
:label => N_('Management Certificate'),
:help_text => N_('Contents of the PEM file that corresponds to the certificate you uploaded in the Microsoft Azure console'),
:required => true
}
}.freeze

API_ATTRIBUTES = COMMON_ATTRIBUTES.merge(EXTRA_ATTRIBUTES).freeze

API_OPTIONS = {
:type => 'cloud',
:label => N_('Azure Classic (deprecated)'),
:attributes => API_ATTRIBUTES
}.freeze
TOWER_KIND = 'azure'.freeze
end
24 changes: 13 additions & 11 deletions spec/support/ansible_shared/automation_manager/refresher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@
def assert_counts
expect(Provider.count).to eq(1)
expect(automation_manager).to have_attributes(:api_version => "3.0.1")
expect(automation_manager.configured_systems.count).to eq(131)
expect(automation_manager.configuration_scripts.count).to eq(120)
expect(automation_manager.inventory_groups.count).to eq(29)
expect(automation_manager.configuration_script_sources.count).to eq(32)
expect(automation_manager.configuration_script_payloads.count).to eq(2720)
expect(automation_manager.credentials.count).to eq(54)
expect(automation_manager.configured_systems.count).to eq(23)
expect(automation_manager.configuration_scripts.count).to eq(122)
expect(automation_manager.inventory_groups.count).to eq(12)
expect(automation_manager.configuration_script_sources.count).to eq(28)
expect(automation_manager.configuration_script_payloads.count).to eq(2078)
expect(automation_manager.credentials.count).to eq(35)
end

def assert_credentials
Expand Down Expand Up @@ -160,6 +160,8 @@ def assert_credentials
expect(rackspace_cred.type.split('::').last).to eq("RackspaceCredential")
azure_cred = automation_manager.credentials.find_by(:name => 'hello_azure_cred')
expect(azure_cred.type.split('::').last).to eq("AzureCredential")
azure_classic_cred = automation_manager.credentials.find_by(:name => 'hello_azure_classic_cred')
expect(azure_classic_cred.type.split('::').last).to eq("AzureClassicCredential")
satellite6_cred = automation_manager.credentials.find_by(:name => 'hello_sat_cred')
expect(satellite6_cred.type.split('::').last).to eq("Satellite6Credential")
end
Expand All @@ -171,7 +173,7 @@ def assert_playbooks
end

def assert_configuration_script_sources
expect(automation_manager.configuration_script_sources.count).to eq(32)
expect(automation_manager.configuration_script_sources.count).to eq(28)

expect(expected_configuration_script_source).to be_an_instance_of(manager_class::ConfigurationScriptSource)
expect(expected_configuration_script_source).to have_attributes(
Expand All @@ -192,7 +194,7 @@ def assert_configured_system
expect(expected_configured_system).to have_attributes(
:type => manager_class::ConfiguredSystem.name,
:hostname => "hello_vm",
:manager_ref => "251",
:manager_ref => "252",
:virtual_instance_ref => "4233080d-7467-de61-76c9-c8307b6e4830",
)
expect(expected_configured_system.counterpart).to eq(expected_counterpart_vm)
Expand All @@ -203,7 +205,7 @@ def assert_configuration_script_with_nil_survey_spec
expect(expected_configuration_script).to have_attributes(
:name => "hello_template",
:description => "test job",
:manager_ref => "598",
:manager_ref => "604",
:survey_spec => {},
:variables => {},
)
Expand All @@ -217,7 +219,7 @@ def assert_configuration_script_with_survey_spec
expect(system).to have_attributes(
:name => "hello_template_with_survey",
:description => "test job with survey spec",
:manager_ref => "599",
:manager_ref => "605",
:variables => {}
)
survey = system.survey_spec
Expand All @@ -228,7 +230,7 @@ def assert_configuration_script_with_survey_spec
def assert_inventory_root_group
expect(expected_inventory_root_group).to have_attributes(
:name => "hello_inventory",
:ems_ref => "112",
:ems_ref => "115",
:type => "ManageIQ::Providers::AutomationManager::InventoryRootGroup",
)
end
Expand Down
Loading

0 comments on commit 8d3ca9c

Please sign in to comment.