WIP: bug-fix: prevent buildout to fail when option value is None
When a parameter is None the recipe slapconfiguration fail with the message below:
2017-09-29 15:51:49 slapos[26200] INFO While:
2017-09-29 15:51:49 slapos[26200] INFO Installing.
2017-09-29 15:51:49 slapos[26200] INFO Getting section switch_softwaretype.
2017-09-29 15:51:49 slapos[26200] INFO Initializing section switch_softwaretype.
2017-09-29 15:51:49 slapos[26200] INFO Getting option switch_softwaretype:default.
2017-09-29 15:51:49 slapos[26200] INFO Getting option switch_softwaretype:kvm.
2017-09-29 15:51:49 slapos[26200] INFO Getting section dynamic-template-kvm.
2017-09-29 15:51:49 slapos[26200] INFO Initializing section dynamic-template-kvm.
2017-09-29 15:51:49 slapos[26200] INFO Getting section slap-configuration.
2017-09-29 15:51:49 slapos[26200] INFO Initializing section slap-configuration.
2017-09-29 15:51:49 slapos[26200] INFO Error: Missing option: slap-configuration:tun
I realized that when a parameter (which has default value to '') is not set by the user while requesting instance, it become None then adding options[key] = None
in slapconfiguration will make buildout angry. If I print the result of options
at the end, all keys with values equal to None are missing.
I general If do this:
[request-xxxx]
.....
config-foo-bar = {{ dumps(kvm_parameter_dict.get('foo-bar', '')) }}
or
[param-fooo]
bar =
[request-xxxx]
.....
config-foo-bar = ${param-fooo:bar}
Buildout will raise with exception saying Error: Missing option: slap-configuration:foo-bar
. Setting the value to empty string instead of None
solve the problem.