Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
tails
tails
Commits
b04b057d
Commit
b04b057d
authored
Aug 26, 2018
by
Alan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ASP: use logging.warning instead of deprecated logging.warn
Will-fix:
#15838
parent
1e2321a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
config/chroot_local-includes/usr/local/sbin/tails-additional-software
...t_local-includes/usr/local/sbin/tails-additional-software
+19
-18
No files found.
config/chroot_local-includes/usr/local/sbin/tails-additional-software
View file @
b04b057d
...
...
@@ -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
.
warn
ing
(
"Warning: unable to notify the user. %s"
%
e
)
logging
.
warn
ing
(
"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
.
warn
ing
(
"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
.
warn
ing
(
"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
.
warn
ing
(
"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
.
warn
ing
(
"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
.
warn
ing
(
"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
.
warn
ing
(
"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
.
warn
ing
(
"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
.
warn
ing
(
"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
.
warn
ing
(
"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
.
warn
ing
(
"Warning: autoclean failed."
)
return
True
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment