Skip to content
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

--version ignores --offline flag #4269

Closed
tonve opened this issue Jul 23, 2024 · 0 comments · Fixed by #4283
Closed

--version ignores --offline flag #4269

tonve opened this issue Jul 23, 2024 · 0 comments · Fixed by #4283
Labels
bug new Triage required

Comments

@tonve
Copy link

tonve commented Jul 23, 2024

Summary

--offline flag is not used while displaying version

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --offline --version
ansible-lint 24.2.2 using ansible-core:2.16.5 ansible-compat:4.1.11 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.7
A new release of ansible-lint is available: 24.2.2 → 24.7.0

also last version were checked

ansible-lint --offline --version
ansible-lint 24.7.0 using ansible-core:2.17.2 ansible-compat:24.7.0 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8

24.7.0 is also affected, and may cause version check error in isolated environments

debian bookworm slim image, docker env, pip/pipx install

  • ansible installation method: pip
  • ansible-lint installation method: pip
Desired Behavior

ansible-lint --offline --version
should return version w/o checking online resources

Actual Behavior
ansible-lint --offline --version
ansible-lint 24.7.0 using ansible-core:2.17.2 ansible-compat:24.7.0 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
Traceback (most recent call last):
  File "/root/.local/bin/ansible-lint", line 8, in <module>
    sys.exit(_run_cli_entrypoint())
             ^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/share/pipx/venvs/ansible-lint/lib/python3.12/site-packages/ansiblelint/__main__.py", line 408, in _run_cli_entrypoint
    sys.exit(main(sys.argv))
             ^^^^^^^^^^^^^^
  File "/root/.local/share/pipx/venvs/ansible-lint/lib/python3.12/site-packages/ansiblelint/__main__.py", line 302, in main
    msg = get_version_warning()
          ^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/share/pipx/venvs/ansible-lint/lib/python3.12/site-packages/ansiblelint/config.py", line 329, in get_version_warning
    with urllib.request.urlopen(release_url) as url:  # noqa: S310
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/urllib/request.py", line 215, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/urllib/request.py", line [51](http://192.168.0.104/zhuravlev-ansible/entrypoint/-/jobs/790#L51)5, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/urllib/request.py", line [53](http://192.168.0.104/zhuravlev-ansible/entrypoint/-/jobs/790#L53)2, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/usr/local/lib/python3.12/urllib/request.py", line 1392, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/urllib/request.py", line 1348, in do_open
    r = h.getresponse()
        ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/http/client.py", line 1428, in getresponse
    response.begin()
  File "/usr/local/lib/python3.12/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/http/client.py", line 300, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

@tonve tonve added bug new Triage required labels Jul 23, 2024
cavcrosby added a commit to cavcrosby/ansible-lint that referenced this issue Jul 27, 2024
cavcrosby added a commit to cavcrosby/ansible-lint that referenced this issue Jul 27, 2024
cavcrosby added a commit to cavcrosby/ansible-lint that referenced this issue Jul 27, 2024
cavcrosby added a commit to cavcrosby/ansible-lint that referenced this issue Aug 3, 2024
A conditional has been added to see if data is empty to prevent KeyError
exceptions from happening because a cache file may not exist when using
the --offline flag. This prevents data from ever being populated.
cavcrosby added a commit to cavcrosby/ansible-lint that referenced this issue Aug 13, 2024
A conditional has been added to see if data is empty to prevent KeyError
exceptions from happening because a cache file may not exist when using
the --offline flag. This prevents data from ever being populated.
cavcrosby added a commit to cavcrosby/ansible-lint that referenced this issue Aug 22, 2024
A conditional has been added to see if data is empty to prevent KeyError
exceptions from happening because a cache file may not exist when using
the --offline flag. This prevents data from ever being populated.
cavcrosby added a commit to cavcrosby/ansible-lint that referenced this issue Aug 26, 2024
A conditional has been added to see if data is empty to prevent KeyError
exceptions from happening because a cache file may not exist when using
the --offline flag. This prevents data from ever being populated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug new Triage required
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant