Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

binary checksum seems broken #117

Closed
teochenglim opened this issue Mar 3, 2020 · 4 comments
Closed

binary checksum seems broken #117

teochenglim opened this issue Mar 3, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@teochenglim
Copy link

teochenglim commented Mar 3, 2020

What happened?
The checksum always failed and the whole playbook failed. Suspect ansible lookup doesn't following link with HTTP 302

Did you expect to see some different?
Checksum is correctly pulled?

How to reproduce it (as minimally and precisely as possible):

git clone https://github.com/cloudalchemy/ansible-alertmanager roles/alertmanager
Create a basic playbook and include it as roles.

Environment

$ curl -s https://github.com/prometheus/alertmanager/releases/download/v0.20.0/sha256sums.txt
<html><body>You are being <a href="https://github-production-release-asset-2e65be.s3.amazonaws.com/11452538/a510c800-1c60-11ea-8d4c-414fc4fea6b5?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200303%2Fus-east-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20200303T081307Z&amp;X-Amz-Expires=300&amp;X-Amz-Signature=857a1313e6f3cf669e7cef5c2fceb7b529cab239a1835ba201aad78b68bc6748&amp;X-Amz-SignedHeaders=host&amp;actor_id=0&amp;response-content-disposition=attachment%3B%20filename%3Dsha256sums.txt&amp;response-content-type=application%2Foctet-stream">redirected</a>.</body></html>

$ curl -s https://github.com/prometheus/alertmanager/releases/download/v0.20.0/sha256sums.txt -L
78d741b3bdcb910619f498d7662969cae363c9d5840d7cef1e5481f103de59ca  alertmanager-0.20.0.darwin-386.tar.gz
5134585c6200856ca70f61502a460413f6a0e6c848e7156724e5d568f77aba56  alertmanager-0.20.0.darwin-amd64.tar.gz
8bc8ac50a4a7545b0a2e6a6d710ab4c51e8ccd85d519013db9495e4549546f93  alertmanager-0.20.0.dragonfly-amd64.tar.gz
810fabaad75f1d5d172f48eeafb6099f669c37baababff458e798474e006969e  alertmanager-0.20.0.freebsd-386.tar.gz
5789adb5d4da773ec8480458c3d445985d9fbb3ce8cbe939090508b0a96f436d  alertmanager-0.20.0.freebsd-amd64.tar.gz
645fd8b1bb541a360521b12694e7483017f9c5b95152a313630b8f3c06cbeb3e  alertmanager-0.20.0.freebsd-armv6.tar.gz
48d3b69ca5618bd6632b10563eab1e7331ffdf9e1b6943cc34002beaccdec7cb  alertmanager-0.20.0.freebsd-armv7.tar.gz
0f922a82a7358a33736d388faa9b44c661f4844c15a4c2eadeb71d1f6738bd66  alertmanager-0.20.0.linux-386.tar.gz
3a826321ee90a5071abf7ba199ac86f77887b7a4daa8761400310b4191ab2819  alertmanager-0.20.0.linux-amd64.tar.gz
ee219113b4dad6042f3f88dccea48ee15ac5e7d5c84933bc90f320819b71e1c5  alertmanager-0.20.0.linux-arm64.tar.gz
11d92562c72d9fc747db45bcf48d181f3db7b178a254af4877f74ab20f986a6a  alertmanager-0.20.0.linux-armv5.tar.gz
89762e97cb18b4a47557cf74734fb398645ea5d8191b71b248b0dc515073e370  alertmanager-0.20.0.linux-armv6.tar.gz
5ebd33da8d61cef6ea1aab2ecc73310ff3fe4320eb76851ae71e22e3c5ddbc36  alertmanager-0.20.0.linux-armv7.tar.gz
fbd6ab4471b4c9c167d7fbe8f4b90cca2415b2d5426a7ce74734a9182613573e  alertmanager-0.20.0.linux-mips64.tar.gz
5ea2ee935119d15247359d9bf1124c00dfb8e62882be8862721a477ff728b3b4  alertmanager-0.20.0.linux-mips64le.tar.gz
66c1aa886c48e6aef7cda3d835fa985254d59a2a811b204f69aa806e7796e806  alertmanager-0.20.0.linux-ppc64.tar.gz
1cf6e81a3964e63019026518574722922fd6d98fb256f3dba49efdcff20b14ff  alertmanager-0.20.0.linux-ppc64le.tar.gz
53e8be5b029dc00fce97d1f79d5202a54ad5b20aa5ca135fc168f5eefd0f6b5c  alertmanager-0.20.0.linux-s390x.tar.gz
d53382b389139876e13e22f500c19cd79fde67ab899dae51961bdb0e097734e0  alertmanager-0.20.0.netbsd-386.tar.gz
378a19ab208631f989ab353b0b3e3e4c1637202ca1b6c47f134ce1470560912f  alertmanager-0.20.0.netbsd-amd64.tar.gz
2defc8b8ab59a291aa0e81c032aa27185e9c4ea702858e7e994f0df1dafd4164  alertmanager-0.20.0.netbsd-armv6.tar.gz
8463f50957935c1723d1f2ec5d386c9a1379442dde655d8ea430d6ded1a9d47e  alertmanager-0.20.0.netbsd-armv7.tar.gz
476edebdff737cc7356556637b8caaea7b3708a2b8b370ab8d3201bd2c52cc36  alertmanager-0.20.0.openbsd-386.tar.gz
039d0fc1cc00e710f94ceda53f1bb4ec22341965c0e4bc623ab511edf1d61930  alertmanager-0.20.0.openbsd-amd64.tar.gz
28ad18728935412dcddc10a6ab7bdd4858bd7c832444bfb1880266caf2a310f6  alertmanager-0.20.0.windows-386.tar.gz
5887902bea633d8b3396804760308acc0a2631b7ca85df75d8c526cd1985d62b  alertmanager-0.20.0.windows-amd64.tar.gz
  • Role version:

    de29024767b37a6df1073cbf86254ea908a378a0

  • Ansible version information:

    $ ansible --version
ansible 2.9.4
  config file = /Users/teochenglim/thunes/sysadmin/ansible/projects/cobra/ansible.cfg
  configured module search path = ['/Users/teochenglim/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.9.4_1/libexec/lib/python3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.1 (default, Dec 27 2019, 18:06:00) [Clang 11.0.0 (clang-1100.0.33.16)]
  • Variables:

my work around as to hard code it.

go_arch: "amd64"
alertmanager_checksum: "3a826321ee90a5071abf7ba199ac86f77887b7a4daa8761400310b4191ab2819"
  • Ansible playbook execution Logs:
 ___________________________________________________________
< TASK [alertmanager : Get checksum for amd64 architecture] >
 -----------------------------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

objc[72571]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[72571]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
ERROR! A worker was found in a dead state

Anything else we need to know?:

I commented out 1 job at file task/preflight.yml
Hard coded the variable using group_var.
I am running this on MacOS

# - name: "Get checksum for {{ go_arch }} architecture"
#   set_fact:
#     alertmanager_checksum: "{{ item.split(' ')[0] }}"
#   with_items:
#     - "{{ lookup('url', 'https://github.com/prometheus/alertmanager/releases/download/v' + alertmanager_version + '/sha256sums.txt', wantlist=True) | list }}"
#   when:
#     - "('linux-' + go_arch + '.tar.gz') in item"
#     - alertmanager_binary_local_dir | length == 0
go_arch: "amd64"
alertmanager_checksum: "3a826321ee90a5071abf7ba199ac86f77887b7a4daa8761400310b4191ab2819"
@teochenglim teochenglim added the bug Something isn't working label Mar 3, 2020
@paulfantom
Copy link
Member

__NSCFConstantString initialize

Suggests common ansible problem on MacOS. More in cloudalchemy/ansible-prometheus#230 (comment)

Closing this as it is not an issue with role, but with ansible module.

@teochenglim
Copy link
Author

Would you consider to replace it with other more straight forward module?

https://docs.ansible.com/ansible/latest/modules/get_url_module.html

- name: Download file with checksum url (sha256)
  get_url:
    url: http://example.com/path/file.conf
    dest: /etc/foo.conf
    checksum: sha256:http://example.com/path/sha256sum.txt

@paulfantom
Copy link
Member

This is not converting one execution to another, but converting one task into 2 or 3 and arranging them in a block, how is that more straight forward?

To get a checksum we need to do the following:

  1. download a file
  2. parse content based on system architecture
  3. assign parsed data to a variable

IMHO changing set_fact + lookup into a get_url doesn't provide a cleaner solution. Changing it would mean we need to add get_url to download a file and save it somewhere (which already is problematic if we want to have a multi-platform role), next add another task to slurp the content, parse it, and assign it to a variable.

@teochenglim
Copy link
Author

teochenglim commented Apr 24, 2020

found the solution on MacOS... it is a old new problem.

ansible/ansible#32499

$ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants