mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Gracefully handle non-XML output in GlusterFS execution module. (#34492)
* Gracefully handle non-XML command output. * Omit gluster command usage line. * Remove unnecessary import.
This commit is contained in:
parent
75299456be
commit
6ce7cb9616
1 changed files with 5 additions and 1 deletions
|
@ -76,7 +76,11 @@ def _gluster_xml(cmd):
|
|||
result = __salt__['cmd.run'](
|
||||
'gluster --xml --mode=script', stdin="{0}\n".format(cmd)
|
||||
)
|
||||
root = ET.fromstring(_gluster_output_cleanup(result))
|
||||
|
||||
try:
|
||||
root = ET.fromstring(_gluster_output_cleanup(result))
|
||||
except ET.ParseError:
|
||||
raise CommandExecutionError('\n'.join(result.splitlines()[:-1]))
|
||||
|
||||
if int(root.find('opRet').text) != 0:
|
||||
raise CommandExecutionError(root.find('opErrstr').text)
|
||||
|
|
Loading…
Add table
Reference in a new issue