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),
|
'string': dict(opttype=StrOption),
|
||||||
'password': dict(opttype=PasswordOption),
|
'password': dict(opttype=PasswordOption),
|
||||||
'mail': dict(opttype=EmailOption),
|
'mail': dict(opttype=EmailOption),
|
||||||
'boolean': dict(opttype=BoolOption),
|
'boolean': dict(opttype=BoolOption, initkwargs={'default': True}),
|
||||||
'symlink': dict(opttype=SymLinkOption),
|
'symlink': dict(opttype=SymLinkOption),
|
||||||
'filename': dict(opttype=FilenameOption),
|
'filename': dict(opttype=FilenameOption),
|
||||||
'date': dict(opttype=DateOption),
|
'date': dict(opttype=DateOption),
|
||||||
|
@ -269,6 +269,9 @@ class Variable(Common):
|
||||||
self.option = None
|
self.option = None
|
||||||
self.informations = {}
|
self.informations = {}
|
||||||
self.attrib = {}
|
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':
|
if elt.attrib['type'] != 'symlink':
|
||||||
self.attrib['properties'] = []
|
self.attrib['properties'] = []
|
||||||
self.attrib['validators'] = []
|
self.attrib['validators'] = []
|
||||||
|
@ -278,15 +281,12 @@ class Variable(Common):
|
||||||
self.populate_attrib(elt)
|
self.populate_attrib(elt)
|
||||||
self.is_follower = is_follower
|
self.is_follower = is_follower
|
||||||
self.is_leader = is_leader
|
self.is_leader = is_leader
|
||||||
convert_option = CONVERT_OPTION[elt.attrib['type']]
|
|
||||||
self.object_type = convert_option['opttype']
|
self.object_type = convert_option['opttype']
|
||||||
self.populate_choice(elt)
|
self.populate_choice(elt)
|
||||||
for child in elt:
|
for child in elt:
|
||||||
self.populate_property(child)
|
self.populate_property(child)
|
||||||
self.populate_value(child)
|
self.populate_value(child)
|
||||||
self.populate_check(child)
|
self.populate_check(child)
|
||||||
if 'initkwargs' in convert_option:
|
|
||||||
self.attrib.update(convert_option['initkwargs'])
|
|
||||||
if elt.attrib['type'] == 'symlink':
|
if elt.attrib['type'] == 'symlink':
|
||||||
self.attrib['opt'] = storage.get(self.attrib['opt'])
|
self.attrib['opt'] = storage.get(self.attrib['opt'])
|
||||||
|
|
||||||
|
@ -371,9 +371,6 @@ class Variable(Common):
|
||||||
if not self.is_leader:
|
if not self.is_leader:
|
||||||
self.attrib['default_multi'].append(value)
|
self.attrib['default_multi'].append(value)
|
||||||
else:
|
else:
|
||||||
if 'default' in self.attrib:
|
|
||||||
raise CreoleLoaderError(_('default value already set for {}'
|
|
||||||
'').format(self.attrib['path']))
|
|
||||||
value = convert_tiramisu_value(child.text, type_)
|
value = convert_tiramisu_value(child.text, type_)
|
||||||
if self.is_follower:
|
if self.is_follower:
|
||||||
self.attrib['default_multi'] = value
|
self.attrib['default_multi'] = value
|
||||||
|
|
|
@ -15,9 +15,7 @@
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable name="mode_conteneur_actif2" type="oui/non" description="No change">
|
<variable name="mode_conteneur_actif2" type="boolean" description="No change"/>
|
||||||
<value>non</value>
|
|
||||||
</variable>
|
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
<separators/>
|
||||||
</variables>
|
</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>
|
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">disabled</property>
|
||||||
<value type="string">non</value>
|
<value type="string">non</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable doc="No change" multi="False" name="mode_conteneur_actif2" type="choice">
|
<variable doc="No change" multi="False" name="mode_conteneur_actif2" type="boolean">
|
||||||
<choice type="string">oui</choice>
|
|
||||||
<choice type="string">non</choice>
|
|
||||||
<property>mandatory</property>
|
|
||||||
<property>normal</property>
|
<property>normal</property>
|
||||||
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">disabled</property>
|
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">disabled</property>
|
||||||
<value type="string">non</value>
|
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
<separators/>
|
||||||
|
|
Loading…
Reference in New Issue