add default value to True in boolean
This commit is contained in:
parent
7e34709628
commit
7191bbbcb3
@ -60,7 +60,7 @@ CONVERT_OPTION = {'number': dict(opttype=IntOption),
|
||||
'string': dict(opttype=StrOption),
|
||||
'password': dict(opttype=PasswordOption),
|
||||
'mail': dict(opttype=EmailOption),
|
||||
'boolean': dict(opttype=BoolOption),
|
||||
'boolean': dict(opttype=BoolOption, initkwargs={'default': True}),
|
||||
'symlink': dict(opttype=SymLinkOption),
|
||||
'filename': dict(opttype=FilenameOption),
|
||||
'date': dict(opttype=DateOption),
|
||||
@ -269,6 +269,9 @@ class Variable(Common):
|
||||
self.option = None
|
||||
self.informations = {}
|
||||
self.attrib = {}
|
||||
convert_option = CONVERT_OPTION[elt.attrib['type']]
|
||||
if 'initkwargs' in convert_option:
|
||||
self.attrib.update(convert_option['initkwargs'])
|
||||
if elt.attrib['type'] != 'symlink':
|
||||
self.attrib['properties'] = []
|
||||
self.attrib['validators'] = []
|
||||
@ -278,15 +281,12 @@ class Variable(Common):
|
||||
self.populate_attrib(elt)
|
||||
self.is_follower = is_follower
|
||||
self.is_leader = is_leader
|
||||
convert_option = CONVERT_OPTION[elt.attrib['type']]
|
||||
self.object_type = convert_option['opttype']
|
||||
self.populate_choice(elt)
|
||||
for child in elt:
|
||||
self.populate_property(child)
|
||||
self.populate_value(child)
|
||||
self.populate_check(child)
|
||||
if 'initkwargs' in convert_option:
|
||||
self.attrib.update(convert_option['initkwargs'])
|
||||
if elt.attrib['type'] == 'symlink':
|
||||
self.attrib['opt'] = storage.get(self.attrib['opt'])
|
||||
|
||||
@ -371,9 +371,6 @@ class Variable(Common):
|
||||
if not self.is_leader:
|
||||
self.attrib['default_multi'].append(value)
|
||||
else:
|
||||
if 'default' in self.attrib:
|
||||
raise CreoleLoaderError(_('default value already set for {}'
|
||||
'').format(self.attrib['path']))
|
||||
value = convert_tiramisu_value(child.text, type_)
|
||||
if self.is_follower:
|
||||
self.attrib['default_multi'] = value
|
||||
|
@ -15,9 +15,7 @@
|
||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif2" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif2" type="boolean" description="No change"/>
|
||||
</family>
|
||||
<separators/>
|
||||
</variables>
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": true}
|
||||
{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": true, "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": true}
|
||||
|
@ -49,13 +49,9 @@
|
||||
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">disabled</property>
|
||||
<value type="string">non</value>
|
||||
</variable>
|
||||
<variable doc="No change" multi="False" name="mode_conteneur_actif2" type="choice">
|
||||
<choice type="string">oui</choice>
|
||||
<choice type="string">non</choice>
|
||||
<property>mandatory</property>
|
||||
<variable doc="No change" multi="False" name="mode_conteneur_actif2" type="boolean">
|
||||
<property>normal</property>
|
||||
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">disabled</property>
|
||||
<value type="string">non</value>
|
||||
</variable>
|
||||
</family>
|
||||
<separators/>
|
||||
|
Loading…
Reference in New Issue
Block a user