mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-15 09:01:31 +00:00
fix: CopyImage carries Distro and DistroFamily from the source AMI
The copy was built field by field and dropped both, so cloud-init family detection was lost on copied images.
This commit is contained in:
@@ -897,6 +897,8 @@ func (s *ImageServiceImpl) CopyImage(ctx context.Context, input *ec2.CopyImageIn
|
||||
ImageOwnerAlias: accountID,
|
||||
CreationDate: time.Now().UTC(),
|
||||
BootMode: srcMeta.BootMode,
|
||||
Distro: srcMeta.Distro,
|
||||
DistroFamily: srcMeta.DistroFamily,
|
||||
Tags: tags,
|
||||
SourceDigest: srcMeta.SourceDigest,
|
||||
// Zero-copy: the new config shares the source's already-durable
|
||||
|
||||
@@ -1781,6 +1781,8 @@ func TestCopyImage_InheritsSourceFields(t *testing.T) {
|
||||
RootDeviceType: "ebs",
|
||||
Description: "arm source",
|
||||
BootMode: "uefi",
|
||||
Distro: "debian-12",
|
||||
DistroFamily: "debian",
|
||||
SourceDigest: digest,
|
||||
})
|
||||
|
||||
@@ -1796,6 +1798,8 @@ func TestCopyImage_InheritsSourceFields(t *testing.T) {
|
||||
assert.Equal(t, uint64(32), newMeta.VolumeSizeGiB)
|
||||
assert.Equal(t, "ebs", newMeta.RootDeviceType)
|
||||
assert.Equal(t, "uefi", newMeta.BootMode, "CopyImage must propagate BootMode from source")
|
||||
assert.Equal(t, "debian-12", newMeta.Distro, "CopyImage must propagate Distro from source")
|
||||
assert.Equal(t, "debian", newMeta.DistroFamily, "cloud-init family detection reads DistroFamily")
|
||||
assert.Equal(t, digest, newMeta.SourceDigest, "a zero-copy share still holds the source artifact")
|
||||
assert.False(t, newMeta.CreationDate.Before(before), "CreationDate must be refreshed on copy, not inherited")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user