def get_update_automation_level(self):
""" Parse the apt cron configuration. Try to fit a predefined use case
and return it. Special case: if the user made a custom
configurtation, that we cannot represent it will return None """
if apt_pkg.config.find_i(softwareproperties.CONF_MAP["autoupdate"]) > 0:
# Autodownload
if apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 1\
and apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 1 :
return softwareproperties.UPDATE_INST_SEC
elif apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 1 and \
apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0:
return softwareproperties.UPDATE_DOWNLOAD
elif apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0 and \
apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 0:
return softwareproperties.UPDATE_NOTIFY
else:
return None
elif apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0 and \
apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 0:
return softwareproperties.UPDATE_MANUAL
else:
return None