Code review comment for lp:~gnuoy/charms/precise/gunicorn/gunicorn-apt-lock-checking

Revision history for this message
Mark Mims (mark-mims) wrote :

notes on general soln to apt lock contention between primary and sub(s)...

------------------------8<---------------------------

Juan,

Just to follow up, I've been playing with aptdcon as an alternative to
apt-get. So we can definitely do this to install the dotdee and pwgen
packages.

$ echo y | DEBIAN_FRONTEND=3Dnoninteractive sudo aptdcon --install "dotde=
e
pwgen"

Setting DEBIAN_FRONTEND and using sudo are of course not necessary in a
hook; the yes command doesn't work, presumably because aptdcon is not
supporting SIGPIPE properly, so use echo y.

You can also add a repository using --add-repository or do an upgrade;
this is reasonably well documented in the man page.

I didn't see how to manage the package index update with aptdcon, but
it's certainly possible with a short Python fragment:

from aptdaemon import client

apt_client =3D client.AptClient()
apt_client.update_cache(wait=3DTrue) # implicitly runs, waits until
finished. Good for install hooks!

Lastly, we can combine these approaches together; call the following
file: install-some-packages.py

from aptdaemon import client

apt_client =3D client.AptClient()
apt_client.install_packages(package_names=3D["pwgen", "dotdee"], wait=3DT=
rue)

$ yes | DEBIAN_FRONTEND=3Dnoninteractive sudo python ./apt-update.py

In terms of a quick analysis of charms out there, the one other option I
saw in apt-get usage that's out there is --no-install-recommends. No
clear way to do this in aptdaemon/aptdcon, but perhaps possible. TBD.

- Jim

------------------------8<---------------------------

« Back to merge proposal