diff options
-rw-r--r-- | _obnammodule.c | 6 | ||||
-rwxr-xr-x | crash-test | 6 | ||||
-rw-r--r-- | manual/Makefile | 14 | ||||
-rwxr-xr-x | manual/format-de-pdf | 3 | ||||
-rw-r--r-- | obnam.1.in | 8 | ||||
-rw-r--r-- | obnamlib/fmt_6/chunklist.py | 6 | ||||
-rw-r--r-- | obnamlib/fmt_6/clientmetadatatree.py | 2 | ||||
-rw-r--r-- | obnamlib/fmt_6/clientmetadatatree_tests.py | 44 | ||||
-rw-r--r-- | obnamlib/fmt_6/metadata_codec.py | 6 | ||||
-rw-r--r-- | obnamlib/fmt_6/repo_fmt_6.py | 9 | ||||
-rw-r--r-- | obnamlib/lockmgr_tests.py | 3 | ||||
-rw-r--r-- | obnamlib/plugins/backup_plugin.py | 32 | ||||
-rw-r--r-- | obnamlib/plugins/fsck_plugin.py | 6 | ||||
-rw-r--r-- | obnamlib/plugins/restore_plugin.py | 3 | ||||
-rw-r--r-- | obnamlib/plugins/sftp_plugin.py | 106 | ||||
-rw-r--r-- | obnamlib/plugins/show_plugin.py | 38 | ||||
-rw-r--r-- | obnamlib/repo_dummy.py | 3 | ||||
-rw-r--r-- | obnamlib/repo_interface.py | 6 | ||||
-rw-r--r-- | obnamlib/vfs.py | 3 | ||||
-rw-r--r-- | setup.py | 2 |
20 files changed, 177 insertions, 129 deletions
diff --git a/_obnammodule.c b/_obnammodule.c index 0d281f67..712604b7 100644 --- a/_obnammodule.c +++ b/_obnammodule.c @@ -247,7 +247,8 @@ lgetxattr_wrapper(PyObject *self, PyObject *args) return Py_None; } #ifdef __FreeBSD__ - int n = extattr_get_link(filename, EXTATTR_NAMESPACE_USER, attrname, buf, bufsize); + int n = extattr_get_link(filename, EXTATTR_NAMESPACE_USER, + attrname, buf, bufsize); #else ssize_t n = lgetxattr(filename, attrname, buf, bufsize); #endif @@ -275,7 +276,8 @@ lsetxattr_wrapper(PyObject *self, PyObject *args) return NULL; #ifdef __FreeBSD__ - ret = extattr_set_link(filename, EXTATTR_NAMESPACE_USER, name, value, size); + ret = extattr_set_link(filename, EXTATTR_NAMESPACE_USER, + name, value, size); #else ret = lsetxattr(filename, name, value, size, 0); #endif @@ -41,7 +41,8 @@ log-keep = 16 trace = larch, obnamlib EOF -# Do a minimal backup to make sure the repository works at least once, without the crash-limit option +# Do a minimal backup to make sure the repository works at least once, +# without the crash-limit option mkdir "$tempdir/data" ./obnam backup --no-default-config --config "$tempdir/conf" @@ -56,7 +57,8 @@ do # rm -f "$tempdir/obnam.log" echo "Trying backup with at most $N writes to repository" - ./obnam force-lock --no-default-config --config "$tempdir/conf" 2>/dev/null + ./obnam force-lock --no-default-config --config "$tempdir/conf" \ + 2>/dev/null if ./obnam backup --no-default-config --config "$tempdir/conf" 2>/dev/null then echo "Backup finished ok, done" diff --git a/manual/Makefile b/manual/Makefile index 0a0008b2..9df25826 100644 --- a/manual/Makefile +++ b/manual/Makefile @@ -24,7 +24,11 @@ VERSION = Version $(shell git describe || python ../setup.py --version) en_sources = $(shell ls en/*.mdwn) de_sources = $(shell ls de/*.mdwn) -outputs = obnam-manual.en.pdf obnam-manual.en.html obnam-manual.de.pdf obnam-manual.de.html +outputs = \ + obnam-manual.en.pdf \ + obnam-manual.en.html \ + obnam-manual.de.pdf \ + obnam-manual.de.html all: $(outputs) @@ -35,10 +39,14 @@ obnam-manual.en.html: Makefile $(en_sources) ../obnam.css ./format-html $@ "$(TITLE_EN)" "$(AUTHOR)" "$(VERSION)" $(en_sources) obnam-manual.de.pdf: Makefile $(de_sources) - ./format-de-pdf $@ "$(TITLE_DE)" "$(AUTHOR)" "$(VERSION)" "$(TRANS_DE)" $(de_sources) + ./format-de-pdf $@ \ + "$(TITLE_DE)" "$(AUTHOR)" "$(VERSION)" "$(TRANS_DE)" \ + $(de_sources) obnam-manual.de.html: Makefile $(de_sources) ../obnam.css - ./format-de-html $@ "$(TITLE_DE)" "$(AUTHOR)" "$(VERSION)" "$(TRANS_DE)" $(de_sources) + ./format-de-html $@ \ + "$(TITLE_DE)" "$(AUTHOR)" "$(VERSION)" "$(TRANS_DE)" \ + $(de_sources) clean: rm -f $(outputs) en/000.mdwn diff --git a/manual/format-de-pdf b/manual/format-de-pdf index 2d0316d9..9ef1fa5d 100755 --- a/manual/format-de-pdf +++ b/manual/format-de-pdf @@ -33,5 +33,6 @@ cat > 000.mdwn <<EOF % $VERSION EOF -pandoc --smart --toc --chapters --number-sections -V lang=german -V geometry:a4paper -o "$OUTPUT" 000.mdwn "$@" +pandoc --smart --toc --chapters --number-sections \ + -V lang=german -V geometry:a4paper -o "$OUTPUT" 000.mdwn "$@" rm -f 000.mdwn @@ -181,7 +181,8 @@ This allows to deal with files that have been changed or renamed since the previous backup run. It also allows several backup clients to avoid uploading the same data. -If, for example, everyone in the office has a copy of the same sales brochures, +If, +for example, everyone in the office has a copy of the same sales brochures, only one copy needs to be stored in the backup repository. .PP Every backup run is a @@ -431,8 +432,9 @@ section is used .PP The long names of options are used as keys for configuration variables. -Any setting that can be set from the command line can be set in a configuration -file, in the +Any setting that can be set from the command line +can be set in a configuration file, +in the .I [config] section. .PP diff --git a/obnamlib/fmt_6/chunklist.py b/obnamlib/fmt_6/chunklist.py index f648d5bb..e34aa652 100644 --- a/obnamlib/fmt_6/chunklist.py +++ b/obnamlib/fmt_6/chunklist.py @@ -37,9 +37,9 @@ class ChunkList(obnamlib.RepositoryTree): tracing.trace('new ChunkList') self.fmt = '!Q' self.key_bytes = struct.calcsize(self.fmt) - obnamlib.RepositoryTree.__init__(self, fs, 'chunklist', self.key_bytes, - node_size, upload_queue_size, - lru_size, hooks) + obnamlib.RepositoryTree.__init__( + self, fs, 'chunklist', self.key_bytes, node_size, + upload_queue_size, lru_size, hooks) self.keep_just_one_tree = True def key(self, chunk_id): diff --git a/obnamlib/fmt_6/clientmetadatatree.py b/obnamlib/fmt_6/clientmetadatatree.py index dbc8288a..45d3666a 100644 --- a/obnamlib/fmt_6/clientmetadatatree.py +++ b/obnamlib/fmt_6/clientmetadatatree.py @@ -59,7 +59,7 @@ class ClientMetadataTree(obnamlib.RepositoryTree): GEN_STARTED = 1 # subkey type for when generation was started GEN_ENDED = 2 # subkey type for when generation was ended GEN_IS_CHECKPOINT = 3 # subkey type for whether generation is checkpoint - GEN_FILE_COUNT = 4 # subkey type for count of files+dirs in generation + GEN_FILE_COUNT = 4 # subkey type for count of files+dirs in a gen GEN_TOTAL_DATA = 5 # subkey type for sum of all file sizes in gen GEN_TEST_DATA = 6 # subkey type for REPO_GENERATION_TEST_KEY diff --git a/obnamlib/fmt_6/clientmetadatatree_tests.py b/obnamlib/fmt_6/clientmetadatatree_tests.py index 60e75c89..8576bdd9 100644 --- a/obnamlib/fmt_6/clientmetadatatree_tests.py +++ b/obnamlib/fmt_6/clientmetadatatree_tests.py @@ -146,11 +146,10 @@ class ClientMetadataTreeFileOpsTests(unittest.TestCase): fs = obnamlib.LocalFS(self.tempdir) self.hooks = obnamlib.HookManager() self.hooks.new('repository-toplevel-init') - self.client = obnamlib.ClientMetadataTree(fs, 'clientid', - obnamlib.DEFAULT_NODE_SIZE, - obnamlib.DEFAULT_UPLOAD_QUEUE_SIZE, - obnamlib.DEFAULT_LRU_SIZE, - self) + self.client = obnamlib.ClientMetadataTree( + fs, 'clientid', obnamlib.DEFAULT_NODE_SIZE, + obnamlib.DEFAULT_UPLOAD_QUEUE_SIZE, obnamlib.DEFAULT_LRU_SIZE, + self) # Force use of filename hash collisions. self.client.default_file_id = self.client._bad_default_file_id self.client.start_generation() @@ -209,19 +208,24 @@ class ClientMetadataTreeFileOpsTests(unittest.TestCase): self.client.create('/foo/bar', self.dir_encoded) self.client.create('/foo/bar/baz', self.file_encoded) self.assertEqual(self.client.listdir(self.clientid, '/'), ['foo']) - self.assertEqual(sorted(self.client.listdir(self.clientid, '/foo')), - ['bar', 'foobar']) - self.assertEqual(self.client.listdir(self.clientid, '/foo/bar'), - ['baz']) - self.assertEqual(self.client.get_metadata(self.clientid, '/foo'), - self.dir_encoded) - self.assertEqual(self.client.get_metadata(self.clientid, '/foo/bar'), - self.dir_encoded) - self.assertEqual(self.client.get_metadata(self.clientid, '/foo/foobar'), - self.file_encoded) - self.assertEqual(self.client.get_metadata(self.clientid, - '/foo/bar/baz'), - self.file_encoded) + self.assertEqual( + sorted(self.client.listdir(self.clientid, '/foo')), + ['bar', 'foobar']) + self.assertEqual( + self.client.listdir(self.clientid, '/foo/bar'), + ['baz']) + self.assertEqual( + self.client.get_metadata(self.clientid, '/foo'), + self.dir_encoded) + self.assertEqual( + self.client.get_metadata(self.clientid, '/foo/bar'), + self.dir_encoded) + self.assertEqual( + self.client.get_metadata(self.clientid, '/foo/foobar'), + self.file_encoded) + self.assertEqual( + self.client.get_metadata(self.clientid, '/foo/bar/baz'), + self.file_encoded) def test_removes_directory_and_files_and_subdirs(self): self.client.create('/foo', self.dir_encoded) @@ -240,7 +244,9 @@ class ClientMetadataTreeFileOpsTests(unittest.TestCase): self.clientid, '/foo/bar/baz') def test_has_no_file_chunks_initially(self): - self.assertEqual(self.client.get_file_chunks(self.clientid, '/foo'), []) + self.assertEqual( + self.client.get_file_chunks(self.clientid, '/foo'), + []) def test_sets_file_chunks(self): self.client.set_file_chunks('/foo', [1, 2, 3]) diff --git a/obnamlib/fmt_6/metadata_codec.py b/obnamlib/fmt_6/metadata_codec.py index 93c93bdb..2e281c6b 100644 --- a/obnamlib/fmt_6/metadata_codec.py +++ b/obnamlib/fmt_6/metadata_codec.py @@ -66,9 +66,11 @@ def encode_metadata(metadata): logging.error('ERROR: Packing error due to %s' % str(e)) logging.error('ERROR: st_mode=%s' % repr(metadata.st_mode)) logging.error('ERROR: st_mtime_sec=%s' % repr(metadata.st_mtime_sec)) - logging.error('ERROR: st_mtime_nsec=%s' % repr(metadata.st_mtime_nsec)) + logging.error( + 'ERROR: st_mtime_nsec=%s' % repr(metadata.st_mtime_nsec)) logging.error('ERROR: st_atime_sec=%s' % repr(metadata.st_atime_sec)) - logging.error('ERROR: st_atime_nsec=%s' % repr(metadata.st_atime_nsec)) + logging.error( + 'ERROR: st_atime_nsec=%s' % repr(metadata.st_atime_nsec)) logging.error('ERROR: st_nlink=%s' % repr(metadata.st_nlink)) logging.error('ERROR: st_size=%s' % repr(metadata.st_size)) logging.error('ERROR: st_uid=%s' % repr(metadata.st_uid)) diff --git a/obnamlib/fmt_6/repo_fmt_6.py b/obnamlib/fmt_6/repo_fmt_6.py index 85a86461..1a3bf262 100644 --- a/obnamlib/fmt_6/repo_fmt_6.py +++ b/obnamlib/fmt_6/repo_fmt_6.py @@ -515,7 +515,8 @@ class RepositoryFormat6(obnamlib.RepositoryInterface): client_name=client_name, key_name=obnamlib.repo_key_name(key)) - def set_generation_key(self, generation_id, key, value): # pragma: no cover + def set_generation_key( + self, generation_id, key, value): # pragma: no cover # FIXME: This no worky for generations other than the currently # started one. There should at least be an assert about it. @@ -601,7 +602,8 @@ class RepositoryFormat6(obnamlib.RepositoryInterface): 'chunks', self._idpath_depth, self._idpath_bits, self._idpath_skip) - def _construct_in_tree_chunk_id(self, gen_id, filename): # pragma: no cover + def _construct_in_tree_chunk_id( + self, gen_id, filename): # pragma: no cover # This constructs a synthetic chunk id for in-tree data for a # file. The file is expected to have in-tree data. @@ -916,7 +918,8 @@ class RepositoryFormat6(obnamlib.RepositoryInterface): def _flush_file_key_cache(self): for cache_key, value in self._file_key_cache.items(): generation_id, filename = cache_key - client_name, generation_number = self._unpack_gen_id(generation_id) + client_name, generation_number = self._unpack_gen_id( + generation_id) dirty, metadata = value if dirty: encoded_metadata = \ diff --git a/obnamlib/lockmgr_tests.py b/obnamlib/lockmgr_tests.py index a6bf64e7..142c700c 100644 --- a/obnamlib/lockmgr_tests.py +++ b/obnamlib/lockmgr_tests.py @@ -66,7 +66,8 @@ class LockManagerTests(unittest.TestCase): def test_notices_when_preexisting_lock_goes_away(self): self.lm.lock([self.dirnames[0]]) - self.lm._sleep = lambda: os.remove(self.lm._lockname(self.dirnames[0])) + self.lm._sleep = lambda: os.remove( + self.lm._lockname(self.dirnames[0])) self.lm.lock([self.dirnames[0]]) self.assertTrue(True) diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py index 3685c05b..3adf68b2 100644 --- a/obnamlib/plugins/backup_plugin.py +++ b/obnamlib/plugins/backup_plugin.py @@ -347,11 +347,12 @@ class BackupPlugin(obnamlib.ObnamPlugin): self.repo = self.app.get_repository_object() except Exception as e: self.progress.error( - 'Are you using --pretend without an existing repository?\n' - 'That does not work, sorry.\n' - 'You can create a small repository, backing up\n' - 'just one small directory, and then use --pretend\n' - 'with the real data.') + 'Are you using --pretend without an existing ' + 'repository? That does not\n' + 'work, sorry. You can create a small repository, ' + 'backing up just one\n' + 'small directory, and then use --pretend with ' + 'the real data.') raise else: self.repo = self.app.get_repository_object(create=True) @@ -384,7 +385,8 @@ class BackupPlugin(obnamlib.ObnamPlugin): self.progress.what('committing changes to repository') if not self.pretend: self.progress.what( - 'committing changes to repository: locking shared B-trees') + 'committing changes to repository: ' + 'locking shared B-trees') self.repo.lock_chunk_indexes() self.progress.what( @@ -488,7 +490,8 @@ class BackupPlugin(obnamlib.ObnamPlugin): self.exclude_pats.append(re.compile(x)) except re.error, e: msg = ( - 'error compiling regular expression "%s": %s' % (x, e)) + 'error compiling regular expression "%s": %s' % + (x, e)) logging.error(msg) self.progress.error(msg) @@ -646,11 +649,14 @@ class BackupPlugin(obnamlib.ObnamPlugin): self.backup_parents('.') self.progress.what('making checkpoint: locking shared B-trees') self.repo.lock_chunk_indexes() - self.progress.what('making checkpoint: adding chunks to shared B-trees') + self.progress.what( + 'making checkpoint: adding chunks to shared B-trees') self.add_chunks_to_shared() - self.progress.what('making checkpoint: committing per-client B-tree') + self.progress.what( + 'making checkpoint: committing per-client B-tree') self.repo.set_generation_key( - self.new_generation, obnamlib.REPO_GENERATION_IS_CHECKPOINT, 1) + self.new_generation, + obnamlib.REPO_GENERATION_IS_CHECKPOINT, 1) self.repo.commit_client(self.client_name) self.progress.what('making checkpoint: committing shared B-trees') self.repo.commit_chunk_indexes() @@ -661,7 +667,8 @@ class BackupPlugin(obnamlib.ObnamPlugin): self.progress.what('making checkpoint: locking client') self.repo.lock_client(self.client_name) self.progress.what('making checkpoint: starting a new generation') - self.new_generation = self.repo.create_generation(self.client_name) + self.new_generation = self.repo.create_generation( + self.client_name) self.app.dump_memory_profile('at end of checkpoint') self.progress.what('making checkpoint: continuing backup') @@ -1052,7 +1059,8 @@ class BackupPlugin(obnamlib.ObnamPlugin): helper(pathname) else: tracing.trace('is extra and removed: %s' % dirname) - self.progress.what('removing %s from new generation' % dirname) + self.progress.what( + 'removing %s from new generation' % dirname) self.repo.remove_file(self.new_generation, dirname) self.progress.what(msg) diff --git a/obnamlib/plugins/fsck_plugin.py b/obnamlib/plugins/fsck_plugin.py index 6f5f19e3..86f800b8 100644 --- a/obnamlib/plugins/fsck_plugin.py +++ b/obnamlib/plugins/fsck_plugin.py @@ -132,12 +132,14 @@ class CheckGeneration(WorkItem): n = self.repo.get_generation_key( self.genid, obnamlib.REPO_GENERATION_FILE_COUNT) if n is None: - self.error('%s:%s: no file count' % (self.client_name, self.genid)) + self.error( + '%s:%s: no file count' % (self.client_name, self.genid)) n = self.repo.get_generation_key( self.genid, obnamlib.REPO_GENERATION_TOTAL_DATA) if n is None: - self.error('%s:%s: no total data' % (self.client_name, self.genid)) + self.error( + '%s:%s: no total data' % (self.client_name, self.genid)) if self.settings['fsck-skip-dirs']: return [] diff --git a/obnamlib/plugins/restore_plugin.py b/obnamlib/plugins/restore_plugin.py index 12031db3..22162685 100644 --- a/obnamlib/plugins/restore_plugin.py +++ b/obnamlib/plugins/restore_plugin.py @@ -249,7 +249,8 @@ class RestorePlugin(obnamlib.ObnamPlugin): if self.write_ok: if not self.fs.exists('./' + root): self.fs.mkdir('./' + root) - self.app.dump_memory_profile('after recursing through %s' % repr(root)) + self.app.dump_memory_profile( + 'after recursing through %s' % repr(root)) def restore_hardlink(self, filename, link, metadata): logging.debug('restoring hardlink %s to %s' % (filename, link)) diff --git a/obnamlib/plugins/sftp_plugin.py b/obnamlib/plugins/sftp_plugin.py index 4806521a..6d4da5f1 100644 --- a/obnamlib/plugins/sftp_plugin.py +++ b/obnamlib/plugins/sftp_plugin.py @@ -110,8 +110,10 @@ class SSHChannelAdapter(object): try: return os.read(self.proc.stdout.fileno(), count) except socket.error, e: - if e.args[0] in (errno.EPIPE, errno.ECONNRESET, errno.ECONNABORTED, - errno.EBADF): + errnos = ( + errno.EPIPE, errno.ECONNRESET, errno.ECONNABORTED, + errno.EBADF) + if e.args[0] in errnos: # Connection has closed. Paramiko expects an empty string in # this case, not an exception. return '' @@ -596,7 +598,7 @@ class SftpFS(obnamlib.VirtualFileSystem): f.close() def _tempfile(self, dirname): - '''Create a new file with a random name, return file handle and name.''' + '''Create a new file with a random name, return handle and name.''' if dirname: try: @@ -641,53 +643,55 @@ class SftpPlugin(obnamlib.ObnamPlugin): ssh_group = obnamlib.option_group['ssh'] = 'SSH/SFTP' devel_group = obnamlib.option_group['devel'] - self.app.settings.integer(['sftp-delay'], - 'add an artificial delay (in milliseconds) ' - 'to all SFTP transfers', - group=devel_group) - - self.app.settings.string(['ssh-key'], - 'use FILENAME as the ssh RSA private key for ' - 'sftp access (default is using keys known ' - 'to ssh-agent)', - metavar='FILENAME', - group=ssh_group) - - self.app.settings.boolean(['strict-ssh-host-keys'], - 'DEPRECATED, use --ssh-host-keys-check ' - 'instead', - group=ssh_group) - - self.app.settings.choice(['ssh-host-keys-check'], - ['ssh-config', 'yes', 'no', 'ask'], - 'If "yes", require that the ssh host key must ' - 'be known and correct to be accepted. If ' - '"no", do not require that. If "ask", the ' - 'user is interactively asked to accept new ' - 'hosts. The default ("ssh-config") is to ' - 'rely on the settings of the underlying ' - 'SSH client', - metavar='VALUE', - group=ssh_group) - - self.app.settings.string(['ssh-known-hosts'], - 'filename of the user\'s known hosts file', - metavar='FILENAME', - default= - os.path.expanduser('~/.ssh/known_hosts'), - group=ssh_group) - - self.app.settings.string(['ssh-command'], - 'alternative executable to be used instead ' - 'of "ssh" (full path is allowed, no ' - 'arguments may be added)', - metavar='EXECUTABLE', - group=ssh_group) - - self.app.settings.boolean(['pure-paramiko'], - 'do not use openssh even if available, ' - 'use paramiko only instead', - group=ssh_group) + self.app.settings.integer( + ['sftp-delay'], + 'add an artificial delay (in milliseconds) to all SFTP transfers', + group=devel_group) + + self.app.settings.string( + ['ssh-key'], + 'use FILENAME as the ssh RSA private key for sftp access ' + '(default is using keys known to ssh-agent)', + metavar='FILENAME', + group=ssh_group) + + self.app.settings.boolean( + ['strict-ssh-host-keys'], + 'DEPRECATED, use --ssh-host-keys-check instead', + group=ssh_group) + + self.app.settings.choice( + ['ssh-host-keys-check'], + ['ssh-config', 'yes', 'no', 'ask'], + 'If "yes", require that the ssh host key must ' + 'be known and correct to be accepted. If ' + '"no", do not require that. If "ask", the ' + 'user is interactively asked to accept new ' + 'hosts. The default ("ssh-config") is to ' + 'rely on the settings of the underlying ' + 'SSH client', + metavar='VALUE', + group=ssh_group) + + self.app.settings.string( + ['ssh-known-hosts'], + 'filename of the user\'s known hosts file', + metavar='FILENAME', + default=os.path.expanduser('~/.ssh/known_hosts'), + group=ssh_group) + + self.app.settings.string( + ['ssh-command'], + 'alternative executable to be used instead ' + 'of "ssh" (full path is allowed, no ' + 'arguments may be added)', + metavar='EXECUTABLE', + group=ssh_group) + + self.app.settings.boolean( + ['pure-paramiko'], + 'do not use openssh even if available, ' + 'use paramiko only instead', + group=ssh_group) self.app.fsf.register('sftp', SftpFS, settings=self.app.settings) - diff --git a/obnamlib/plugins/show_plugin.py b/obnamlib/plugins/show_plugin.py index 91817c36..169778a9 100644 --- a/obnamlib/plugins/show_plugin.py +++ b/obnamlib/plugins/show_plugin.py @@ -60,24 +60,26 @@ class ShowPlugin(obnamlib.ObnamPlugin): self.app.add_subcommand('nagios-last-backup-age', self.nagios_last_backup_age) - self.app.settings.string(['warn-age'], - 'for nagios-last-backup-age: maximum age (by ' - 'default in hours) for the most recent ' - 'backup before status is warning. ' - 'Accepts one char unit specifier ' - '(s,m,h,d for seconds, minutes, hours, ' - 'and days.', - metavar='AGE', - default=obnamlib.DEFAULT_NAGIOS_WARN_AGE) - self.app.settings.string(['critical-age'], - 'for nagios-last-backup-age: maximum age ' - '(by default in hours) for the most ' - 'recent backup before statis is critical. ' - 'Accepts one char unit specifier ' - '(s,m,h,d for seconds, minutes, hours, ' - 'and days.', - metavar='AGE', - default=obnamlib.DEFAULT_NAGIOS_WARN_AGE) + self.app.settings.string( + ['warn-age'], + 'for nagios-last-backup-age: maximum age (by ' + 'default in hours) for the most recent ' + 'backup before status is warning. ' + 'Accepts one char unit specifier ' + '(s,m,h,d for seconds, minutes, hours, ' + 'and days.', + metavar='AGE', + default=obnamlib.DEFAULT_NAGIOS_WARN_AGE) + self.app.settings.string( + ['critical-age'], + 'for nagios-last-backup-age: maximum age ' + '(by default in hours) for the most ' + 'recent backup before statis is critical. ' + 'Accepts one char unit specifier ' + '(s,m,h,d for seconds, minutes, hours, ' + 'and days.', + metavar='AGE', + default=obnamlib.DEFAULT_NAGIOS_WARN_AGE) def open_repository(self, require_client=True): self.app.settings.require('repository') diff --git a/obnamlib/repo_dummy.py b/obnamlib/repo_dummy.py index e00b52e2..156a207e 100644 --- a/obnamlib/repo_dummy.py +++ b/obnamlib/repo_dummy.py @@ -105,7 +105,8 @@ class DummyClient(object): def lock(self): if self.data.locked: - raise obnamlib.RepositoryClientLockingFailed(client_name=self.name) + raise obnamlib.RepositoryClientLockingFailed( + client_name=self.name) self.data.lock() def _require_lock(self): diff --git a/obnamlib/repo_interface.py b/obnamlib/repo_interface.py index 0b16016c..31ee59c8 100644 --- a/obnamlib/repo_interface.py +++ b/obnamlib/repo_interface.py @@ -148,7 +148,9 @@ class RepositoryGenerationKeyNotAllowed(obnamlib.ObnamError): class RepositoryGenerationDoesNotExist(obnamlib.ObnamError): - msg = 'Cannot find requested generation {gen_id!r} for client {client_name}' + msg = ( + 'Cannot find requested generation {gen_id!r} ' + 'for client {client_name}') class RepositoryClientHasNoGenerations(obnamlib.ObnamError): @@ -346,7 +348,7 @@ class RepositoryInterface(object): # Client list. def get_client_names(self): - '''Return list of client names currently existing in the repository.''' + '''Return client names currently existing in the repository.''' raise NotImplementedError() def lock_client_list(self): diff --git a/obnamlib/vfs.py b/obnamlib/vfs.py index ede58fbd..8406c114 100644 --- a/obnamlib/vfs.py +++ b/obnamlib/vfs.py @@ -545,7 +545,8 @@ class VfsTests(object): # pragma: no cover st = self.fs.lstat('.') for field in obnamlib.metadata_fields: if field.startswith('st_'): - self.assert_(hasattr(st, field), 'stat must return %s' % field) + self.assertTrue( + hasattr(st, field), 'stat must return %s' % field) def test_lstat_returns_right_filetype_for_directory(self): st = self.fs.lstat('.') @@ -203,7 +203,7 @@ class Check(Command): print 'check copyright statements in source files' cliapp.runcmd(['copyright-statement-lint'] + sources) else: - print 'copyright-statement-lint not available: no copyright checks' + print 'no copyright-statement-lint: no copyright checks' def copylint_is_available(self): returncode, stdout, stderr = cliapp.runcmd_unchecked( |