upgrades: Keep config file when disabling

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
James Valleroy 2018-09-26 21:27:15 -04:00 committed by Joseph Nuthalapati
parent 5df13f7147
commit d37ba6217e
No known key found for this signature in database
GPG Key ID: 5398F00A2FA43C35

View File

@ -89,10 +89,9 @@ def subcommand_enable_auto(_):
def subcommand_disable_auto(_):
"""Disable automatic upgrades"""
try:
os.rename(AUTO_CONF_FILE, AUTO_CONF_FILE + '.disabled')
except FileNotFoundError:
print('Already disabled.')
with open(AUTO_CONF_FILE, 'w') as conffile:
conffile.write('APT::Periodic::Update-Package-Lists "0";\n')
conffile.write('APT::Periodic::Unattended-Upgrade "0";\n')
def subcommand_get_log(_):