summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--obnamlib/app.py7
-rw-r--r--obnamlib/repo_factory.py11
-rw-r--r--obnamlib/repo_interface.py13
-rw-r--r--test-gpghome/random_seedbin600 -> 600 bytes
4 files changed, 29 insertions, 2 deletions
diff --git a/obnamlib/app.py b/obnamlib/app.py
index 45a36de0..af6ab3f0 100644
--- a/obnamlib/app.py
+++ b/obnamlib/app.py
@@ -128,11 +128,11 @@ class App(cliapp.Application):
self.pm.locations = [self.plugins_dir()]
self.pm.plugin_arguments = (self,)
- self.setup_hooks()
-
self.fsf = obnamlib.VfsFactory()
self.repo_factory = obnamlib.RepositoryFactory()
+ self.setup_hooks()
+
self.pm.load_plugins()
self.pm.enable_plugins()
self.hooks.call('plugins-loaded')
@@ -156,6 +156,9 @@ class App(cliapp.Application):
obnamlib.Repository(None, 1000, 1000, 100, self.hooks, 10, 10, 10,
self.time, 0, '')
+ # The repository factory creates all repository related hooks.
+ self.repo_factory.setup_hooks(self.hooks)
+
def plugins_dir(self):
return os.path.join(os.path.dirname(obnamlib.__file__), 'plugins')
diff --git a/obnamlib/repo_factory.py b/obnamlib/repo_factory.py
index 44f6a78a..514c5831 100644
--- a/obnamlib/repo_factory.py
+++ b/obnamlib/repo_factory.py
@@ -48,6 +48,17 @@ class RepositoryFactory(object):
obnamlib.RepositoryFormat6,
]
+ def setup_hooks(self, hooks): # pragma: no cover
+ '''Create all repository related hooks.
+
+ The factory instantiates all supported repository format classes.
+ This causes the hooks to be created.
+
+ '''
+
+ for impl in self._implementations:
+ impl.setup_hooks(hooks)
+
def open_existing_repo(self, fs, **kwargs):
'''Open an existing repository.
diff --git a/obnamlib/repo_interface.py b/obnamlib/repo_interface.py
index bf77addd..38f33b61 100644
--- a/obnamlib/repo_interface.py
+++ b/obnamlib/repo_interface.py
@@ -317,6 +317,19 @@ class RepositoryInterface(object):
# Operations on the repository itself.
+ @classmethod
+ def setup_hooks(self, hooks): # pragma: no cover
+ '''Create any hooks for this repository format.
+
+ Note that this is a class method.
+
+ Subclasses do not need to override this method, unless they
+ need to add hooks.
+
+ '''
+
+ pass
+
def get_fs(self):
'''Get the Obnam VFS instance for accessing the filesystem.
diff --git a/test-gpghome/random_seed b/test-gpghome/random_seed
index ad7044f3..2a075662 100644
--- a/test-gpghome/random_seed
+++ b/test-gpghome/random_seed
Binary files differ