Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GlusterFS module for version 4.0 and above #48222

Merged
merged 6 commits into from
Jun 28, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions salt/modules/glusterfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ def __virtual__():
return (False, 'glusterfs server is not installed')


def _get_minor_version():
return int(_get_version()[1])


def _get_version():
# Set the default minor version to 6 for tests
version = [3, 6]
Expand All @@ -41,7 +37,7 @@ def _get_version():
for line in result:
if line.startswith('glusterfs'):
version = line.split()[1].split('.')
return version
return tuple(version)


def _gluster_ok(xml_data):
Expand Down Expand Up @@ -74,7 +70,7 @@ def _gluster_xml(cmd):
# We will pass the command string as stdin to allow for much longer
# command strings. This is especially useful for creating large volumes
# where the list of bricks exceeds 128 characters.
if _get_minor_version() < 6:
if _get_version() < (3, 6,):
result = __salt__['cmd.run'](
'script -q -c "gluster --xml --mode=script"', stdin="{0}\n\004".format(cmd)
)
Expand Down Expand Up @@ -752,9 +748,8 @@ def get_max_op_version():
salt '*' glusterfs.get_max_op_version
'''

minor_version = _get_minor_version()

if int(minor_version) < 10:
if _get_version() < (3, 10,):
return False, 'Glusterfs version must be 3.10+. Your version is {0}.'.format(str('.'.join(_get_version())))

cmd = 'volume get all cluster.max-op-version'
Expand Down