looker-open-source/gzr

New dashboard validation failure on import (starting with 0.2.59 and 0.3.0)

Closed this issue · 8 comments

When previously importing dashboards, when the dashboard already existed, this would simply overwrite it.

We are getting a new validation error, seen below. This is problematic as it would require us to delete a dashboard on the many different looker stacks we deploy to. We rely on overwriting in the destination folders for dashboards with the same name.

Did something change in the newest versions of gzr?

This error occurs when using gazer 0.2.59 and 0.3.0. Using prior versions no longer works (0.58, 56, etc)

POST https://clientname.looker.qventus.com:19999/api/4.0/dashboards: 422 - Validation Failed
Error summary:
  field: [:title, :space_id]
  code: already_exists
  message: Dashboard with this title already exists.

image

There is substantial code involved in detecting if the title is already used and performing an update instead of a create. Is it possible that the user used to do the import has changed? If the user can't "see" the existing dashboard this error could occur.

What do you mean by the "header"? Precisely which fields?

Sorry, that was vague. This is an example. If I match the destination dashboard's set of fields below, the dashboard will overwrite correctly. If I do not, then it will fail validation ("Dashboard with same name already exists").

"content_metadata_id": "1300",
"description": "",
"hidden": false,
"query_timezone": null,
"readonly": false,
"refresh_interval": null,
"refresh_interval_to_i": null,
"title": "Baseline EDD GMLOS Model Performance",
"user_id": "16",
"slug": "{slug}",
"preferred_viewer": "dashboards-next",
"alert_sync_with_dashboard_filter_enabled": false,
"background_color": null,
"created_at": "2023-02-01 01:10:50 +0000",
"crossfilter_enabled": false,

Thanks for your attention to this. It is helpful. Can you rerun with the --debug flag and send me that output?

OK. That debug info helps a lot.

You are trying to import a dashboard named "Baseline EDD GMLOS Model Performance". I think that is what is in your source file. But gazer is trying to match it to an existing dashboard by the name of "Baseline EDD GMLOS Model Performance Updated", and update its name to "Baseline EDD GMLOS Model Performance". There already is a dashboard with that name. It is possibly soft-deleted. But that is why we are getting the error.

Gazer does the match on slug first, and on title only if a matching slug is not found. I bet you started with dashboard "/NAME", copied it to "/NAME/ Updated". The copy got a new slug. you exported it and worked on it in another system and renamed it to "/NAME/". The slug wasn't used so the slug was maintained. No you are trying to import it back to the original system. The slug points to one version of the dash, but the name to a different version.

If you take the slug out of the source json file, the matching should work on name and it should update the existing dash of the same name.

This is super helpful. So essentially, if I want to force match on Name only, despite having a new slug, delete the slug from the source .json. Then when the source file matches to destination on name, it will preserve the slug in the destination folder, maintain the same name, but update the content to the new source file. Do I have that right?