yaml2: Meta should keep defaults, and Res should have kind
This would previously panic since it wouldn't get a kind, and the meta
parameters would overwrite the defaults so it would block because limit
didn't have the default of +inf.
The removal of the SetKind was my fault in:
b8ff6938df
It's funny because it ends in `bad`. Guess I should have checked that!
This commit is contained in:
@@ -53,8 +53,7 @@ type Edge struct {
|
|||||||
|
|
||||||
// ResourceData are the parameters for resource format.
|
// ResourceData are the parameters for resource format.
|
||||||
type ResourceData struct {
|
type ResourceData struct {
|
||||||
Name string `yaml:"name"`
|
Name string `yaml:"name"`
|
||||||
Meta resources.MetaParams `yaml:"meta"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resource is the object that unmarshalls resources.
|
// Resource is the object that unmarshalls resources.
|
||||||
@@ -132,10 +131,10 @@ func (r *Resource) Decode(kind string) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set resource name, meta and kind
|
// set resource name and kind
|
||||||
r.resource.SetName(r.Name)
|
r.resource.SetName(r.Name)
|
||||||
meta := r.resource.Meta()
|
r.resource.SetKind(strings.ToLower(kind)) // gets overwritten, so set it
|
||||||
*meta = r.Meta
|
// meta already gets unmarshalled properly with the correct defaults
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user