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

Split up the common DDF for infra and cloud #611

Merged
merged 1 commit into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
307 changes: 307 additions & 0 deletions app/models/manageiq/providers/openstack/cloud_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,313 @@ class ManageIQ::Providers::Openstack::CloudManager < ManageIQ::Providers::CloudM
before_update :ensure_managers_zone_and_provider_region
after_save :refresh_parent_infra_manager

def self.params_for_create
@params_for_create ||= {
:fields => [
{
:component => "text-field",
:name => "provider_region",
:label => _("Provider Region"),
},
{
:component => "select-field",
:name => "provider_id",
:label => _("Openstack Infra Provider"),
:isClearable => true,
:options => ManageIQ::Providers::Openstack::Provider.pluck(:name, :id).map do |name, id|
{
:label => name,
:value => id.to_s,
}
end
},
{
:component => "select-field",
:name => "api_version",
:label => _("API Version"),
:initialValue => 'v3',
:isRequired => true,
:validate => [{:type => "required-validator"}],
:options => [
{
:label => 'Keystone V2',
:value => 'v2',
},
{
:label => 'Keystone V3',
:value => 'v3',
},
],
},
{
:component => 'text-field',
:name => 'uid_ems',
:label => _('Domain ID'),
:isRequired => true,
:condition => {
:when => 'api_version',
:is => 'v3',
},
:validate => [{
:type => "required-validator",
:condition => {
:when => 'api_version',
:is => 'v3',
}
}],
},
{
:component => 'switch-field',
:name => 'tenant_mapping_enabled',
:label => _('Tenant Mapping Enabled'),
},
{
:component => 'sub-form',
:name => 'endpoints-subform',
:title => _('Endpoints'),
:fields => [
:component => 'tabs',
:name => 'tabs',
:fields => [
{
:component => 'tab-item',
:name => 'default-tab',
:title => _('Default'),
:fields => [
{
:component => 'validate-provider-credentials',
:name => 'authentications.default.valid',
:skipSubmit => true,
:validationDependencies => %w[name type api_version provider_region keystone_v3_domain_id],
:fields => [
{
:component => "select-field",
:name => "endpoints.default.security_protocol",
:label => _("Security Protocol"),
:isRequired => true,
:validate => [{:type => "required-validator"}],
:options => [
{
:label => _("SSL without validation"),
:value => "ssl-no-validation"
},
{
:label => _("SSL"),
:value => "ssl-with-validation"
},
{
:label => _("Non-SSL"),
:value => "non-ssl"
}
]
},
{
:component => "text-field",
:name => "endpoints.default.hostname",
:label => _("Hostname (or IPv4 or IPv6 address)"),
:isRequired => true,
:validate => [{:type => "required-validator"}],
},
{
:component => "text-field",
:name => "endpoints.default.port",
:label => _("API Port"),
:type => "number",
:initialValue => 13_000,
:isRequired => true,
:validate => [{:type => "required-validator"}],
},
{
:component => "text-field",
:name => "authentications.default.userid",
:label => "Username",
:isRequired => true,
:validate => [{:type => "required-validator"}],
},
{
:component => "password-field",
:name => "authentications.default.password",
:label => "Password",
:type => "password",
:isRequired => true,
:validate => [{:type => "required-validator"}],
},
]
},
]
},
{
:component => 'tab-item',
:name => 'events-tab',
:title => _('Events'),
:fields => [
{
:component => 'protocol-selector',
:name => 'event_stream_selection',
:skipSubmit => true,
:initialValue => 'ceilometer',
:label => _('Type'),
:options => [
{
:label => _('Ceilometer'),
:value => 'ceilometer',
},
{
:label => _('STF'),
:value => 'stf',
:pivot => 'endpoints.stf.hostname',
},
{
:label => _('AMQP'),
:value => 'amqp',
:pivot => 'endpoints.amqp.hostname',
},
],
},
{
:component => 'text-field',
:type => 'hidden',
:name => 'endpoints.ceilometer',
:initialValue => {},
:condition => {
:when => 'event_stream_selection',
:is => 'ceilometer',
},
},
{
:component => 'validate-provider-credentials',
:name => 'endpoints.amqp.valid',
:skipSubmit => true,
:validationDependencies => %w[type event_stream_selection],
:condition => {
:when => 'event_stream_selection',
:is => 'amqp',
},
:fields => [
{
:component => "text-field",
:name => "endpoints.amqp.hostname",
:label => _("Hostname (or IPv4 or IPv6 address)"),
:isRequired => true,
:validate => [{:type => "required-validator"}],
},
{
:component => "text-field",
:name => "endpoints.amqp.port",
:label => _("API Port"),
:type => "number",
:isRequired => true,
:initialValue => 5672,
:validate => [{:type => "required-validator"}],
},
{
:component => "text-field",
:name => "authentications.amqp.userid",
:label => "Username",
:isRequired => true,
:validate => [{:type => "required-validator"}],
},
{
:component => "password-field",
:name => "authentications.amqp.password",
:label => "Password",
:type => "password",
:isRequired => true,
:validate => [{:type => "required-validator"}],
},
],
},
{
:component => 'validate-provider-credentials',
:name => 'endpoints.stf.valid',
:skipSubmit => true,
:validationDependencies => %w[type event_stream_selection],
:condition => {
:when => 'event_stream_selection',
:is => 'stf',
},
:fields => [
{
:component => "select-field",
:name => "endpoints.stf.security_protocol",
:label => _("Security Protocol"),
:isRequired => true,
:validate => [{:type => "required-validator"}],
:options => [
{
:label => _("SSL without validation"),
:value => "ssl-no-validation"
},
{
:label => _("SSL"),
:value => "ssl-with-validation"
},
{
:label => _("Non-SSL"),
:value => "non-ssl"
}
]
},
{
:component => "text-field",
:name => "endpoints.stf.hostname",
:label => _("Hostname (or IPv4 or IPv6 address)"),
:isRequired => true,
:validate => [{:type => "required-validator"}],
},
{
:component => "text-field",
:name => "endpoints.stf.port",
:label => _("API Port"),
:type => "number",
:isRequired => true,
:initialValue => 5666,
:validate => [{:type => "required-validator"}],
},
]
}
],
},
{
:component => 'tab-item',
:name => 'ssh_keypair-tab',
:title => _('RSA key pair'),
:fields => [
:component => 'provider-credentials',
:name => 'endpoints.ssh_keypair.valid',
:fields => [
{
:component => 'text-field',
:type => 'hidden',
:name => 'endpoints.ssh_keypair',
:initialValue => {},
:condition => {
:when => 'authentications.ssh_keypair.userid',
:isNotEmpty => true,
},
},
{
:component => "text-field",
:name => "authentications.ssh_keypair.userid",
:label => _("Username"),
},
{
:component => "password-field",
:name => "authentications.ssh_keypair.auth_key",
:componentClass => 'textarea',
:rows => 10,
:label => _("Private Key"),
},
],
],
},
],
],
},
]
}
end

def hostname_required?
enabled?
end
Expand Down
Loading