[Bug 1630731] [NEW] autodownload check in get_update_automation_level doesn't check hard enough

Brian Murray brian at ubuntu.com
Wed Oct 5 19:10:29 UTC 2016


Public bug reported:

The function get_automation_level tries to see if updates will be
installed automatically, however the check is really incomplete.

143   def get_update_automation_level(self):
144     """ Parse the apt cron configuration. Try to fit a predefined use case 
145         and return it. Special case: if the user made a custom 
146         configurtation, that we cannot represent it will return None """
147     if apt_pkg.config.find_i(softwareproperties.CONF_MAP["autoupdate"]) > 0:
148         # Autodownload
149         if apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 1\
150            and os.path.exists("/usr/bin/unattended-upgrade"):
151             return softwareproperties.UPDATE_INST_SEC
152         elif apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 1 and  \
153              apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0:
154             return softwareproperties.UPDATE_DOWNLOAD
155         elif apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0 and \
156              apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 0:
157             return softwareproperties.UPDATE_NOTIFY
158         else:
159             return None


unattended maps to "APT::Periodic::Unattended-Upgrade" (see softwareproperties/__init__.py.

However, /etc/apt/apt.conf.d/50unattended-upgrades could contain
Unattended-Upgrade and not allow any origins e.g.:

  1 // Automatically upgrade packages from these (origin:archive) pairs
  2 Unattended-Upgrade::Allowed-Origins {
  3 //        "${distro_id}:${distro_codename}-security";
  4 //  "${distro_id}:${distro_codename}-updates";
  5 //  "${distro_id}:${distro_codename}-proposed";
  6 //  "${distro_id}:${distro_codename}-backports";
  7 };

The check really should dig deeper in Unattended-Upgrade.

** Affects: software-properties (Ubuntu)
     Importance: Medium
         Status: Triaged


** Tags: xenial yakkety

** Changed in: software-properties (Ubuntu)
       Status: New => Triaged

** Changed in: software-properties (Ubuntu)
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to software-properties in Ubuntu.
https://bugs.launchpad.net/bugs/1630731

Title:
  autodownload check in get_update_automation_level doesn't check hard
  enough

Status in software-properties package in Ubuntu:
  Triaged

Bug description:
  The function get_automation_level tries to see if updates will be
  installed automatically, however the check is really incomplete.

  143   def get_update_automation_level(self):
  144     """ Parse the apt cron configuration. Try to fit a predefined use case 
  145         and return it. Special case: if the user made a custom 
  146         configurtation, that we cannot represent it will return None """
  147     if apt_pkg.config.find_i(softwareproperties.CONF_MAP["autoupdate"]) > 0:
  148         # Autodownload
  149         if apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 1\
  150            and os.path.exists("/usr/bin/unattended-upgrade"):
  151             return softwareproperties.UPDATE_INST_SEC
  152         elif apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 1 and  \
  153              apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0:
  154             return softwareproperties.UPDATE_DOWNLOAD
  155         elif apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0 and \
  156              apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 0:
  157             return softwareproperties.UPDATE_NOTIFY
  158         else:
  159             return None

  
  unattended maps to "APT::Periodic::Unattended-Upgrade" (see softwareproperties/__init__.py.

  However, /etc/apt/apt.conf.d/50unattended-upgrades could contain
  Unattended-Upgrade and not allow any origins e.g.:

    1 // Automatically upgrade packages from these (origin:archive) pairs
    2 Unattended-Upgrade::Allowed-Origins {
    3 //        "${distro_id}:${distro_codename}-security";
    4 //  "${distro_id}:${distro_codename}-updates";
    5 //  "${distro_id}:${distro_codename}-proposed";
    6 //  "${distro_id}:${distro_codename}-backports";
    7 };

  The check really should dig deeper in Unattended-Upgrade.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/1630731/+subscriptions



More information about the foundations-bugs mailing list