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

prometheus_version: latest => failed to get sha256sums.txt #230

Closed
Poil opened this issue Sep 20, 2019 · 10 comments
Closed

prometheus_version: latest => failed to get sha256sums.txt #230

Poil opened this issue Sep 20, 2019 · 10 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Poil
Copy link

Poil commented Sep 20, 2019

Hi,

A little error :)

FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'url'. Error was a <class 'ansible.errors.AnsibleError'>, original message: Received HTTP error for https://github.com/prometheus/prometheus/releases/download/vlatest/sha256sums.txt : HTTP Error 404: Not Found"}

Best regards

@paulfantom paulfantom added bug Something isn't working help wanted Extra attention is needed labels Sep 23, 2019
@paulfantom
Copy link
Member

paulfantom commented Sep 23, 2019

What was the status of Get latest release task in run with prometheus_version: latest? Did you run playbook with some tags specified, if so with which ones?

@Poil
Copy link
Author

Poil commented Sep 23, 2019

Hi,

It looks like the version is set but not taken into account in the checksum download task

TASK [cloudalchemy.prometheus : Get latest release] is OK (very long json)

And after

TASK [cloudalchemy.prometheus : Set prometheus version to 2.12.0] 

task path: /home/bdupuis/git/vpnssl/ansible/roles/cloudalchemy.prometheus/tasks/preflight.yml:91
Monday 23 September 2019  10:36:53 +0200 (0:00:02.941)       0:00:07.842 ****** 

ok: [vpnssl-d01-mon] => {
    "ansible_facts": {
        "prometheus_version": "2.12.0"
    }, 
    "changed": false
}

I tried to look in preflight.yml but I don't understand why it's not working. (ansible 2.8.4)

@paulfantom
Copy link
Member

paulfantom commented Sep 23, 2019

It looks like for some reason prometheus_version is not passed to next tasks. All this is happening in https://github.com/cloudalchemy/ansible-prometheus/blob/master/tasks/preflight.yml#L75-L101. It is strange that there is any error here as we are constantly checking the validity of that piece of code with molecule playbook at https://github.com/cloudalchemy/ansible-prometheus/blob/master/molecule/latest/playbook.yml

Which ansible version are you using?

@Poil
Copy link
Author

Poil commented Sep 23, 2019

ansible 2.8.4
  config file = /home/xxxx/git/vpnssl/ansible/ansible.cfg
  configured module search path = [u'/home/xxxx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.16 (default, Jul  9 2019, 16:43:02) [GCC 8.3.0]

@paulfantom
Copy link
Member

PR #239 can act as a workaround for this issue.

@x25
Copy link

x25 commented Nov 20, 2019

got the same error on MacOS Mojave

TASK [cloudalchemy.prometheus : Get checksum for amd64 architecture] *****************************************************************************************
objc[4197]: +[NSValue initialize] may have been in progress in another thread when fork() was called.
objc[4197]: +[NSValue 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.

this error could be temporary resolved by exporting OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

@paulfantom
Copy link
Member

@x25 this is an ansible problem and not something we can fix here.

@KevinGimbel
Copy link

KevinGimbel commented Nov 27, 2019

In case anyone is looking for a workaround: ansible/ansible#62244 (comment)

The following works on MacOS (10.14.6).

$ OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES ansible-playbook site.yml

Another workaround for MacOS Catalina: ansible/ansible#65108 (comment)

Edit: Just realized the above comment also mentions the env variable 🤦‍♂; Anyway links to ansible bug tracker are relevant IMO

@paulfantom
Copy link
Member

This is a general python issue on macOS and I do not treat it as an issue with ansible role itself. I am closing this as good workarounds are provided in #230 (comment)

@zachcheung
Copy link

$ cat playbook.yml
---
- name: Run role
  hosts: all
  any_errors_fatal: true
  roles:
    - cloudalchemy.prometheus
  vars:
    prometheus_version: latest

When you run ansible-playbook -v playbook.yml, it will be OK, but if you pass prometheus_version=latest in cmd ansible-playbook -v playbook.yml -e prometheus_version=latest it'll fail:

  msg: 'An unhandled exception occurred while running the lookup plugin ''url''. Error was a <class ''ansible.errors.AnsibleError''>, original message: Received HTTP error for https://github.com/prometheus/prometheus/releases/download/vlatest/sha256sums.txt : HTTP Error 404: Not Found'
$ cat playbook.yml
---
- name: Run role
  hosts: all
  any_errors_fatal: true
  tasks:
    - include_role:
        name: cloudalchemy.prometheus
      vars:
        prometheus_version: latest

If you use in include_role along with vars, it'll also fail to run ansible-playbook -v playbook.yml.

It's all because of variable precedence, vars from -e or vars in include_role has higher priority than set_fact in preflight.yml.

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

No branches or pull requests

5 participants