Skip to content

Simplify use of check_ansible_presence #1868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/ansiblelint/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from ansiblelint.app import App
from ansiblelint.color import console, console_options, reconfigure, render_yaml
from ansiblelint.config import options
from ansiblelint.constants import ANSIBLE_MISSING_RC, EXIT_CONTROL_C_RC
from ansiblelint.constants import EXIT_CONTROL_C_RC
from ansiblelint.file_utils import abspath, cwd, normpath
from ansiblelint.prerun import check_ansible_presence, prepare_environment
from ansiblelint.skip_utils import normalize_tag
Expand Down Expand Up @@ -81,15 +81,12 @@ def initialize_options(arguments: Optional[List[str]] = None) -> None:
new_options.cwd = pathlib.Path.cwd()

if new_options.version:
ansible_version, err = check_ansible_presence()
ansible_version, _ = check_ansible_presence(exit_on_error=True)
print(
"ansible-lint {ver!s} using ansible {ansible_ver!s}".format(
ver=__version__, ansible_ver=ansible_version
)
)
if err:
_logger.error(err)
sys.exit(ANSIBLE_MISSING_RC)
sys.exit(0)

if new_options.colored is None:
Expand Down