Commit 87d0ef13 authored by Łukasz Nowak's avatar Łukasz Nowak

React on global erp5-ca key.

If added all country-code, email, state, city and company are required and are
later passed to certificate authority configuration.
parent 9f09f2da
...@@ -187,13 +187,36 @@ class Recipe(GenericSlapRecipe): ...@@ -187,13 +187,36 @@ class Recipe(GenericSlapRecipe):
output += SECTION_BACKEND_PUBLISHER + '\n' output += SECTION_BACKEND_PUBLISHER + '\n'
output += '\n'.join(publish_url_list) output += '\n'.join(publish_url_list)
part_list.append('publish-apache-backend-list') part_list.append('publish-apache-backend-list')
master_dict = self.parameter_dict.copy()
if 'erp5-ca' in json_data:
erp5_ca = json_data['erp5-ca']
# Fetching exactly named parameters from json in order to raise proper
# error if required
master_dict.update(
erp5_ca_country_code = erp5_ca['country-code'],
erp5_ca_email = erp5_ca['email'],
erp5_ca_state = erp5_ca['state'],
erp5_ca_city = erp5_ca['city'],
erp5_ca_company = erp5_ca['company']
)
else:
master_dict.update(dict(
erp5_ca_country_code = 'XX',
erp5_ca_email = 'xx@example.com',
# XXX-BBB: State by mistake has been configured as string "('State',)"
# string, so keep this for backward compatibility of existing
# automatically setup CAs
erp5_ca_state = "('State',)",
erp5_ca_city = 'City',
erp5_ca_company = 'Company'
))
prepend = open(self.options['snippet-master']).read() % dict( prepend = open(self.options['snippet-master']).read() % dict(
part_list=' \n'.join([' '+q for q in part_list]), part_list=' \n'.join([' '+q for q in part_list]),
known_tid_storage_identifier_dict=known_tid_storage_identifier_dict, known_tid_storage_identifier_dict=known_tid_storage_identifier_dict,
haproxy_section="haproxy-%s" % backend_name, haproxy_section="haproxy-%s" % backend_name,
zope_section=zope_id, zope_section=zope_id,
site_id=site_id, site_id=site_id,
**self.parameter_dict **master_dict
) )
output = prepend + output output = prepend + output
with open(self.options['output'], 'w') as f: with open(self.options['output'], 'w') as f:
......
...@@ -96,6 +96,11 @@ ca-private = $${erp5-cadirectory:private} ...@@ -96,6 +96,11 @@ ca-private = $${erp5-cadirectory:private}
ca-certs = $${erp5-cadirectory:certs} ca-certs = $${erp5-cadirectory:certs}
ca-newcerts = $${erp5-cadirectory:newcerts} ca-newcerts = $${erp5-cadirectory:newcerts}
ca-crl = $${erp5-cadirectory:crl} ca-crl = $${erp5-cadirectory:crl}
country-code = %(erp5_ca_country_code)s
email = %(erp5_ca_email)s
state = %(erp5_ca_state)s
city = %(erp5_ca_city)s
company = %(erp5_ca_company)s
[erp5-cadirectory] [erp5-cadirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
......
...@@ -122,7 +122,7 @@ mode = 0644 ...@@ -122,7 +122,7 @@ mode = 0644
[template-snippet-master] [template-snippet-master]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/snippet-master.cfg url = ${:_profile_base_location_}/snippet-master.cfg
md5sum = 1998912b370c51544e8659cdf6a68b83 md5sum = 69d51c0054e5058492d84a5f73badb30
output = ${buildout:directory}/template-snippet-master.cfg output = ${buildout:directory}/template-snippet-master.cfg
mode = 0644 mode = 0644
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment