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

grafana_team: ValueError: invalid literal for int() with base 10: '0+security-01' #295

Open
Lusitaniae opened this issue Nov 20, 2024 · 0 comments

Comments

@Lusitaniae
Copy link

Lusitaniae commented Nov 20, 2024

Ansible task

- name: Dedicated | Create a team with members and enforce the list of members
  community.grafana.grafana_team:
    grafana_url: "{{ grafana_url }}"
    url_username: "{{ grafana_user }}"
    url_password: "{{ grafana_pass }}"
    name: "{{ grafana_customer_team | default(grafana_customer_name) }}"
    email: ""
    # email: "{{ grafana_customer_users | first | map(attribute='email') }}"
    members: "{{ (grafana_customer_users | map(attribute='email') | list) | union(default_team_members) }}"
    enforce_members: true
    state: "{{ grafana_customer_state | default('present') }}"

Error


TASK [customer_grafana : Dedicated | Create a team with members and enforce the list of members] ************************************************************************************************************************
Wednesday 20 November 2024  20:47:39 +0700 (0:00:00.017)       0:00:01.130 **** 
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: invalid literal for int() with base 10: '0+security-01'
fatal: [localhost]: FAILED! => {
    "changed": false,
    "rc": 1
}

MSG:

MODULE FAILURE
See stdout/stderr for the exact error


MODULE_STDERR:

Traceback (most recent call last):
  File "/home/i/.ansible/tmp/ansible-tmp-1732110459.3338897-526270-264601147465263/AnsiballZ_grafana_team.py", line 107, in <module>
    _ansiballz_main()
  File "/home/i/.ansible/tmp/ansible-tmp-1732110459.3338897-526270-264601147465263/AnsiballZ_grafana_team.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/i/.ansible/tmp/ansible-tmp-1732110459.3338897-526270-264601147465263/AnsiballZ_grafana_team.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.community.grafana.plugins.modules.grafana_team', init_globals=dict(_module_fqn='ansible_collections.community.grafana.plugins.modules.grafana_team', _modlib_path=modlib_path),
  File "<frozen runpy>", line 226, in run_module
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "/tmp/ansible_community.grafana.grafana_team_payload__g8t1k47/ansible_community.grafana.grafana_team_payload.zip/ansible_collections/community/grafana/plugins/modules/grafana_team.py", line 376, in <module>
  File "/tmp/ansible_community.grafana.grafana_team_payload__g8t1k47/ansible_community.grafana.grafana_team_payload.zip/ansible_collections/community/grafana/plugins/modules/grafana_team.py", line 334, in main
  File "/tmp/ansible_community.grafana.grafana_team_payload__g8t1k47/ansible_community.grafana.grafana_team_payload.zip/ansible_collections/community/grafana/plugins/modules/grafana_team.py", line 202, in __init__
  File "/tmp/ansible_community.grafana.grafana_team_payload__g8t1k47/ansible_community.grafana.grafana_team_payload.zip/ansible_collections/community/grafana/plugins/modules/grafana_team.py", line 246, in get_version
ValueError: invalid literal for int() with base 10: '0+security-01'

The result from the get version API

{'database': 'ok', 'version': '11.3.0+security-01', 'commit': '5ddc329279bb66e3fd584812b8a4e16751eeecd0'}

Which seems to fail the parsing here

    def get_version(self):
        url = "/api/health"
        response = self._send_request(
            url, data=None, headers=self.headers, method="GET"
        )
        print(response)
        version = response.get("version")
        if version is not None:
            major, minor, rev = version.split(".")
            return {"major": int(major), "minor": int(minor), "rev": int(rev)}
        raise GrafanaError("Failed to retrieve version from '%s'" % url)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant