Skip to content

Commit 64a2236

Browse files
schnoddelbotzstgraber
authored andcommitted
incus/copy: Clear full device when overriding with type=none
Closes #1751 Signed-off-by: Jan Hacker <[email protected]>
1 parent 973cecb commit 64a2236

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cmd/incus/copy.go

+12
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ func (c *cmdCopy) copyInstance(conf *config.Config, sourceResource string, destR
206206
continue
207207
}
208208

209+
if m["type"] == "none" {
210+
// When overriding with "none" type, clear the entire device.
211+
entry.Devices[k] = map[string]string{"type": "none"}
212+
continue
213+
}
214+
209215
for key, value := range m {
210216
entry.Devices[k][key] = value
211217
}
@@ -298,6 +304,12 @@ func (c *cmdCopy) copyInstance(conf *config.Config, sourceResource string, destR
298304
continue
299305
}
300306

307+
if m["type"] == "none" {
308+
// When overriding with "none" type, clear the entire device.
309+
entry.Devices[k] = map[string]string{"type": "none"}
310+
continue
311+
}
312+
301313
for key, value := range m {
302314
entry.Devices[k][key] = value
303315
}

0 commit comments

Comments
 (0)