-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from jameswnl/creds2
New Tower credential types
- Loading branch information
Showing
20 changed files
with
2,752 additions
and
2,465 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
app/models/manageiq/providers/ansible_tower/automation_manager/azure_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
class ManageIQ::Providers::AnsibleTower::AutomationManager::AzureCredential < | ||
ManageIQ::Providers::AnsibleTower::AutomationManager::CloudCredential | ||
class ManageIQ::Providers::AnsibleTower::AutomationManager::AzureCredential < ManageIQ::Providers::AnsibleTower::AutomationManager::CloudCredential | ||
include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::AzureCredential | ||
end |
1 change: 1 addition & 0 deletions
1
app/models/manageiq/providers/ansible_tower/automation_manager/google_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class ManageIQ::Providers::AnsibleTower::AutomationManager::GoogleCredential < ManageIQ::Providers::AnsibleTower::AutomationManager::CloudCredential | ||
include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::GoogleCredential | ||
end |
1 change: 1 addition & 0 deletions
1
app/models/manageiq/providers/ansible_tower/automation_manager/network_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class ManageIQ::Providers::AnsibleTower::AutomationManager::NetworkCredential < ManageIQ::Providers::AnsibleTower::AutomationManager::Credential | ||
include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::NetworkCredential | ||
end |
1 change: 1 addition & 0 deletions
1
app/models/manageiq/providers/ansible_tower/automation_manager/openstack_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class ManageIQ::Providers::AnsibleTower::AutomationManager::OpenstackCredential < ManageIQ::Providers::AnsibleTower::AutomationManager::CloudCredential | ||
include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::OpenstackCredential | ||
end |
1 change: 1 addition & 0 deletions
1
app/models/manageiq/providers/ansible_tower/automation_manager/rackspace_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class ManageIQ::Providers::AnsibleTower::AutomationManager::RackspaceCredential < ManageIQ::Providers::AnsibleTower::AutomationManager::CloudCredential | ||
include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::RackspaceCredential | ||
end |
1 change: 1 addition & 0 deletions
1
app/models/manageiq/providers/ansible_tower/automation_manager/satellite6_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class ManageIQ::Providers::AnsibleTower::AutomationManager::Satellite6Credential < ManageIQ::Providers::AnsibleTower::AutomationManager::CloudCredential | ||
include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::Satellite6Credential | ||
end |
2 changes: 0 additions & 2 deletions
2
app/models/manageiq/providers/ansible_tower/shared/automation_manager/amazon_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
app/models/manageiq/providers/ansible_tower/shared/automation_manager/azure_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
module ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::AzureCredential | ||
COMMON_ATTRIBUTES = { | ||
:userid => { | ||
:label => N_('Username'), | ||
:help_text => N_('The username to use to connect to the Microsoft Azure account') | ||
}, | ||
:password => { | ||
:type => :password, | ||
:label => N_('Password'), | ||
:help_text => N_('The password to use to connect to the Microsoft Azure account') | ||
} | ||
}.freeze | ||
|
||
EXTRA_ATTRIBUTES = { | ||
:subscription => { | ||
:type => :string, | ||
:label => N_('Subscription ID'), | ||
:help_text => N_('The Subscription UUID for the Microsoft Azure account'), | ||
:max_length => 1024, | ||
:required => true | ||
}, | ||
:tenant => { | ||
:type => :string, | ||
:label => N_('Tenant ID'), | ||
:help_text => N_('The Tenant ID for the Microsoft Azure account'), | ||
:max_length => 1024 | ||
}, | ||
:secret => { | ||
:type => :password, | ||
:label => N_('Client Secret'), | ||
:help_text => N_('The Client Secret for the Microsoft Azure account'), | ||
:max_length => 1024, | ||
}, | ||
:client => { | ||
:type => :string, | ||
:label => N_('Client ID'), | ||
:help_text => N_('The Client ID for the Microsoft Azure account'), | ||
:max_length => 128 | ||
}, | ||
}.freeze | ||
|
||
API_ATTRIBUTES = COMMON_ATTRIBUTES.merge(EXTRA_ATTRIBUTES).freeze | ||
|
||
API_OPTIONS = { | ||
:type => 'cloud', | ||
:label => N_('Azure'), | ||
:attributes => API_ATTRIBUTES | ||
}.freeze | ||
TOWER_KIND = 'azure_rm'.freeze | ||
end |
35 changes: 35 additions & 0 deletions
35
app/models/manageiq/providers/ansible_tower/shared/automation_manager/google_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::GoogleCredential | ||
COMMON_ATTRIBUTES = { | ||
:userid => { | ||
:type => :email, | ||
:label => N_('Service Account Email Address'), | ||
:help_text => N_('The email address assigned to the Google Compute Engine service account'), | ||
:required => true | ||
} | ||
}.freeze | ||
|
||
EXTRA_ATTRIBUTES = { | ||
:ssh_key_data => { | ||
:type => :password, | ||
:multiline => true, | ||
:label => N_('RSA Private Key'), | ||
:help_text => N_('Contents of the PEM file associated with the service account email'), | ||
:required => true | ||
}, | ||
:project => { | ||
:type => :string, | ||
:label => N_('Project'), | ||
:help_text => N_('The GCE assigned identification. It is constructed as two words followed by a three digit number, such as: squeamish-ossifrage-123'), | ||
:max_length => 100, | ||
} | ||
}.freeze | ||
|
||
API_ATTRIBUTES = COMMON_ATTRIBUTES.merge(EXTRA_ATTRIBUTES).freeze | ||
|
||
API_OPTIONS = { | ||
:type => 'cloud', | ||
:label => N_('Google Compute Engine'), | ||
:attributes => API_ATTRIBUTES | ||
}.freeze | ||
TOWER_KIND = 'gce'.freeze | ||
end |
2 changes: 0 additions & 2 deletions
2
app/models/manageiq/providers/ansible_tower/shared/automation_manager/machine_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
app/models/manageiq/providers/ansible_tower/shared/automation_manager/network_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
module ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::NetworkCredential | ||
COMMON_ATTRIBUTES = { | ||
:userid => { | ||
:label => N_('Username'), | ||
:help_text => N_('Username for this credential'), | ||
:required => true | ||
}, | ||
:password => { | ||
:type => :password, | ||
:label => N_('Password'), | ||
:help_text => N_('Password for this credential'), | ||
:required => true | ||
} | ||
}.freeze | ||
|
||
EXTRA_ATTRIBUTES = { | ||
:authorize => { | ||
:type => :boolean, | ||
:label => N_('Authorize'), | ||
:help_text => N_('Whether to use the authorize mechanism') | ||
}, | ||
:authorize_password => { | ||
:type => :password, | ||
:label => N_('Authorize password'), | ||
:help_text => N_('Password used by the authorize mechanism') | ||
}, | ||
:ssh_key_data => { | ||
:type => :password, | ||
:multiline => true, | ||
:label => N_('SSH key'), | ||
:help_text => N_('RSA or DSA private key to be used instead of password') | ||
}, | ||
:ssh_key_unlock => { | ||
:type => :password, | ||
:label => N_('Private key passphrase'), | ||
:help_text => N_('Passphrase to unlock SSH private key if encrypted'), | ||
:max_length => 1024 | ||
} | ||
}.freeze | ||
|
||
API_ATTRIBUTES = COMMON_ATTRIBUTES.merge(EXTRA_ATTRIBUTES).freeze | ||
|
||
API_OPTIONS = { | ||
:label => N_('network'), | ||
:type => 'network', | ||
:attributes => API_ATTRIBUTES | ||
}.freeze | ||
TOWER_KIND = 'net'.freeze | ||
end |
47 changes: 47 additions & 0 deletions
47
...models/manageiq/providers/ansible_tower/shared/automation_manager/openstack_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::OpenstackCredential | ||
COMMON_ATTRIBUTES = { | ||
:userid => { | ||
:label => N_('Username'), | ||
:help_text => N_('The username to use to connect to OpenStack'), | ||
:required => true | ||
}, | ||
:password => { | ||
:type => :password, | ||
:label => N_('Password (API Key)'), | ||
:help_text => N_('The password or API key to use to connect to OpenStack'), | ||
:required => true | ||
} | ||
}.freeze | ||
|
||
EXTRA_ATTRIBUTES = { | ||
:host => { | ||
:type => :string, | ||
:label => N_('Host (Authentication URL'), | ||
:help_text => N_('The host to authenticate with. For example, https://openstack.business.com/v2.0'), | ||
:max_length => 1024, | ||
:required => true | ||
}, | ||
:project => { | ||
:type => :string, | ||
:label => N_('Project (Tenant Name)'), | ||
:help_text => N_('This is the tenant name. This value is usually the same as the username'), | ||
:max_length => 100, | ||
:required => true | ||
}, | ||
:domain => { | ||
:type => :string, | ||
:label => N_('Domain Name'), | ||
:help_text => N_('OpenStack domains define administrative boundaries. It is only needed for Keystone v3 authentication URLs'), | ||
:max_length => 100 | ||
} | ||
}.freeze | ||
|
||
API_ATTRIBUTES = COMMON_ATTRIBUTES.merge(EXTRA_ATTRIBUTES).freeze | ||
|
||
API_OPTIONS = { | ||
:type => 'cloud', | ||
:label => N_('OpenStack'), | ||
:attributes => API_ATTRIBUTES | ||
}.freeze | ||
TOWER_KIND = 'openstack'.freeze | ||
end |
24 changes: 24 additions & 0 deletions
24
...models/manageiq/providers/ansible_tower/shared/automation_manager/rackspace_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::RackspaceCredential | ||
COMMON_ATTRIBUTES = { | ||
:userid => { | ||
:label => N_('Username'), | ||
:help_text => N_('Username for this credential'), | ||
:required => true | ||
}, | ||
:password => { | ||
:type => :password, | ||
:label => N_('API Key'), | ||
:help_text => N_('API Key for this credential'), | ||
:required => true | ||
} | ||
}.freeze | ||
|
||
API_ATTRIBUTES = COMMON_ATTRIBUTES | ||
|
||
API_OPTIONS = { | ||
:type => 'cloud', | ||
:label => N_('Rackspace'), | ||
:attributes => API_ATTRIBUTES | ||
}.freeze | ||
TOWER_KIND = 'rax'.freeze | ||
end |
34 changes: 34 additions & 0 deletions
34
...odels/manageiq/providers/ansible_tower/shared/automation_manager/satellite6_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::Satellite6Credential | ||
COMMON_ATTRIBUTES = { | ||
:userid => { | ||
:label => N_('Username'), | ||
:help_text => N_('The username to use to connect to Satellite 6'), | ||
:required => true | ||
}, | ||
:password => { | ||
:type => :password, | ||
:label => N_('Password'), | ||
:help_text => N_('The password to use to connect to Satellite 6'), | ||
:required => true | ||
} | ||
}.freeze | ||
|
||
EXTRA_ATTRIBUTES = { | ||
:host => { | ||
:type => :string, | ||
:label => N_('Satellite 6 Host'), | ||
:help_text => N_('Hostname or IP address which corresponds to your Red Hat Satellite 6 server'), | ||
:max_length => 1024, | ||
:required => true | ||
} | ||
}.freeze | ||
|
||
API_ATTRIBUTES = COMMON_ATTRIBUTES.merge(EXTRA_ATTRIBUTES).freeze | ||
|
||
API_OPTIONS = { | ||
:type => 'cloud', | ||
:label => N_('Satellite6'), | ||
:attributes => API_ATTRIBUTES | ||
}.freeze | ||
TOWER_KIND = 'satellite6'.freeze | ||
end |
2 changes: 0 additions & 2 deletions
2
app/models/manageiq/providers/ansible_tower/shared/automation_manager/scm_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
app/models/manageiq/providers/ansible_tower/shared/automation_manager/vmware_credential.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,37 @@ class PopulateTower | |
end | ||
|
||
def create_dataset | ||
|
||
ssh_key_data = <<~HEREDOC | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEowIBAAKCAQEArIIYuT+hC2dhPaSx68zTxsh5OJ3byVLNoX7urk8XU20OjlK4 | ||
7++J7qqkHojXadRZrJI69/BFteqOpLr16fAuTdPnEV1dIolEApT9Gd5sEMb4SFFc | ||
QmZPtOCuFMRjweQBVqAFboUDpzp1Yosjyiw34JWaT8n2SVYjgFB/6SZt9/r/ZHjU | ||
qOnQi/VY1Zp6eWtjW+LpverzCDS7EAv06OLeu9CZtKLNl8DcgcCvCbuONPCsbaSv | ||
FtK8kw4Ev/oJvoYa3RbMphx9dfj8WB0xOcdlDmJLlvqw/iuBX0Ktslm/nADcPcxK | ||
sd37i8Ds2BRVIlr7F3Pblh77TIP+KWzM0lVs1wIDAQABAoIBAAdpj6ZmFYVn68W6 | ||
TerT4kWoV40XO1prNGq8CYVz4Iy1Iur6ovesU0DuFB87wgXKGhBQODhvGo+2hGqP | ||
ngFvUI4HjOYyHM5fF40E2dtCs2IFKqXw2QYBX2tmPBSoW6D5KxWNyq31CTMmT+Ts | ||
FZ2aSMxdoUPMaci86smYq+ZYwGDnVfp2Da5G/GnvdmN+x51mMku5hETBMCOpR+n9 | ||
Z4bYnayVGyLXBJvwhx3pdIprwzAvoiySFjp/tFk+knxiPK84dJ3tIfdtgXmf1Cp9 | ||
pEqDQR3lnvwW0LrBG3c6MiJRlp+Pl3EOZNMLdmsaKODnInwO2U5BNPQuVHPdrObD | ||
1GXxcAECgYEA3xkFdbQ+I6QZH5OSNxPKRPcqcYuYewTwQKmiL3mSoICfV9dRNV3e | ||
ewQpcca7h9dcjTtdyx8PfvCNFR/uh/FhMw+kRXb4bdKDbDrKcQ9x23RFatbsgN14 | ||
q90a6FaEOjOXf0TiTNqP/LTFry1x2r1ZCDLtVcg5zWM/iwUgrO5qOJkCgYEAxfMV | ||
ijLKtBg8Mbdhb2F29vIxMokZS++AhEjWuWl7d/DCApjCXzrfMaHnBC6b4Oppubkp | ||
i40KnkaaDSy03U4hpcSPoPONbv2Fw4o/88ml71DF44D7kXCIFjSMvPLEtU2qLl4z | ||
o4dHUSbtycBzn+wou+IdgPNqNnBYvl/eBNHvBu8CgYBQJ3M4uMtijsCgAasUsr2H | ||
Ta4oIVllSX7wHIIywGEX3V5idu+sVs9qLzKcuCQESDHuZBfstHoix1ZI8rIGkYi0 | ||
ibghZP8Ypful1PGK8Vuc1wdhvVo3alrClKvoMb1ME+EoTp1ns1bsGh60M4Wma0Uj | ||
lviCS2/JBRF9Zxg4SWhMcQKBgQC3PLABv8a4M371HqXJLtWq/sLf3t1V15yF1888 | ||
zxIGEw3kzXeQI7UcAp0Q1/xflV7NF0QH9EWSAhT0gR/jhEHNa0jxWsLfrTs3qTBO | ||
AanjAEhOssUs+phexcJJ3giNNBmG1pjClaVEz95qVgYyUa/bTBK3nZwCTLk5cRDa | ||
MWMsbQKBgCaNkKxH/gZBxVGbnjxbaxTGGq2TxNrKcKWEY4aIybcJ1kM0+UctHPy2 | ||
ixDk3cLUN9/a24A9BI+3GkyuX9LmubW/HqmSErIxnw6fx8OGUsVc/oJxJFbJjXQv | ||
QS4PQZOVkJOn3sZr4hlMMLEKA7NSP9O9BiXCQIycrCDN6YlZ+0/c | ||
-----END RSA PRIVATE KEY----- | ||
HEREDOC | ||
|
||
puts "=== Re-creating Tower objects ===" | ||
# create test organization | ||
uri = '/api/v1/organizations/' | ||
|
@@ -95,13 +126,33 @@ class PopulateTower | |
data = {"name" => "hello_machine_cred", "kind" => "ssh", "username" => "admin", "password" => "abc", "organization" => organization['id']} | ||
machine_credential = create_obj(uri, data) | ||
|
||
# create network cred | ||
data = {"name" => "hello_network_cred", "kind" => "net", "username" => "admin", "password" => "abc", "organization" => organization['id']} | ||
network_credential = create_obj(uri, data) | ||
|
||
# create cloud aws cred | ||
data = {"name" => "hello_aws_cred", "kind" => "aws", "username" => "ABC", "password" => "abc", "organization" => organization['id']} | ||
aws_credential = create_obj(uri, data) | ||
|
||
# create network cred | ||
data = {"name" => "hello_network_cred", "kind" => "net", "username" => "admin", "password" => "abc", "organization" => organization['id']} | ||
network_credential = create_obj(uri, data) | ||
# create cloud openstack cred | ||
data = {"name" => "hello_openstack_cred", "kind" => "openstack", "username" => "hello_rack", "password" => "abc", "host" => "openstack.com", "project" => "hello_rack", "organization" => organization['id']} | ||
_openstack_credential = create_obj(uri, data) | ||
|
||
# create cloud google cred | ||
data = {"name" => "hello_gce_cred", "kind" => "gce", "username" => "[email protected]", "ssh_key_data" => ssh_key_data, "project" => "squeamish-ossifrage-123", "organization" => organization['id']} | ||
_gce_credential = create_obj(uri, data) | ||
|
||
# create cloud rackspace cred | ||
data = {"name" => "hello_rax_cred", "kind" => "rax", "username" => "admin", "password" => "abc", "organization" => organization['id']} | ||
_rax_credential = create_obj(uri, data) | ||
|
||
# create cloud azure(RM) cred | ||
data = {"name" => "hello_azure_cred", "kind" => "azure_rm", "username" => "admin", "password" => "abc", "subscription" => "sub_id", "tenant" => "ten_id", "secret" => "my_secret", "client" => "cli_id", "organization" => organization['id']} | ||
_azure_credential = create_obj(uri, data) | ||
|
||
# create cloud satellite6 cred | ||
data = {"name" => "hello_sat_cred", "kind" => "satellite6", "username" => "admin", "password" => "abc", "host" => "s1.sat.com", "organization" => organization['id']} | ||
_azure_credential = create_obj(uri, data) | ||
|
||
# create inventory | ||
uri = '/api/v1/inventories/' | ||
|
@@ -135,6 +186,7 @@ class PopulateTower | |
self | ||
end | ||
|
||
|
||
def counts | ||
puts "=== Object counts ===" | ||
targets = { | ||
|
Oops, something went wrong.