Skip to content

Commit

Permalink
Merge "Introduce keystone_url parameter" into stable/havana
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jan 8, 2014
2 parents 47ad268 + b8a0564 commit 39dc4df
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 8 deletions.
26 changes: 20 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@
# the URIDefaults to false. Defaults to false. (no app links)
#
# [*keystone_host*]
# (optional) IP address of the Keystone service. Defaults to '127.0.0.1'.
# (optional) IP address of the Keystone service. Deprecated in favor of keystone_url.
#
# [*keystone_port*]
# (optional) Port of the Keystone service. Defaults to 5000.
# (optional) Port of the Keystone service. Deprecated in favor of keystone_url.
#
# [*keystone_scheme*]
# (optional) Scheme of the Keystone service. Defaults to 'http'.
# (optional) Scheme of the Keystone service. Deprecated in favor of keystone_url.
#
# [*keystone_url*]
# (optional) Full url of keystone public endpoint.
# Defaults to 'http://127.0.0.1:5000/v2.0'.
# Use this parameter in favor of keystone_host, keystone_port and keystone_scheme.
# Set to false to use the deprecated interface.
#
# [*keystone_default_role*]
# (optional) Default Keystone role for new users. Defaults to '_member_'.
Expand Down Expand Up @@ -86,9 +92,10 @@
$cache_server_port = '11211',
$swift = false,
$horizon_app_links = false,
$keystone_host = '127.0.0.1',
$keystone_port = 5000,
$keystone_scheme = 'http',
$keystone_host = undef,
$keystone_port = undef,
$keystone_scheme = undef,
$keystone_url = 'http://127.0.0.1:5000/v2.0',
$keystone_default_role = '_member_',
$django_debug = 'False',
$openstack_endpoint_type = undef,
Expand All @@ -112,6 +119,13 @@
warning('swift parameter is deprecated and has no effect.')
}

if $keystone_host or $keystone_port or $keystone_scheme {
warning('keystone_host, keystone_port and keystone_scheme are deprecated. Use keystone_url instead.')
if $keystone_url {
warning('keystone_host, keystone_port and keystone_scheme are ignored when keystone_url is set.')
}
}

file { $::horizon::params::httpd_config_file: }

Service <| title == 'memcached' |> -> Class['horizon']
Expand Down
27 changes: 25 additions & 2 deletions spec/classes/horizon_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@
'DEBUG = False',
"ALLOWED_HOSTS = ['*', ]",
"SECRET_KEY = 'elj1IWiLoWHgcyYxFVLj7cM5rGOOxWl0'",
'OPENSTACK_HOST = "127.0.0.1"',
'OPENSTACK_KEYSTONE_URL = "http://%s:5000/v2.0" % OPENSTACK_HOST',
'OPENSTACK_KEYSTONE_URL = "http://127.0.0.1:5000/v2.0"',
'OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_"',
" 'can_set_mount_point': True,",
'API_RESULT_LIMIT = 1000',
Expand All @@ -97,6 +96,7 @@
:keystone_port => 4682,
:keystone_scheme => 'https',
:keystone_default_role => 'SwiftOperator',
:keystone_url => false,
:django_debug => true,
:api_result_limit => 4682,
:can_set_mount_point => false,
Expand Down Expand Up @@ -149,6 +149,29 @@
end
end

describe 'when overriding keystone_url' do
before do
params.merge!({
:keystone_url => 'https://identity.example.com/public/endpoint/v2.0'
})
end

it 'generates local_settings.py' do
verify_contents(subject, '/etc/openstack-dashboard/local_settings.py', [
'DEBUG = False',
"ALLOWED_HOSTS = ['*', ]",
"SECRET_KEY = 'elj1IWiLoWHgcyYxFVLj7cM5rGOOxWl0'",
'OPENSTACK_KEYSTONE_URL = "https://identity.example.com/public/endpoint/v2.0"',
'OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_"',
" 'can_set_mount_point': True,",
'API_RESULT_LIMIT = 1000',
"LOGIN_URL = '/horizon/auth/login/'",
"LOGOUT_URL = '/horizon/auth/logout/'",
"LOGIN_REDIRECT_URL = '/horizon'"
])
end
end

describe 'when ssl is enabled' do
before do
params.merge!({
Expand Down
4 changes: 4 additions & 0 deletions templates/local_settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,12 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# ('http://cluster2.example.com:5000/v2.0', 'cluster2'),
# ]

<% if @keystone_url -%>
OPENSTACK_KEYSTONE_URL = "<%= @keystone_url %>"
<% else -%>
OPENSTACK_HOST = "<%= @keystone_host %>"
OPENSTACK_KEYSTONE_URL = "<%= @keystone_scheme %>://%s:<%= @keystone_port %>/v2.0" % OPENSTACK_HOST
<% end -%>
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "<%= @keystone_default_role %>"

# Disable SSL certificate checks (useful for self-signed certificates):
Expand Down

0 comments on commit 39dc4df

Please sign in to comment.