Skip to content

search_dashboards method works incorrectly if to use a list for the tag option #240

@vladchel

Description

@vladchel

Try to search dashboards by several tags. E.g. TAG1 and TAG2 are assigned to some dashboard. In this case
grafana.search.search_dashboards(tag=['TAG1', 'TAG2'])
should find this dashboard. Really nothing will be found.

To Reproduce
Steps to reproduce the behavior:

  1. Create a dashboard with TAG1 and TAG2 tags
  2. Run grafana.search.search_dashboards(tag=['TAG1', 'TAG2'])
  3. See an empty search result

Expected behavior
The dashboard with these tags is found.

Versions

  • Grafana: 12.0.2
  • grafana-client: 5.0.1
  • Authentication: Token

Additional context
This happens because all list parameters are joined by the comma inside format_param_value method. If to remove this call inside search_dashboards or replace

def format_param_value(maybe_list):
    if isinstance(maybe_list, list):
        return ",".join([str(x) for x in maybe_list])
    else:
        return maybe_list

to

def format_param_value(maybe_list):
    return maybe_list

all works fine. This problem is related to all list options of search_dashboards (e.g. folder_uids).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions