summaryrefslogtreecommitdiffstats
path: root/tails_installer
diff options
context:
space:
mode:
Diffstat (limited to 'tails_installer')
-rwxr-xr-xtails_installer/creator.py47
1 files changed, 28 insertions, 19 deletions
diff --git a/tails_installer/creator.py b/tails_installer/creator.py
index 3cf054f..745e546 100755
--- a/tails_installer/creator.py
+++ b/tails_installer/creator.py
@@ -421,7 +421,7 @@ class TailsInstallerCreator(object):
self.log.warning(_("Unable to copy %(infile)s to %(outfile)s: %(message)s")
% {'infile': infile,
'outfile': outfile,
- 'message': str(e)})
+ 'message': unicode(e.message).encode("utf-8")})
syslinux_path = self.get_liveos_file_path("syslinux")
_move_if_exists(self.get_liveos_file_path("isolinux"), syslinux_path)
@@ -441,27 +441,29 @@ class TailsInstallerCreator(object):
try:
os.chmod(path, 0644)
except OSError, e:
- self.log.debug(_("Unable to chmod %(file)s: %(message)s") % {'file': path, 'message': str(e)})
+ self.log.debug(_("Unable to chmod %(file)s: %(message)s") %
+ {'file': path, 'message': unicode(e.message).encode("utf-8")})
try:
os.unlink(path)
except:
raise TailsInstallerError(_(
"Unable to remove file from"
- " previous LiveOS: %(message)s")
- % {'message': str(e)})
+ " previous LiveOS: %(message)s") %
+ {'message': unicode(e.message).encode("utf-8")})
elif os.path.isdir(path):
try:
_set_liberal_perms_recursive(path)
except OSError, e:
self.log.debug(_("Unable to chmod %(file)s: %(message)s")
- % {'file': path, 'message': str(e)})
+ % {'file': path,
+ 'message': unicode(e.message).encode("utf-8")})
try:
shutil.rmtree(path)
except OSError, e:
raise TailsInstallerError(_(
"Unable to remove directory from"
- " previous LiveOS: %(message)s")
- % {'message': str(e)})
+ " previous LiveOS: %(message)s") %
+ {'message': unicode(e.message).encode("utf-8")})
def get_liveos(self):
return self.get_liveos_file_path(config['main_liveos_dir'])
@@ -803,12 +805,12 @@ class LinuxTailsInstallerCreator(TailsInstallerCreator):
else:
raise TailsInstallerError(_(
'Unknown GLib exception while trying to '
- 'mount device: %(message)s')
- % {'message': str(e)})
+ 'mount device: %(message)s') %
+ {'message': unicode(e.message).encode("utf-8")})
except Exception, e:
raise TailsInstallerError(_(
- "Unable to mount device: %(message)s")
- % {'message': str(e)})
+ "Unable to mount device: %(message)s") %
+ {'message': unicode(e.message).encode("utf-8")})
# Get the new mount point
if not mount:
@@ -1026,7 +1028,8 @@ class LinuxTailsInstallerCreator(TailsInstallerCreator):
self.popen('/sbin/e2label %s %s' % (self.drive['device'],
self.label))
except TailsInstallerError, e:
- self.log.error(_("Unable to change volume label: %(message)s") % {'message': str(e)})
+ self.log.error(_("Unable to change volume label: %(message)s") %
+ {'message': unicode(e.message).encode("utf-8")})
def install_bootloader(self):
""" Run syslinux to install the bootloader on our devices """
@@ -1126,7 +1129,7 @@ class LinuxTailsInstallerCreator(TailsInstallerCreator):
os.kill(pid, signal.SIGHUP)
self.log.debug("Killed process %d" % pid)
except OSError, e:
- self.log.debug(str(e))
+ self.log.debug(unicode(e.message).encode("utf-8"))
if os.path.exists(self._error_log_filename):
if not os.path.getsize(self._error_log_filename):
# We don't want any failure here to block other tear down tasks
@@ -1376,7 +1379,8 @@ class WindowsTailsInstallerCreator(TailsInstallerCreator):
try:
vol = win32api.GetVolumeInformation(drive)
except pywintypes.error, e:
- self.log.error('Unable to get GetVolumeInformation(%s): %s' % (drive, str(e)))
+ self.log.error('Unable to get GetVolumeInformation(%s): %s' %
+ (drive, unicode(e.message).encode("utf-8")))
continue
self.drives[drive] = {
'label': vol[0],
@@ -1415,7 +1419,8 @@ class WindowsTailsInstallerCreator(TailsInstallerCreator):
self.log.debug("Set %s label to %s" % (self.drive['device'],
self.label))
except pywintypes.error, e:
- self.log.warning("Unable to SetVolumeLabel: " + str(e))
+ self.log.warning("Unable to SetVolumeLabel: " + \
+ unicode(e.message).encode("utf-8"))
def get_free_bytes(self, device=None):
""" Return the number of free bytes on our selected drive """
@@ -1424,7 +1429,8 @@ class WindowsTailsInstallerCreator(TailsInstallerCreator):
try:
(spc, bps, fc, tc) = win32file.GetDiskFreeSpace(device)
except Exception, e:
- self.log.error("Problem determining free space: %s" % str(e))
+ self.log.error("Problem determining free space: %s" %
+ unicode(e.message).encode("utf-8"))
return 0
return fc * (spc * bps) # free-clusters * bytes per-cluster
@@ -1496,7 +1502,8 @@ class WindowsTailsInstallerCreator(TailsInstallerCreator):
self.log.debug("Found UUID %s for %s" % (uuid, drive))
except Exception, e:
self.log.exception(e)
- self.log.warning("Exception while fetching UUID: %s" % str(e))
+ self.log.warning("Exception while fetching UUID: %s" %
+ unicode(e.message).encode("utf-8"))
return uuid
def _get_device_size(self, drive):
@@ -1507,7 +1514,8 @@ class WindowsTailsInstallerCreator(TailsInstallerCreator):
self.log.debug("Max size of %s: %d" % (drive, size))
except Exception, e:
self.log.exception(e)
- self.log.warning("Error getting drive size: %s" % str(e))
+ self.log.warning("Error getting drive size: %s" %
+ unicode(e.message).encode("utf-8"))
return size
def popen(self, cmd, **kwargs):
@@ -1571,7 +1579,8 @@ class WindowsTailsInstallerCreator(TailsInstallerCreator):
proxies['ftp'] = 'ftp://%s' % server
settings.Close()
except Exception, e:
- self.log.warning('Unable to detect proxy settings: %s' % str(e))
+ self.log.warning('Unable to detect proxy settings: %s' %
+ unicode(e.message).encode("utf-8"))
self.log.debug('Using proxies: %s' % proxies)
return proxies