Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Tower credential types #9

Merged
merged 12 commits into from
Jul 12, 2017
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
module ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::OpenstackCredential
extend ActiveSupport::Concern
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you are following the pattern in the other credential modules, but why is AS::Concern used here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


COMMON_ATTRIBUTES = {
:userid => {
:label => N_('Username'),
:help_text => N_('Username for this credential'),
:required => true
},
:password => {
:type => :password,
:label => N_('Password (API Key)'),
:help_text => N_('Password for this credential'),
: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