mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Fix for GlusterFS 4.0 and above
This commit is contained in:
parent
ad5a959ab9
commit
d5d01f6698
@ -26,15 +26,16 @@ def __virtual__():
|
|||||||
return (False, 'glusterfs server is not installed')
|
return (False, 'glusterfs server is not installed')
|
||||||
|
|
||||||
|
|
||||||
def _get_minor_version():
|
def _get_version():
|
||||||
# Set default version to 6 for tests
|
# Set the default minor version to 6 for tests
|
||||||
version = 6
|
version = [3, 6]
|
||||||
cmd = 'gluster --version'
|
cmd = 'gluster --version'
|
||||||
result = __salt__['cmd.run'](cmd).splitlines()
|
result = __salt__['cmd.run'](cmd).splitlines()
|
||||||
for line in result:
|
for line in result:
|
||||||
if line.startswith('glusterfs'):
|
if line.startswith('glusterfs'):
|
||||||
version = int(line.split()[1].split('.')[1])
|
version = line.split()[-1].split('.')
|
||||||
return version
|
version = [int(i) for i in version]
|
||||||
|
return tuple(version)
|
||||||
|
|
||||||
|
|
||||||
def _gluster_ok(xml_data):
|
def _gluster_ok(xml_data):
|
||||||
@ -67,7 +68,7 @@ def _gluster_xml(cmd):
|
|||||||
# We will pass the command string as stdin to allow for much longer
|
# We will pass the command string as stdin to allow for much longer
|
||||||
# command strings. This is especially useful for creating large volumes
|
# command strings. This is especially useful for creating large volumes
|
||||||
# where the list of bricks exceeds 128 characters.
|
# where the list of bricks exceeds 128 characters.
|
||||||
if _get_minor_version() < 6:
|
if _get_version() < (3, 6,):
|
||||||
result = __salt__['cmd.run'](
|
result = __salt__['cmd.run'](
|
||||||
'script -q -c "gluster --xml --mode=script"', stdin="{0}\n\004".format(cmd)
|
'script -q -c "gluster --xml --mode=script"', stdin="{0}\n\004".format(cmd)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user