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
This commit is contained in:
parent
fd01a9bb99
commit
277b8bfaf0
1 changed files with 3 additions and 0 deletions
|
@ -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…
Reference in a new issue