Scott Moser has proposed merging ~smoser/cloud-init:fix/ci-allow-deb-older-than-distro into cloud-init:master.
Commit message: tests: Hold the version of cloud-init fixing dependencies. If 'dpkg -i <to-be-tested>.deb' failed due to missing dependencies we tried to fix the situation with 'apt-get -f install'. That usually did the right thing. However, if apt knew about a newer version in the archive, then it would upgrade to resolve the issue. That would be caught, but would cause failure of the test. So, we hold cloud-init before we use 'apt-get -f install', and then un-hold it afteward. Last, we verify that all is good by re-installing the same deb. Requested reviews: cloud-init commiters (cloud-init-dev) For more details, see: https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/334074 -- Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:fix/ci-allow-deb-older-than-distro into cloud-init:master.
diff --git a/tests/cloud_tests/setup_image.py b/tests/cloud_tests/setup_image.py index 6672ffb..30ec700 100644 --- a/tests/cloud_tests/setup_image.py +++ b/tests/cloud_tests/setup_image.py @@ -50,9 +50,18 @@ def install_deb(args, image): LOG.debug(msg) remote_path = os.path.join('/tmp', os.path.basename(args.deb)) image.push_file(args.deb, remote_path) - cmd = 'dpkg -i {}; apt-get install --yes -f'.format(remote_path) - image.execute(cmd, description=msg) - + # install the package with dpkg. If that fails, then try to + # fix the situation by installing some deps. hold cloud-init or + # --fix-broken will replace the dpkg -i version if newer version + # is available. + cmd = '\n'.join([ + 'dpkg -i {} && exit'.format(remote_path), + 'echo cloud-init hold | dpkg --set-selections', + 'apt-get --fix-broken --yes install', + 'echo cloud-init install | dpkg --set-selections', + 'dpkg -i {}'.format(remote_path) + ]) + image.execute(['sh', '-ec', cmd], description=msg) # check installed deb version matches package fmt = ['-W', "--showformat=${Version}"] (out, err, exit) = image.execute(['dpkg-deb'] + fmt + [remote_path])
_______________________________________________ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp