Skip to content

Commit 99f88e1

Browse files
authored
Simplify use of check_ansible_presence (#1868)
1 parent ae2ba4c commit 99f88e1

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/ansiblelint/__main__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from ansiblelint.app import App
3737
from ansiblelint.color import console, console_options, reconfigure, render_yaml
3838
from ansiblelint.config import options
39-
from ansiblelint.constants import ANSIBLE_MISSING_RC, EXIT_CONTROL_C_RC
39+
from ansiblelint.constants import EXIT_CONTROL_C_RC
4040
from ansiblelint.file_utils import abspath, cwd, normpath
4141
from ansiblelint.prerun import check_ansible_presence, prepare_environment
4242
from ansiblelint.skip_utils import normalize_tag
@@ -81,15 +81,12 @@ def initialize_options(arguments: Optional[List[str]] = None) -> None:
8181
new_options.cwd = pathlib.Path.cwd()
8282

8383
if new_options.version:
84-
ansible_version, err = check_ansible_presence()
84+
ansible_version, _ = check_ansible_presence(exit_on_error=True)
8585
print(
8686
"ansible-lint {ver!s} using ansible {ansible_ver!s}".format(
8787
ver=__version__, ansible_ver=ansible_version
8888
)
8989
)
90-
if err:
91-
_logger.error(err)
92-
sys.exit(ANSIBLE_MISSING_RC)
9390
sys.exit(0)
9491

9592
if new_options.colored is None:

0 commit comments

Comments
 (0)