This repository has been archived by the owner on May 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f61c8cf
commit 28c32a3
Showing
6 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
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
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,7 +1,43 @@ | ||
module AnsibleTowerClient | ||
class Credential < BaseModel | ||
def override_raw_attributes | ||
{ :organization => :organization_id } | ||
{ | ||
:organization => :organization_id, | ||
:credential_type => :credential_type_id, | ||
} | ||
end | ||
|
||
# https://github.com/ansible/awx/blob/1328fb80a02ef4e37bc021eb07d4be041a41f937/awx/main/models/credential/__init__.py#L76-L90 | ||
KIND_CHOICES = { | ||
'ssh' => 'Machine', | ||
'net' => 'Network', | ||
'scm' => 'Source Control', | ||
'aws' => 'Amazon Web Services', | ||
'vmware' => 'VMware vCenter', | ||
'satellite6' => 'Red Hat Satellite 6', | ||
'cloudforms' => 'Red Hat CloudForms', | ||
'gce' => 'Google Compute Engine', | ||
'azure_rm' => 'Microsoft Azure Resource Manager', | ||
'openstack' => 'OpenStack', | ||
'rhv' => 'Red Hat Virtualization', | ||
'insights' => 'Insights', | ||
'tower' => 'Ansible Tower', | ||
}.invert.freeze | ||
|
||
# https://github.com/ansible/awx/blob/1328fb80a02ef4e37bc021eb07d4be041a41f937/awx/main/models/credential/__init__.py#L301 | ||
def kind | ||
@data['kind'] ||= begin | ||
kind = credential_type.kind | ||
kind == 'cloud' && KIND_CHOICES[credential_type.name] || kind | ||
end.to_s | ||
end | ||
|
||
def credential_type | ||
@credential_type ||= api.credential_types.find(credential_type_id) | ||
end | ||
|
||
def vault_password | ||
@data['vault_password'] ||= inputs.vault_password.to_s | ||
end | ||
end | ||
end |
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,4 @@ | ||
module AnsibleTowerClient | ||
class CredentialType < BaseModel | ||
end | ||
end |
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