Added --partwipe flag for set

This commit is contained in:
Christian Goll
2026-01-14 10:37:05 +01:00
parent b30a2cfb65
commit a0efd7fe08
5 changed files with 63 additions and 5 deletions

View File

@@ -659,6 +659,28 @@ nodeprofiles: {}
nodes:
n1: {}`,
},
"--partwipe": {
args: []string{"--partwipe", "--partname=var", "--diskname=/dev/vda", "n01"},
wantErr: false,
inDB: `
nodes:
n01:
disks:
/dev/vda:
partitions:
var:
number: "1"`,
outDB: `
nodeprofiles: {}
nodes:
n01:
disks:
/dev/vda:
partitions:
var:
number: "1"
wipe_partition_entry: true`,
},
}
for name, tt := range tests {

View File

@@ -227,6 +227,38 @@ nodeprofiles:
/dev/disk/by-partlabel/var:
format: btrfs
path: /var
nodes: {}`,
},
"single set partwipe to true": {
args: []string{"--partwipe=true", "--partname=var", "--diskname=/dev/vda", "default"},
wantErr: false,
inDB: `
nodeprofiles:
default:
disks:
/dev/vda:
partitions:
var:
number: "1"
filesystems:
/dev/disk/by-partlabel/var:
format: btrfs
path: /var
nodes: {}
`,
outDb: `
nodeprofiles:
default:
disks:
/dev/vda:
partitions:
var:
number: "1"
wipe_partition_entry: true
filesystems:
/dev/disk/by-partlabel/var:
format: btrfs
path: /var
nodes: {}`,
},
}

View File

@@ -110,7 +110,7 @@ type Partition struct {
StartMiB string `yaml:"start_mib,omitempty" json:"start_mib,omitempty" comment:"the start of the partition" type:"uint"`
TypeGuid string `yaml:"type_guid,omitempty" json:"type_guid,omitempty" lopt:"parttype" comment:"Set the partition type GUID"`
Guid string `yaml:"guid,omitempty" json:"guid,omitempty" comment:"the GPT unique partition GUID"`
WipePartitionEntryP *bool `yaml:"wipe_partition_entry,omitempty" json:"wipe_partition_entry,omitempty" comment:"if true, Ignition will clobber an existing partition if it does not match the config" name:"WipePartitionEntry"`
WipePartitionEntryP *bool `yaml:"wipe_partition_entry,omitempty" json:"wipe_partition_entry,omitempty" lopt:"partwipe" comment:"if true, Ignition will clobber an existing partition if it does not match the config" name:"WipePartitionEntry"`
ShouldExistP *bool `yaml:"should_exist,omitempty" json:"should_exist,omitempty" lopt:"partcreate" comment:"Create partition if it does not exist" name:"ShouldExist"`
ResizeP *bool `yaml:"resize,omitempty" json:"resize,omitempty" comment:"whether or not the existing partition should be resize" name:"Resize"`
}