salt.module.zpool - fix bug with properties on/off being parsed as true/false

This commit is contained in:
Jorge Schrauwen 2016-07-21 00:28:23 +02:00
parent dd64494a19
commit a5a98845c7

View File

@ -671,10 +671,13 @@ def create(zpool, *vdevs, **kwargs):
if properties: # create "-o property=value" pairs if properties: # create "-o property=value" pairs
optlist = [] optlist = []
for prop in properties: for prop in properties:
if ' ' in properties[prop]: if isinstance(properties[prop], bool):
value = "'{0}'".format(properties[prop]) value = 'on' if properties[prop] else 'off'
else: else:
value = properties[prop] if ' ' in properties[prop]:
value = "'{0}'".format(properties[prop])
else:
value = properties[prop]
optlist.append('-o {0}={1}'.format(prop, value)) optlist.append('-o {0}={1}'.format(prop, value))
opts = ' '.join(optlist) opts = ' '.join(optlist)
cmd = '{0} {1}'.format(cmd, opts) cmd = '{0} {1}'.format(cmd, opts)