Guard against a shell profile printing extraneous data

This commit is contained in:
Matt Martz 2016-04-08 10:18:35 -05:00
parent 4d59779e0a
commit 1cee3f35b1
3 changed files with 10 additions and 9 deletions

View file

@ -240,7 +240,8 @@ class ActionBase(with_metaclass(ABCMeta, object)):
raise AnsibleConnectionFailure(output)
try:
rc = self._connection._shell.join_path(result['stdout'].strip(), u'').splitlines()[-1]
stdout_parts = result['stdout'].strip().split('%s=' % basefile, 1)
rc = self._connection._shell.join_path(stdout_parts[-1], u'').splitlines()[-1]
except IndexError:
# stdout was empty or just space, set to / to trigger error in next if
rc = '/'