summaryrefslogtreecommitdiff
path: root/obnamlib/plugins/restore_plugin.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-08-19 19:12:19 +0200
committerLars Wirzenius <liw@liw.fi>2015-08-19 19:58:32 +0200
commit8b39988d0cccff274a7bf7e36448dcc7216c2ea3 (patch)
treeb3dec8118cf8540bdbf804f0cbfcf51f3dadaea4 /obnamlib/plugins/restore_plugin.py
parent7e462bae7d53f08ed6079c522bbe237bbc1c3cc5 (diff)
downloadobnam-8b39988d0cccff274a7bf7e36448dcc7216c2ea3.tar.gz
Add get_metadata_from_file_keys and use it
Diffstat (limited to 'obnamlib/plugins/restore_plugin.py')
-rw-r--r--obnamlib/plugins/restore_plugin.py31
1 files changed, 1 insertions, 30 deletions
diff --git a/obnamlib/plugins/restore_plugin.py b/obnamlib/plugins/restore_plugin.py
index 3f85d74f..71266b62 100644
--- a/obnamlib/plugins/restore_plugin.py
+++ b/obnamlib/plugins/restore_plugin.py
@@ -198,42 +198,13 @@ class RestorePlugin(obnamlib.ObnamPlugin):
self.app.ts['current'] = pathname
self.restore_safely(gen, pathname)
- def construct_metadata_object(self, gen, filename):
- allowed = set(self.repo.get_allowed_file_keys())
-
- def K(key):
- if key in allowed:
- return self.repo.get_file_key(gen, filename, key)
- else:
- return None
-
- return obnamlib.Metadata(
- st_atime_sec=K(obnamlib.REPO_FILE_ATIME_SEC),
- st_atime_nsec=K(obnamlib.REPO_FILE_ATIME_NSEC),
- st_mtime_sec=K(obnamlib.REPO_FILE_MTIME_SEC),
- st_mtime_nsec=K(obnamlib.REPO_FILE_MTIME_NSEC),
- st_blocks=K(obnamlib.REPO_FILE_BLOCKS),
- st_dev=K(obnamlib.REPO_FILE_DEV),
- st_gid=K(obnamlib.REPO_FILE_GID),
- st_ino=K(obnamlib.REPO_FILE_INO),
- st_mode=K(obnamlib.REPO_FILE_MODE),
- st_nlink=K(obnamlib.REPO_FILE_NLINK),
- st_size=K(obnamlib.REPO_FILE_SIZE),
- st_uid=K(obnamlib.REPO_FILE_UID),
- username=K(obnamlib.REPO_FILE_USERNAME),
- groupname=K(obnamlib.REPO_FILE_GROUPNAME),
- target=K(obnamlib.REPO_FILE_SYMLINK_TARGET),
- xattr=K(obnamlib.REPO_FILE_XATTR_BLOB),
- md5=K(obnamlib.REPO_FILE_MD5),
- )
-
def restore_safely(self, gen, pathname):
try:
dirname = os.path.dirname(pathname)
if self.write_ok and not self.fs.exists('./' + dirname):
self.fs.makedirs('./' + dirname)
- metadata = self.construct_metadata_object(gen, pathname)
+ metadata = self.repo.get_metadata_from_file_keys(gen, pathname)
set_metadata = True
if metadata.isdir():