Set instance_user in heat.

If you leave it commented out, heat defaults it to ec2-user which can be
confusing to users. This allows you to set the value.

Change-Id: I44fef59d3ed1f7851d8504855a7ae0d5460fdc84
This commit is contained in:
Matt Fischer 2015-02-26 14:15:58 -07:00
parent 0993b23eeb
commit 4276170148
2 changed files with 33 additions and 0 deletions

View File

@ -151,6 +151,11 @@
# default region name that heat talks to service endpoints on.
# Defaults to undef
#
# [*instance_user*]
# (Optional) The default user for new instances. Although heat claims that
# this feature is deprecated, it still sets the users to ec2-user if
# you leave this unset. This will likely be deprecated in K or L.
#
# === Deprecated Parameters
#
# [*mysql_module*]
@ -220,6 +225,7 @@ class heat(
$keystone_host = '127.0.0.1',
$keystone_port = '35357',
$keystone_protocol = 'http',
$instance_user = undef,
) {
include heat::params
@ -523,4 +529,13 @@ class heat(
} else {
heat_config { 'DEFAULT/region_name_for_services': ensure => absent; }
}
# instance_user
if $instance_user {
heat_config { 'DEFAULT/instance_user': value => $instance_user; }
} else {
heat_config { 'DEFAULT/instance_user': ensure => absent; }
}
}

View File

@ -450,6 +450,24 @@ describe 'heat' do
end
end
shared_examples_for 'with instance_user set' do
before do
params.merge!(
:instance_user => "fred",
)
end
it 'has instance_user set when specified' do
should contain_heat_config('DEFAULT/instance_user').with_value('fred')
end
end
shared_examples_for 'without instance_user set' do
it 'doesnt have instance_user set by default' do
should contain_heat_config('DEFAULT/instance_user').with_enure('absent')
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }