-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: add option to reattach cdroms #327
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code wise this looks good. But I have mixed feelings about the attribute name.
Yes, it was an issue for me as well, but I settled on the reset and provided additional details in the comments for the docs. Using remove and keep didn't fit for me because it infers all. Using keep_one felt odd because that would limit the ability to expand the option later, if needed. Do any other plugins have a similar feature? |
@akutz what are your thoughts on the parameter name? |
What about one of It could default to 0 (and maybe have a a maximum of the number of CD-ROMs that exist on the VM). For a hypothetical packer VM with 3 CD-ROMs:
|
I'll noodle this after the US Holiday week. |
Cool! Another possibility is to add a "post-shutdown hardware configuration" that would let you alter the overall hardware of the VM before it is made into a template or exported, but I think that's more along the lines of a future feature request :) |
Might be a good post-processor. |
@nywilken @lbajolet-hashicorp - I'm going to pick this one back up this week in my spare time. |
Sounds good @tenthirtyam thanks for picking this back up. Feel free to ping when ready for review. |
72231cd
to
e36def4
Compare
76a198a
to
1c8a86f
Compare
1a19328
to
cb0f42d
Compare
cb0f42d
to
0c292de
Compare
This pull request is ready for review but is failing for some reason on the Go Validate > Lint step. |
0c292de
to
62b561e
Compare
62b561e
to
f8dd848
Compare
da90efe
to
397dd93
Compare
02c1493
to
ff82b77
Compare
ff82b77
to
a8898db
Compare
@nywilken - per our Slack discussion, I've updated this to reflect `reattach_cdroms` (int) - Reattach one or more configured CD-ROM devices. Range: 1-4.
You can reattach up to 4 CD-ROM devices to the final build artifact.
If set to 0, `reattach_cdroms` is ignored and the step is skipped.
When set to a value in the range, `remove_cdrom` is ignored and
the CD-ROM devices are reattached without any attached media. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Nice rework. I left a couple of suggestions. Once applied we can merge. #352 will need to be rebased and updated to remove AddCdromCalled from the Reattach tests.
docs-partials/builder/vsphere/common/KeepCDRomConfig-not-required.mdx
Outdated
Show resolved
Hide resolved
a8898db
to
7563fce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adds support for to reattach CD-ROMs on the image after the build completes. Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
7563fce
to
57401c7
Compare
Summary
Adds support for to reattach CD-ROMs on the image after the build completes without any attached media.
reattach_cdroma
is ignored and the step is skipped.reattach_cdroms
is set to a value in the range,remove_cdrom
is ignored and the CD-ROM devices are reattached without any attached media.Cherry-picks commits from @powertim in #326 and updates scope, prepare, and tests.
Tests
Standards Tests
Builds:
✅ Build with
remove_cdrom
=true
. Expected results: All CD-ROMs removed,reattach_cdroms
ignored.✅ Build with
reattach_cdroms
=0
andremove_cdrom
=false
. Expected results: All CD-ROMs kept,reattach_cdroms
ignored.✅ Build with
reattach_cdroms
=1
andremove_cdrom
=false
. Expected results: One CD-ROM remains.✅ Build with
reattach_cdroms
=1
andremove_cdrom
=true
. Expected results: One CD-ROM remains.reset_cdrom
is superceeded byreattach_cdrom
.✅ Build with
reattach_cdroms
=2
andremove_cdrom
=false
. Expected results: Two CD-ROMs remain.✅ Build with
reattach_cdroms
=2
andremove_cdrom
=true
. Expected results: Two CD-ROMs remainsreset_cdrom
is superceeded byreattach_cdroms
.✅ Build with
reattach_cdroms
=3
andremove_cdrom
=false
. Expected results: Three CD-ROMs remain.✅ Build with
reattach_cdroms
=3
andremove_cdrom
=true
. Expected results: Three CD-ROMs remainsreset_cdrom
is superceeded bykeep_cdrom
.✅ Build with
reattach_cdroms
=4
andremove_cdrom
=false
. Expected results: Four CD-ROMs remain.✅ Build with
reattach_cdroms
=4
andremove_cdrom
=true
. Expected results: Four CD-ROMs remainsreset_cdrom
is superceeded bykeep_cdrom
.✅ Build with
reattach_cdroms
=5
andremove_cdrom
=false
. Expected results: Caught inPrepare( )
.Reference
Closes #24
Supersedes #326