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 authored and Joseph Nuthalapati committed 2018-09-27 12:42:26 +05:30
1 parent 5df13f7147
commit d37ba6217e
1 file changed
+3 -4
+3 -4
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(_):