sysdiglabs/sysdig-sdk-python

TypeError: string indices must be integers when calling add_dashboard_panel

victoria-miltcheva opened this issue · 1 comments

Hi there,

I'm attempting to add a dashboard panel to a newly-created dashboard when running this script, but I get the following error:

  File "/Users/<REDACTED>/.pyenv/versions/3.8.5/lib/python3.8/site-packages/sdcclient/monitor/_dashboards_v3.py", line 169, in add_dashboard_panel
    new_panel_id = dboard["panels"][-1]["id"] + 1
TypeError: string indices must be integers

It occurs on this line. I can confirm that my local configuration (API key, endpoint URL, instance ID) is correct since I haven't had any issues executing other functions from this SDK.

I noticed I get a similar error on line 46 of dashboard_save_load.py.

  File "/Users/<REDACTED>/.pyenv/versions/3.8.5/lib/python3.8/site-packages/sdcclient/monitor/_dashboards_v3.py", line 381, in create_dashboard_from_file
    return self.create_dashboard_from_template(dashboard_name, dashboard, filter, shared, public)
  File "/Users/<REDACTED>/.pyenv/versions/3.8.5/lib/python3.8/site-packages/sdcclient/monitor/_dashboards_v3.py", line 271, in create_dashboard_from_template
    template['id'] = None
TypeError: list indices must be integers or slices, not str

For context, I'm running Python 3.8.5 on a macOS Big Sur Version 11.3.1. I'm also using version 0.16.0 of the sdcclient.