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

maven_artifact md5 checksum is case sensitive #186

Closed
jpdias92 opened this issue Apr 15, 2020 · 2 comments · Fixed by #197
Closed

maven_artifact md5 checksum is case sensitive #186

jpdias92 opened this issue Apr 15, 2020 · 2 comments · Fixed by #197
Labels
bug This issue/PR relates to a bug module module

Comments

@jpdias92
Copy link

SUMMARY

When using the maven_artifact module to download artifacts from Azure DevOps Maven feed with the default verify_checksum option: download , the module fails with:

"msg": "Cannot retrieve the artifact to destination: Checksum does not match: we computed cd24c3cdc2d7bff332c4ccb9205af867but the repository states CD24C3CDC2D7BFF332C4CCB9205AF867"

As can be seen in the message above, the md5 hashes are exactly the same, only one is in upper case and the other in lower case. This shouldn't matter for the checksum verification so the code should do the comparison forcing either lower case or upper case for the local and the remote md5 checksums.

Moreover, there's a missing space in the error message "cd24c3cdc2d7bff332c4ccb9205af867but"

ISSUE TYPE
  • Bug Report
COMPONENT NAME

maven_artifact

ANSIBLE VERSION
ansible 2.9.2
  config file = /home/xjood/.ansible.cfg
  configured module search path = ['/home/xjood/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0]
CONFIGURATION
ANSIBLE_NOCOWS(/home/xjood/.ansible.cfg) = True
CONDITIONAL_BARE_VARS(/home/xjood/.ansible.cfg) = False
DEFAULT_CALLBACK_WHITELIST(/home/xjood/.ansible.cfg) = ['profile_tasks']
DEFAULT_FORKS(/home/xjood/.ansible.cfg) = 100
DISPLAY_SKIPPED_HOSTS(/home/xjood/.ansible.cfg) = False
RETRY_FILES_ENABLED(/home/xjood/.ansible.cfg) = False
OS / ENVIRONMENT
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
STEPS TO REPRODUCE

I'm using the module in the following way, locally:

    - name: Get artifacts
      maven_artifact:
        repository_url: "{{ repository_url }}"
        group_id: "{{ group_id }}"
        artifact_id: "{{ artifact_id }}"
        version: "{{ version }}"
        dest: /tmp/
        keep_name: yes
        headers:
          Authorization: "Basic {{ (username + ':' + password) | b64encode }}"
      vars:
        username: "{{ lookup('env', 'MAVEN_REPO_PAT') }}"
        password: "{{ lookup('env', 'MAVEN_REPO_PAT') }}"
EXPECTED RESULTS

I would expect the artifacts to be downloaded successfully.

ACTUAL RESULTS

ansible-playbook 2.9.2
  config file = /home/xjood/.ansible.cfg
  configured module search path = ['/home/xjood/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0]
Using /home/xjood/.ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
[WARNING]: No inventory was parsed, only implicit localhost is available

[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.6/dist-packages/ansible/plugins/callback/default.pyLoading callback plugin profile_tasks of type aggregate, v2.0 from /usr/local/lib/python3.6/dist-packages/ansible/plugins/callback/profile_tasks.py

PLAYBOOK: _test_playbook.yml *******************************************************************************************************Positional arguments: _test_playbook.yml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/etc/ansible/hosts',)
forks: 100
1 plays in _test_playbook.yml

PLAY [TEST] ************************************************************************************************META: ran handlers
Wednesday 15 April 2020  12:56:08 +0200 (0:00:00.081)       0:00:00.081 *******
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: xjood
<127.0.0.1> EXEC /bin/sh -c 'echo ~xjood && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/xjood/.ansible/tmp/ansible-tmp-1586948169.0758207-28476717278723 `" && echo ansible-tmp-1586948169.0758207-28476717278723="` echo /home/xjood/.ansible/tmp/ansible-tmp-1586948169.0758207-28476717278723 `" ) && sleep 0'
Using module file /usr/local/lib/python3.6/dist-packages/ansible/modules/packaging/language/maven_artifact.py
<127.0.0.1> PUT /home/xjood/.ansible/tmp/ansible-local-6242catc6jti/tmpomgs2pa5 TO /home/xjood/.ansible/tmp/ansible-tmp-1586948169.0758207-28476717278723/AnsiballZ_maven_artifact.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/xjood/.ansible/tmp/ansible-tmp-1586948169.0758207-28476717278723/ /home/xjood/.ansible/tmp/ansible-tmp-1586948169.0758207-28476717278723/AnsiballZ_maven_artifact.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /home/xjood/.ansible/tmp/ansible-tmp-1586948169.0758207-28476717278723/AnsiballZ_maven_artifact.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/xjood/.ansible/tmp/ansible-tmp-1586948169.0758207-28476717278723/ > /dev/null 2>&1 && sleep 0'

TASK [Get artifacts] ***************************************************************************************************************task path: /mnt/c/Users/.../_test_playbook.yml:46
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "artifact_id": "...",
            "attributes": null,
            "backup": null,
            "classifier": "",
            "content": null,
            "delimiter": null,
            "dest": "/tmp/",
            "directory_mode": null,
            "extension": "jar",
            "follow": false,
            "force": null,
            "group": null,
            "group_id": "com...",
            "headers": {
                "Authorization": "Basic <base64 encoded username:password>"
            },
            "http_agent": "Ansible 2.9.2 maven_artifact",
            "keep_name": true,
            "mode": null,
            "owner": null,
            "password": null,
            "regexp": null,
            "remote_src": null,
            "repository_url": "https://pkgs.dev.azure.com/...",
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": null,
            "state": "present",
            "timeout": 10,
            "unsafe_writes": null,
            "url_password": null,
            "url_username": null,
            "username": null,
            "validate_certs": true,
            "verify_checksum": "download",
            "version": "1.0.3"
        }
    },
    "msg": "Cannot retrieve the artifact to destination: Checksum does not match: we computed 21c1dfd2f1a3aa74e24220d1c8ac0582but the repository states 21C1DFD2F1A3AA74E24220D1C8AC0582"
}

PLAY RECAP *************************************************************************************************************************localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Wednesday 15 April 2020  12:56:11 +0200 (0:00:02.956)       0:00:03.037 *******
===============================================================================
Get artifacts --------------------------------------------------------------------------------------------------------------- 2.96s
@ansibullbot
Copy link
Collaborator

Files identified in the description:

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

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added affects_2.10 bug This issue/PR relates to a bug module module labels Apr 16, 2020
Akasurde added a commit to Akasurde/community.general that referenced this issue Apr 17, 2020
Fixes: ansible-collections#186

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Akasurde added a commit that referenced this issue Apr 17, 2020
Fixes: #186

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants