Permalink
Browse files

cleanup whitespace

  • Loading branch information...
1 parent 2e90e6f commit 767facb8474635d33f51a87635479a61991afc5a @lirazsiri lirazsiri committed Aug 8, 2012
Showing with 177 additions and 179 deletions.
  1. +7 −7 backup.py
  2. +9 −9 changes.py
  3. +4 −4 cliwrapper.py
  4. +8 −8 cmd_backup.py
  5. +6 −6 cmd_escrow.py
  6. +4 −4 cmd_init.py
  7. +4 −4 cmd_internal.py
  8. +6 −6 cmd_list.py
  9. +6 −6 cmd_passphrase.py
  10. +9 −10 cmd_restore.py
  11. +6 −7 cmd_restore_rollback.py
  12. +9 −9 cmd_status.py
  13. +14 −14 dirindex.py
  14. +7 −7 dummyhub.py
  15. +5 −5 duplicity.py
  16. +5 −5 hub.py
  17. +8 −8 keypacket.py
  18. +8 −8 mysql.py
  19. +4 −4 passphrase.py
  20. +4 −4 pathmap.py
  21. +8 −8 pkgman.py
  22. +5 −5 registry.py
  23. +8 −8 restore.py
  24. +7 −7 rollback.py
  25. +3 −3 squid.py
  26. +4 −4 userdb.py
  27. +5 −5 utils.py
  28. +4 −4 version.py
View
@@ -49,7 +49,7 @@ def _write_new_packages(dest, base_packages):
fh.close()
@staticmethod
- def _write_whatchanged(dest, dest_olist, dirindex, dirindex_conf,
+ def _write_whatchanged(dest, dest_olist, dirindex, dirindex_conf,
overrides=[]):
paths = read_paths(file(dirindex_conf))
paths += overrides
@@ -72,15 +72,15 @@ def _create_extras(cls, extras, profile, conf):
if not conf.backup_skip_files:
cls._write_whatchanged(extras.fsdelta, extras.fsdelta_olist,
- profile.dirindex, profile.dirindex_conf,
+ profile.dirindex, profile.dirindex_conf,
conf.overrides.fs)
if not conf.backup_skip_packages:
cls._write_new_packages(extras.newpkgs, profile.packages)
if not conf.backup_skip_database:
try:
- mysql.backup(extras.myfs, extras.etc.mysql,
+ mysql.backup(extras.myfs, extras.etc.mysql,
limits=conf.overrides.db)
except mysql.Error:
pass
@@ -111,13 +111,13 @@ def __init__(self, conf, force_cleanup=False):
if conf.verbose:
# files in /TKLBAM + /TKLBAM/fsdelta-olist
- fpaths= _fpaths(extras_paths.path)
+ fpaths= _fpaths(extras_paths.path)
if not conf.backup_skip_files:
fsdelta_olist = file(extras_paths.fsdelta_olist).read().splitlines()
fpaths += _filter_deleted(fsdelta_olist)
- size = sum([ os.lstat(fpath).st_size
+ size = sum([ os.lstat(fpath).st_size
for fpath in fpaths ])
if size > 1024 * 1024 * 1024:
@@ -159,7 +159,7 @@ def run(self, debug=False):
opts += [('exclude', '**')]
- args = [ '--s3-unencrypted-connection', '--allow-source-mismatch' ]
+ args = [ '--s3-unencrypted-connection', '--allow-source-mismatch' ]
if conf.simulate and conf.verbose:
args += [ '--dry-run' ]
@@ -176,7 +176,7 @@ def run(self, debug=False):
backup_command = duplicity.Command(opts, *args)
if conf.verbose:
- print "\n# PASSPHRASE=$(cat %s) %s" % (conf.secretfile,
+ print "\n# PASSPHRASE=$(cat %s) %s" % (conf.secretfile,
backup_command)
View
@@ -1,13 +1,13 @@
-#
+#
# Copyright (c) 2010 Liraz Siri <liraz@turnkeylinux.org>
-#
+#
# This file is part of TKLBAM (TurnKey Linux BAckup and Migration).
-#
+#
# TKLBAM is open source software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of
# the License, or (at your option) any later version.
-#
+#
import os
from os.path import *
@@ -100,7 +100,7 @@ def __str__(self):
@classmethod
def parse(cls, line):
- op2class = dict((val.OP, val) for val in cls.__dict__.values()
+ op2class = dict((val.OP, val) for val in cls.__dict__.values()
if isinstance(val, types.ClassType))
op = line[0]
if op not in op2class:
@@ -119,7 +119,7 @@ class Changes(list):
"""
A list of Change instances, which we can load from a file and write
back to a file.
-
+
The smarts is in statfixes() and deleted() methods which compare the
list of changes to the current filesystem and yield Action() instances.
@@ -186,7 +186,7 @@ def deleted(self):
continue
yield self.Action(os.remove, change.path)
-
+
def emptydirs(self):
for change in self:
if not lexists(change.path) and change.OP == 's':
@@ -208,7 +208,7 @@ def __getitem__(self, key):
if change.OP == 'd':
continue
-
+
# optimization: if not remapped we can skip 'o' changes
if change.OP == 'o' and \
change.uid not in uidmap and change.gid not in gidmap:
@@ -218,7 +218,7 @@ def __getitem__(self, key):
if change.OP in ('s', 'o'):
if st.st_uid != uidmap[change.uid] or \
st.st_gid != gidmap[change.gid]:
- yield self.Action(os.lchown, change.path,
+ yield self.Action(os.lchown, change.path,
uidmap[change.uid], gidmap[change.gid])
if change.OP == 's':
View
@@ -1,13 +1,13 @@
-#
+#
# Copyright (c) 2010 Liraz Siri <liraz@turnkeylinux.org>
-#
+#
# This file is part of TKLBAM (TurnKey Linux BAckup and Migration).
-#
+#
# TKLBAM is open source software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of
# the License, or (at your option) any later version.
-#
+#
import os
import re
import sys
View
@@ -152,7 +152,7 @@ def main():
'debug',
'resume',
'logfile=',
- 'simulate', 'quiet',
+ 'simulate', 'quiet',
'profile=', 'secretfile=', 'address=',
'volsize=', 's3-parallel-uploads=', 'full-backup='])
except getopt.GetoptError, e:
@@ -236,12 +236,12 @@ def main():
try:
registry.credentials = hb.get_credentials()
except hb.Error, e:
- # asking for get_credentials() might fail if the hub is down.
+ # asking for get_credentials() might fail if the hub is down.
# But If we already have the credentials we can survive that.
-
+
if isinstance(e, hub.NotSubscribedError):
fatal(e)
-
+
if not registry.credentials:
pass
@@ -253,7 +253,7 @@ def main():
try:
registry.hbr = hb.get_backup_record(registry.hbr.backup_id)
except hb.Error, e:
- # if the Hub is down we can hope that the cached address
+ # if the Hub is down we can hope that the cached address
# is still valid and warn and try to backup anyway.
#
# But if we reach the Hub and it tells us the backup is invalid
@@ -266,8 +266,8 @@ def main():
warn(e)
if not registry.hbr:
- registry.hbr = hb.new_backup_record(registry.key,
- get_turnkey_version(),
+ registry.hbr = hb.new_backup_record(registry.key,
+ get_turnkey_version(),
get_server_id())
conf.address = registry.hbr.address
@@ -284,7 +284,7 @@ def main():
conf = registry.backup_resume_conf
- # implicit resume if we have a leftover session and
+ # implicit resume if we have a leftover session and
# the backup configuration is the same
if registry.backup_resume_conf == conf:
opt_resume = True
View
@@ -1,14 +1,14 @@
#!/usr/bin/python
-#
+#
# Copyright (c) 2010 Liraz Siri <liraz@turnkeylinux.org>
-#
+#
# This file is part of TKLBAM (TurnKey Linux BAckup and Migration).
-#
+#
# TKLBAM is open source software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of
# the License, or (at your option) any later version.
-#
+#
"""Create a backup escrow key (Save this somewhere safe)
Arguments:
@@ -17,7 +17,7 @@
Options:
- -P --no-passphrase Don't encrypt escrow key with a passphrase
+ -P --no-passphrase Don't encrypt escrow key with a passphrase
-R --random-passphrase Choose a secure random passphrase (and print it)
"""
@@ -92,6 +92,6 @@ def _passphrase():
os.chmod(keyfile, 0600)
print >> fh, key
-
+
if __name__ == "__main__":
main()
View
@@ -1,14 +1,14 @@
#!/usr/bin/python
-#
+#
# Copyright (c) 2010 Liraz Siri <liraz@turnkeylinux.org>
-#
+#
# This file is part of TKLBAM (TurnKey Linux BAckup and Migration).
-#
+#
# TKLBAM is open source software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of
# the License, or (at your option) any later version.
-#
+#
"""
Initialization (start here)
View
@@ -1,14 +1,14 @@
#!/usr/bin/python
-#
+#
# Copyright (c) 2010 Liraz Siri <liraz@turnkeylinux.org>
-#
+#
# This file is part of TKLBAM (TurnKey Linux BAckup and Migration).
-#
+#
# TKLBAM is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of
# the License, or (at your option) any later version.
-#
+#
"""
Execute an internal command
"""
View
@@ -1,21 +1,21 @@
#!/usr/bin/python
-#
+#
# Copyright (c) 2010 Liraz Siri <liraz@turnkeylinux.org>
-#
+#
# This file is part of TKLBAM (TurnKey Linux BAckup and Migration).
-#
+#
# TKLBAM is open source software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of
# the License, or (at your option) any later version.
-#
+#
"""
List backup records
By default uses a built-in format, unless a user-specified format is specified.
Format variables:
-
+
%id Backup id
%label Descriptive label
%turnkey_version Appliance version code
@@ -118,7 +118,7 @@ def main():
(hbr.backup_id, fmt_skpp(hbr.key),
hbr.created.strftime("%Y-%m-%d"),
- hbr.updated.strftime("%Y-%m-%d")
+ hbr.updated.strftime("%Y-%m-%d")
if hbr.updated else "-",
fmt_size(hbr.size),
View
@@ -1,14 +1,14 @@
#!/usr/bin/python
-#
+#
# Copyright (c) 2010 Liraz Siri <liraz@turnkeylinux.org>
-#
+#
# This file is part of TKLBAM (TurnKey Linux BAckup and Migration).
-#
+#
# TKLBAM is open source software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of
# the License, or (at your option) any later version.
-#
+#
"""Change passphrase of backup encryption key
Options:
@@ -58,8 +58,8 @@ def main():
key = keypacket.fmt(registry.secret, passphrase)
hbr = registry.hbr
-
- # after we setup a backup record
+
+ # after we setup a backup record
# only save key to registry if update_key works
if hbr:
try:
View
@@ -1,14 +1,14 @@
#!/usr/bin/python
-#
+#
# Copyright (c) 2010 Liraz Siri <liraz@turnkeylinux.org>
-#
+#
# This file is part of TKLBAM (TurnKey Linux BAckup and Migration).
-#
+#
# TKLBAM is open source software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of
# the License, or (at your option) any later version.
-#
+#
"""
Restore a backup
@@ -18,9 +18,9 @@
Options:
--time=TIME Time to restore from
-
+
TIME := YYYY-MM-DD | YYYY-MM-DDThh:mm:ss | <int>[mhDWMY]
-
+
2010-08-06 - 2010, August 6th, 00:00
2010-08-07T14:00 - 2010, August 7th 14:00 UTC
@@ -57,7 +57,7 @@
--force Disable sanity checking
--debug Run $$SHELL after Duplicity
-
+
Configurable options:
--restore-cache-size=SIZE The maximum size of the download cache
@@ -231,8 +231,8 @@ def main():
opt_debug = False
try:
- opts, args = getopt.gnu_getopt(sys.argv[1:], 'h',
- ['limits=', 'address=', 'keyfile=',
+ opts, args = getopt.gnu_getopt(sys.argv[1:], 'h',
+ ['limits=', 'address=', 'keyfile=',
'logfile=',
'restore-cache-size=', 'restore-cache-dir=',
'force',
@@ -242,7 +242,6 @@ def main():
'debug',
'skip-files', 'skip-database', 'skip-packages',
'no-rollback'])
-
except getopt.GetoptError, e:
usage(e)
Oops, something went wrong.

0 comments on commit 767facb

Please sign in to comment.