andsens / build-debian-cloud

This project has been superseeded by andsens/bootstrap-vz and is no longer maintained - Script to create Debian Squeeze & Wheezy Amazon Machine Images (AMIs) and Google Compute Engine images
Other
117 stars 43 forks source link

package additions when not $TASK_PACKAGES #61

Closed yanfalies closed 11 years ago

yanfalies commented 11 years ago

I ran into an interesting bug, self created, where I specified additional packages but in a task that ran long after TASK_PACKAGES, so there was no way for the package to be installed as it was too late into the build process.

I wondering if there was some way to print a warning if a task alters packages after TASK_CREATE_VOLUME to let the user know that basically it won't add the package.

So what I did was add a package, sudo, in a task that ran after TASK_INITSCRIPTS and of course that could never work because it was too late.

So I'm thinking to detect this

  1. cache the length of packages after TASK_PACKAGES
  2. check the cache against the length of packages array before each task starts and print a warning that someone modified packages and it's running too late.

What do you think?

Yan

andsens commented 11 years ago

I understand the frustration this must have caused, but I think it would be better to add more instructions to the plugin documentation.
Thing is: This is an internal variable, if we start verifying those it's never going to end (excluded_packages, host_packages...?).
Verification of such things can also bring with them their own sets of bugs and make the whole script less modifiable. I would opt for the KISS approach here.