diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2015-01-25 23:08:37 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2015-07-08 17:05:21 +0100 |
commit | 3390d070b2945715a15f74462c511df2b2941ef5 (patch) | |
tree | 00082177176f47137d06a50f82c6db41eed87aee | |
parent | f06efd6fa7bbb0c81ce0461d4eaeed225d6f04a2 (diff) | |
download | sos-3390d070b2945715a15f74462c511df2b2941ef5.tar.gz |
[plugin] add tmp_in_sysroot() method
Add a method that plugins can test to determine whether the
archive's temporary directory is inside sysroot. This is always
true when sysroot is '/'. When sysroot is a subdirectory of root
the temporary directory may be inaccessible from the chroot
namespace. Plugins can test this method to determine where to
write output.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index c1b659d3..49f62bfa 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -169,6 +169,10 @@ class Plugin(object): def use_sysroot(self): return self.sysroot != os.path.abspath(os.sep) + def tmp_in_sysroot(self): + paths = [self.sysroot, self.archive.get_tmp_dir()] + return os.path.commonprefix(paths) == self.sysroot + def is_installed(self, package_name): '''Is the package $package_name installed?''' return self.policy().pkg_by_name(package_name) is not None |