summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorAlan <alan@boum.org>2018-08-26 14:29:21 +0000
committerAlan <alan@boum.org>2018-10-15 15:31:26 +0000
commitb04b057db53ee863697ab7fe4341f26247c00a41 (patch)
tree7c0db17b10826c0a4dc21e654d3182b02a7d1d1c /config
parent1e2321a83f1341ac5cf29252c9ad099202b38097 (diff)
ASP: use logging.warning instead of deprecated logging.warn
Will-fix: #15838
Diffstat (limited to 'config')
-rwxr-xr-xconfig/chroot_local-includes/usr/local/sbin/tails-additional-software37
1 files changed, 19 insertions, 18 deletions
diff --git a/config/chroot_local-includes/usr/local/sbin/tails-additional-software b/config/chroot_local-includes/usr/local/sbin/tails-additional-software
index e68e685..b6ee9c3 100755
--- a/config/chroot_local-includes/usr/local/sbin/tails-additional-software
+++ b/config/chroot_local-includes/usr/local/sbin/tails-additional-software
@@ -74,7 +74,8 @@ def _launch_apt_get(specific_args):
logging.info(line.rstrip())
apt_get.wait()
if apt_get.returncode:
- logging.warn("apt-get exited with returncode %i" % apt_get.returncode)
+ logging.warning("apt-get exited with returncode %i"
+ % apt_get.returncode)
return apt_get.returncode
@@ -116,8 +117,8 @@ def _notify(title, body="", accept_label="", deny_label="",
# sudo failed to execute the command
raise OSError(completed_process.stderr)
except OSError as e:
- logging.warn("Warning: unable to notify the user. %s" % e)
- logging.warn("The notification was: %s %s" % (title, body))
+ logging.warning("Warning: unable to notify the user. %s" % e)
+ logging.warning("The notification was: %s %s" % (title, body))
return None
if return_id:
@@ -230,13 +231,13 @@ def has_additional_packages_list(search_new_persistence=False):
try:
packages_list_path = get_packages_list_path(search_new_persistence)
except FileNotFoundError as e:
- logging.warn("Warning: {}".format(e))
+ logging.warning("Warning: {}".format(e))
return False
if os.path.isfile(packages_list_path):
logging.info("Found additional packages list.")
return True
else:
- logging.warn("Warning: no configuration file found.")
+ logging.warning("Warning: no configuration file found.")
return False
@@ -248,8 +249,8 @@ def delete_old_apt_lists(old_apt_lists_dir=OLD_APT_LISTS_DIR):
def save_old_apt_lists(srcdir=APT_LISTS_DIR, destdir=OLD_APT_LISTS_DIR):
"""Save a copy of the APT lists"""
if os.path.exists(destdir):
- logging.warn("Warning: a copy of the APT lists already exists, "
- "which should never happen. Removing it.")
+ logging.warning("Warning: a copy of the APT lists already exists, "
+ "which should never happen. Removing it.")
delete_old_apt_lists(destdir)
shutil.copytree(srcdir, destdir, symlinks=True)
@@ -306,8 +307,8 @@ def handle_installed_packages(packages):
# If they install packages with their persistent storage locked, they
# probably do it with their persistent storage unlock as well and would
# learn about this feature when it's most relevant for them.
- logging.warn("Warning: persistence storage is locked, can't add "
- "additional software.")
+ logging.warning("Warning: persistence storage is locked, can't add "
+ "additional software.")
elif is_tails_media_writable():
# Translators: Don't translate {packages}, it's a placeholder and will be replaced.
if _notify(_("Add {packages} to your additional software?").format(
@@ -327,7 +328,7 @@ def handle_installed_packages(packages):
"failed."))
raise e
else: # It's impossible to have a persistent storage
- logging.warn("Cannot create persistent storage on this media.")
+ logging.warning("Cannot create persistent storage on this media.")
if not os.path.isfile(ASP_STATE_INSTALLER_ASKED):
open(ASP_STATE_INSTALLER_ASKED, 'a').close()
# Translators: Don't translate {packages}, it's a placeholder and will be replaced.
@@ -489,7 +490,6 @@ def apt_hook_post():
if additional_packages_removed:
handle_removed_packages(additional_packages_removed)
-
def install_additional_packages(upgrade_mode=False):
"""Subcommand which activates and installs all additional packages.
@@ -509,12 +509,12 @@ def install_additional_packages(upgrade_mode=False):
# that, we restore the old APT lists: there are greater chances
# that the APT packages cache still has the corresponding packages.
if os.path.isdir(OLD_APT_LISTS_DIR) and not upgrade_mode:
- logging.warn("Found a copy of old APT lists, restoring it.")
+ logging.warning("Found a copy of old APT lists, restoring it.")
try:
restore_old_apt_lists()
except Exception as e:
- logging.warn("Restoring old APT lists failed with %r, "
- "deleting them and proceeding anyway." % e)
+ logging.warning("Restoring old APT lists failed with %r, "
+ "deleting them and proceeding anyway." % e)
# In all cases, delete the old APT lists: if they could be
# restored we don't need them anymore (and we don't want to
# restore them again next time); if they could not be
@@ -524,7 +524,7 @@ def install_additional_packages(upgrade_mode=False):
packages = get_additional_packages()
if not packages:
- logging.warn("Warning: no packages to install, exiting")
+ logging.warning("Warning: no packages to install, exiting")
return True
if not upgrade_mode:
installing_notification_id = _notify(
@@ -539,7 +539,8 @@ def install_additional_packages(upgrade_mode=False):
"--option", "DPkg::Options::=--force-confold",
"install"] + list(packages))
if apt_get_returncode:
- logging.warn("Warning: installation of %s failed" % " ".join(packages))
+ logging.warning("Warning: installation of %s failed"
+ % " ".join(packages))
if not upgrade_mode:
_close_notification(installing_notification_id)
_notify_failure(_("The installation of your additional software "
@@ -576,7 +577,7 @@ def upgrade_additional_packages():
apt_get_returncode = _launch_apt_get(["update"])
if apt_get_returncode:
- logging.warn("Warning: the update failed.")
+ logging.warning("Warning: the update failed.")
_notify_failure(_("The check for upgrades of your additional software "
"failed"),
_("Please check your network connection, "
@@ -606,7 +607,7 @@ def upgrade_additional_packages():
# must have been upgraded already.
apt_get_returncode = _launch_apt_get(["autoclean"])
if apt_get_returncode:
- logging.warn("Warning: autoclean failed.")
+ logging.warning("Warning: autoclean failed.")
return True