CONFIG_PARAM= not handled well by hiera
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Packstack |
In Progress
|
Undecided
|
Unassigned |
Bug Description
tl;dr - CONFIG_PARAM= in an ans.txt file is not handled well or consistently. This has not caused problems for anyone but me (the keystone ldap commit) by a combination of hacking around bogus behavior, and dumb luck.
The problem is this: If you have an ans.txt file with
CONFIG_PARAM=
That is, there is only a newline after the = - an empty value, this is read into packstack by ConfigParser and turned into this config element:
config[
That is, the config parameter is present, and has the value of the empty string. Note that in python, '' != None.
When this gets converted to yaml, it comes out like this:
CONFIG_PARAM: ''
When this gets used in puppet by hiera, it comes out like this:
$value = hiera('
$value is '' - note that in puppet '' != undef, so this will not trigger default class parameter evaluation (bad).
So, why is this a problem for me, and not anyone else? Good question. I worked with Ivan last night who found the following in his defaults.yaml in testing:
$ grep "['][']" /var/tmp/
CONFIG_
CONFIG_
CONFIG_
CONFIG_
CONFIG_
CONFIG_
CONFIG_
CONFIG_NTP_SERVERS: ''
CONFIG_
CONFIG_REPO: ''
CONFIG_RH_USER: ''
CONFIG_
CONFIG_
EXCLUDE_SERVERS: ''
I went through every single one of these parameters to find out how they are used with hiera in puppet.
CONFIG_
CONFIG_
CONFIG_
These are only used if CONFIG_
CONFIG_
CONFIG_
if hiera('
$vxlan_
} else {
$vxlan_
}
CONFIG_
CONFIG_
CONFIG_NTP_SERVERS - used like this:
$cfg_ntp_servers = hiera('
exec { 'ntpdate':
command => "/usr/sbin/ntpdate ${cfg_ntp_
tries => 3,
}
This is equivalent to calling ntpdate with no arguments. I'm not sure what happens in this case.
CONFIG_
CONFIG_REPO
CONFIG_RH_USER
CONFIG_
CONFIG_
EXCLUDE_SERVERS
None of these are used directly in puppet code.
Changed in packstack: | |
status: | New → In Progress |
assignee: | nobody → Martin Mágr (mmagr) |
Changed in packstack: | |
assignee: | Martin Mágr (mmagr) → nobody |
I worked around the problem with my Keystone LDAP commit for packstack https:/ /review. openstack. org/#/c/ 129989/ by using a hiera_undef() function - this will return an actual puppet undef value that will trigger the default class parameter value.
I also think there should be some consideration for mapping of other types from ans.txt -> python -> hiera -> puppet. For example, hiera can represent python None as null, python True/False as true/false e.g. declare a packstack Parameter as a boolean so that hiera can write a true/false to the defaults.yaml.