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

ansible 'NoneType' object is not callable #79674

Open
1 task done
aviiiiiiiii opened this issue Jan 5, 2023 · 6 comments
Open
1 task done

ansible 'NoneType' object is not callable #79674

aviiiiiiiii opened this issue Jan 5, 2023 · 6 comments
Labels
affects_2.14 bug This issue/PR relates to a bug. P3 Priority 3 - Approved, No Time Limitation traceback This issue/PR includes a traceback. verified This issue has been verified/reproduced by maintainer

Comments

@aviiiiiiiii
Copy link

aviiiiiiiii commented Jan 5, 2023

Summary

ansible [core 2.14.1]
  config file = None
  configured module search path = ['/Users/aa/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/aa/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.9 (main, Dec 15 2022, 18:18:30) [Clang 14.0.0 (clang-1400.0.29.202)] (/usr/local/opt/python@3.10/bin/python3.10)
  jinja version = 3.1.2
  libyaml = True

Trying to run mysql5.7 installation:

  tasks:
    - name: Install MySQL 5.7 repo
      yum: name=http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm state=present validate_certs=no

getting:

"msg": "Failure downloading http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm, 'NoneType' object is not callable"

debug logs:

The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_ansible.legacy.yum_payload_MFjqHW/ansible_ansible.legacy.yum_payload.zip/ansible/module_utils/urls.py", line 2063, in fetch_file
    data = rsp.read(bufsize)
fatal: [10.10.169.16]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "allow_downgrade": false,
            "autoremove": false,
            "bugfix": false,
            "cacheonly": false,
            "conf_file": null,
            "disable_excludes": null,
            "disable_gpg_check": false,
            "disable_plugin": [],
            "disablerepo": [],
            "download_dir": null,
            "download_only": false,
            "enable_plugin": [],
            "enablerepo": [],
            "exclude": [],
            "install_repoquery": true,
            "install_weak_deps": true,
            "installroot": "/",
            "list": null,
            "lock_timeout": 30,
            "name": [
                "http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm"
            ],
            "releasever": null,
            "security": false,
            "skip_broken": false,
            "sslverify": true,
            "state": "present",
            "update_cache": false,
            "update_only": false,
            "use_backend": "auto",
            "validate_certs": false
        }
    },
    "msg": "Failure downloading http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm, 'NoneType' object is not callable"
}

Issue Type

Bug Report

Component Name

yum

Ansible Version

ansible [core 2.14.1]
  config file = None
  configured module search path = ['/Users/aa/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/aa/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.9 (main, Dec 15 2022, 18:18:30) [Clang 14.0.0 (clang-1400.0.29.202)] (/usr/local/opt/python@3.10/bin/python3.10)
  jinja version = 3.1.2
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all

OS / Environment

Running the script on my macos and the execution (mysql installation in this case) should run on a centos 7 vm.

Steps to Reproduce

- name: Install MySQL
  hosts: all:!localhost
  tasks:
    - name: Install MySQL 5.7 repo
      yum: name=http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm state=present validate_certs=no

** passing the vm ip as an cli -i

Expected Results

mysql to get installed.

Actual Results

Failure:

The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_ansible.legacy.yum_payload_MFjqHW/ansible_ansible.legacy.yum_payload.zip/ansible/module_utils/urls.py", line 2063, in fetch_file
    data = rsp.read(bufsize)
fatal: [10.10.169.16]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "allow_downgrade": false,
            "autoremove": false,
            "bugfix": false,
            "cacheonly": false,
            "conf_file": null,
            "disable_excludes": null,
            "disable_gpg_check": false,
            "disable_plugin": [],
            "disablerepo": [],
            "download_dir": null,
            "download_only": false,
            "enable_plugin": [],
            "enablerepo": [],
            "exclude": [],
            "install_repoquery": true,
            "install_weak_deps": true,
            "installroot": "/",
            "list": null,
            "lock_timeout": 30,
            "name": [
                "http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm"
            ],
            "releasever": null,
            "security": false,
            "skip_broken": false,
            "sslverify": true,
            "state": "present",
            "update_cache": false,
            "update_only": false,
            "use_backend": "auto",
            "validate_certs": false
        }
    },
    "msg": "Failure downloading http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm, 'NoneType' object is not callable"
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented Jan 5, 2023

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.14 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. traceback This issue/PR includes a traceback. labels Jan 5, 2023
@nitzmahone nitzmahone added P3 Priority 3 - Approved, No Time Limitation and removed needs_triage Needs a first human triage before being processed. labels Jan 5, 2023
@nitzmahone
Copy link
Member

Looks like we need to tweak the check at

if e.fp is None:
to return a different response than the exception object if its read is None.

@nitzmahone nitzmahone added the verified This issue has been verified/reproduced by maintainer label Jan 5, 2023
@aviiiiiiiii
Copy link
Author

Any idea why is the read is none? The yum url is invalid or the response might be?

@bcoca
Copy link
Member

bcoca commented Jan 5, 2023

There is an HTTPerror, which has 'none' as it's methods when we try to read the reason, this seems to be a corner case of Python's urllib errors, we are still investigating.

@aviiiiiiiii
Copy link
Author

Ok cool thx, so a workaround might be to for ansible to use python3.9 instead of the version mentioned above?

@ansibot ansibot removed the module This issue/PR relates to a module. label Jan 30, 2024
@lucalooz
Copy link

@aviiiiiiiii did you solve this issue?
I think I've found the culprit, it seems that the Akamai CDN responds with a 403 if there isn't a correct combination of request headers between User-Agent, Accept, Accept-Encoding and Connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.14 bug This issue/PR relates to a bug. P3 Priority 3 - Approved, No Time Limitation traceback This issue/PR includes a traceback. verified This issue has been verified/reproduced by maintainer
Projects
None yet
Development

No branches or pull requests

5 participants