Alternatives module: Add a check that the path to the executable exist (#24800)

* Add check that the path to the executable exists

* Corrected a typo
pull/25737/merge
Dmitriy Khomutov 9 years ago committed by ansibot
parent fd01a9bb99
commit 277b8bfaf0

@ -68,6 +68,7 @@ EXAMPLES = '''
priority: -10
'''
import os
import re
import subprocess
@ -137,6 +138,8 @@ def main():
try:
# install the requested path if necessary
if path not in all_alternatives:
if not os.path.exists(path):
module.fail_json(msg="Specified path %s does not exist" % path)
if not link:
module.fail_json(msg="Needed to install the alternative, but unable to do so as we are missing the link")

Loading…
Cancel
Save