Comment 7 for bug 1661611

Revision history for this message
Jogarem (jogi) wrote :

Well ok that was my first thought,too (boolean) so my first tests were misleading then. I tested a little bit more and find something maybe more useful.

When using Ubuntu 16.04.2 fresh installed and I set in /etc/apt/apt.conf.d/50unattended-upgrades:

Unattended-Upgrade::InstallOnShutdown "true";

it seems to have no effect. Upgrades are there but they do not get installed. I get no plymouth message on shutdown.
Same when set to "True".

When I change /usr/share/unattended-upgrades/unattended-upgrade-shutdown:

(line 120 again)

    # check if we need to run unattended-upgrades on shutdown and if so,
    # run it
    p = None
    apt_pkg.init_config()
before << if apt_pkg.config.find_b("Unattended-Upgrade::InstallOnShutdown", False):
after >> if apt_pkg.config.find_b("Unattended-Upgrade::InstallOnShutdown", False) == True:
        env = copy.copy(os.environ)
        env["UNATTENDED_UPGRADES_FORCE_INSTALL_ON_SHUTDOWN"] = "1"

Then it seems to work like expected.

Now when i set:

"Unattended-Upgrade::InstallOnShutdown "true";

in /etc/apt/apt.conf.d/50unattended-upgrades it starts upgrading on shutdown (I see the plymouth message "Unattended Upgrades..."). When I set it to "false" or just outcomment the whole line it do nothing on shutdown. So exact the behavior I expect.

Well I'm not a python expert but it seems to me that the <if True> thing works not as it should or maybe has changed in python3 some how? It may affect all other statements as well then (like MailOnlyOnError etc) but I haven't tested them yet...

With the above patch it works for me as it should. At least for the shutdown setting.