mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-07-23 12:51:40 +02:00
Check validity of cluster.json files
This commit is contained in:
@@ -92,7 +92,7 @@ func (e *MetricScope) UnmarshalGQL(v interface{}) error {
|
||||
}
|
||||
|
||||
*e = MetricScope(str)
|
||||
if _, ok := metricScopeGranularity[*e]; !ok {
|
||||
if !e.Valid() {
|
||||
return fmt.Errorf("%s is not a valid MetricScope", str)
|
||||
}
|
||||
return nil
|
||||
@@ -102,6 +102,11 @@ func (e MetricScope) MarshalGQL(w io.Writer) {
|
||||
fmt.Fprintf(w, "\"%s\"", e)
|
||||
}
|
||||
|
||||
func (e MetricScope) Valid() bool {
|
||||
gran, ok := metricScopeGranularity[e]
|
||||
return ok && gran > 0
|
||||
}
|
||||
|
||||
func (jd *JobData) Size() int {
|
||||
n := 128
|
||||
for _, scopes := range *jd {
|
||||
|
Reference in New Issue
Block a user