1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix traceback on indexing empty list (#21784)

* Fix traceback on indexing empty list
* Make it more 'idiomatic'
* Forgot the index
This commit is contained in:
jctanner 2017-02-22 16:14:39 -05:00 committed by GitHub
parent cba91c7f44
commit 8c521655e1

View file

@ -543,7 +543,10 @@ class ActionBase(with_metaclass(ABCMeta, object)):
cmd = self._connection._shell.expand_user(expand_path)
data = self._low_level_execute_command(cmd, sudoable=False)
try:
initial_fragment = data['stdout'].strip().splitlines()[-1]
except IndexError:
initial_fragment = None
if not initial_fragment:
# Something went wrong trying to expand the path remotely. Return