Skip to content
This repository was archived by the owner on May 31, 2023. It is now read-only.
This repository was archived by the owner on May 31, 2023. It is now read-only.

adding datasource fails  #72

@alfozan

Description

@alfozan

Task:

  - name: add prometheus datasource
    grafana_datasource:
      name: prometheus
      grafana_url: "http://localhost:3000"
      url: "http://prometheus:9090"
      ds_type: prometheus
      basic_auth_user: admin
      basic_auth_password: admin

Error:

TASK [add prometheus datasource] **************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: a bytes-like object is required, not 'str'
fatal: [node01]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_0qkfiabg/ansible_module_grafana_datasource.py\", line 540, in <module>\n    main()\n  File \"/tmp/ansible_0qkfiabg/ansible_module_grafana_datasource.py\", line 523, in main\n    result = grafana_create_datasource(module, module.params)\n  File \"/tmp/ansible_0qkfiabg/ansible_module_grafana_datasource.py\", line 376, in grafana_create_datasource\n    auth = base64.b64encode(to_bytes('%s:%s' % (data['grafana_user'], data['grafana_password'])).replace('\\n', ''))\nTypeError: a bytes-like object is required, not 'str'\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
$ ansible --version
ansible 2.6.1
  python version = 3.6.5 (default, Jun 17 2018, 12:13:06) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions