Commit e789c59f authored by Vincent Pelletier's avatar Vincent Pelletier

Make all erp5_promise recipe options optional.

Also, reduce code duplication.
parent 1cdca39e
...@@ -34,19 +34,23 @@ class Recipe(GenericBaseRecipe): ...@@ -34,19 +34,23 @@ class Recipe(GenericBaseRecipe):
""" """
def install(self): def install(self):
promise_parser = ConfigParser.RawConfigParser() promise_parser = ConfigParser.RawConfigParser()
for section_name, option_id_list in (
promise_parser.add_section('portal_templates') ('portal_templates', (
promise_parser.set('portal_templates', 'repository', self.options['bt5-repository-url']) ('repository', 'bt5-repository-url'),
promise_parser.set('portal_templates', 'expected_bt5', self.options['bt5']) ('expected_bt5', 'bt5'),
)),
promise_parser.add_section('external_service') ('external_service', (
promise_parser.set('external_service', 'cloudooo_url', self.options['cloudooo-url']) ('cloudooo_url', 'cloudooo-url'),
promise_parser.set('external_service', 'memcached_url', self.options['memcached-url']) ('memcached_url', 'memcached-url'),
promise_parser.set('external_service', 'kumofs_url', self.options['kumofs-url']) ('kumofs_url', 'kumofs-url'),
promise_parser.set('external_service', 'smtp_url', self.options['smtp-url']) ('smtp_url', 'smtp-url'),
)),
):
promise_parser.add_section(section_name)
for internal_id, option_id in option_id_list:
option = self.options.get(option_id)
if option:
promise_parser.set(section_name, internal_id, option)
promise_parser.write(open(self.options['promise-path'], 'w')) promise_parser.write(open(self.options['promise-path'], 'w'))
return [self.options['promise-path']] return [self.options['promise-path']]
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