Fix setting nil attributes on host sets (#1746)
This is the analogue of #1743 but for host sets
This commit is contained in:
1 parent
dba5bc88a0
commit
5417cc5cb0
4 files changed
+66
-41
No files matched your search
@@ -290,13 +290,9 @@ func (r *Repository) UpdateSet(ctx context.Context, scopeId string, s *HostSet,
|
||||
|
||||
if updateAttributes {
|
||||
dbMask = append(dbMask, "attributes")
|
||||
if s.Attributes != nil {
|
||||
newSet.Attributes, err = patchstruct.PatchBytes(newSet.Attributes, s.Attributes)
|
||||
if err != nil {
|
||||
return nil, nil, nil, db.NoRowsAffected, errors.Wrap(ctx, err, op, errors.WithMsg("error in set attribute JSON"))
|
||||
}
|
||||
} else {
|
||||
newSet.Attributes = make([]byte, 0)
|
||||
newSet.Attributes, err = patchstruct.PatchBytes(newSet.Attributes, s.Attributes)
|
||||
if err != nil {
|
||||
return nil, nil, nil, db.NoRowsAffected, errors.Wrap(ctx, err, op, errors.WithMsg("error in set attribute JSON"))
|
||||
}
|
||||
|
||||
// Flag the record as needing a sync since we've updated
|
||||
|
||||
Reference in new issue
Block a user