Remove query variable refresh deprecation

Added with dd6582e9cc, we have found
that setting a bool here means the query variable no longer refreshes
at all.  Thus it's dangerous to accept it, force it to be an int.

For reference, the values seem to be

 0 = never refresh
 1 = on load
 2 = on timeseries change

Change-Id: Ia96f0166a80ece0b307acdca20eeca045a2e4a75
This commit is contained in:
Ian Wienand 2020-06-24 11:03:00 +10:00 committed by Clark Boylan
parent ad1e1e3537
commit 92ef419c01
6 changed files with 7 additions and 12 deletions

View File

@ -23,18 +23,13 @@ LOG = logging.getLogger(__name__)
class Query(Base):
def validate_refresh(self, data):
v.Schema(v.Any(v.All(int, v.Range(min=0, max=2)), bool))(data)
if isinstance(data, bool):
LOG.warn('templating query refresh type bool is deprecated')
return data
def get_schema(self):
query = {
v.Required('includeAll', default=False): v.All(bool),
v.Required('multi', default=False): v.All(bool),
v.Required('query', default=''): v.All(str),
v.Required('refresh', default=0): self.validate_refresh,
v.Required('refresh', default=1): \
v.All(int, v.Range(min=0, max=2)),
v.Optional('datasource'): v.All(str),
v.Optional('hide'): v.All(int, v.Range(min=0, max=2)),
}

View File

@ -10,7 +10,7 @@
"multi": false,
"name": "foobar",
"query": "foobar.*",
"refresh": 0,
"refresh": 1,
"type": "query"
}
]

View File

@ -45,7 +45,7 @@
"multi": false,
"name": "hostname",
"query": "node*",
"refresh": true,
"refresh": 1,
"type": "query"
}
]

View File

@ -7,7 +7,7 @@ dashboard:
type: query
datasource: graphite
query: node*
refresh: true
refresh: 1
title: New dashboard
rows:
- title: New row

View File

@ -59,7 +59,7 @@
"multi": false,
"name": "hostname",
"query": "node*",
"refresh": true,
"refresh": 1,
"type": "query"
}
]

View File

@ -4,7 +4,7 @@ dashboard:
type: query
datasource: graphite
query: node*
refresh: true
refresh: 1
hide: 0
title: New dashboard
rows: