diff options
author | Radostin Stoyanov <rstoyanov1@gmail.com> | 2017-08-26 21:42:12 +0100 |
---|---|---|
committer | Radostin Stoyanov <rstoyanov1@gmail.com> | 2017-08-28 17:01:37 +0100 |
commit | 409a342513f3a6c752786dfd3a8a2e8bbb0a9912 (patch) | |
tree | 9a947c781554b1314d001d68b95f33b426481a90 /src | |
parent | b1cf7ac5829ebbbe83c6045491ba38367e5aa64c (diff) | |
download | virt-bootstrap.git-409a342513f3a6c752786dfd3a8a2e8bbb0a9912.tar.gz virt-bootstrap.git-409a342513f3a6c752786dfd3a8a2e8bbb0a9912.tar.xz virt-bootstrap.git-409a342513f3a6c752786dfd3a8a2e8bbb0a9912.zip |
Show warning for unprivileged users
Show warning message and don't allow ownership mapping for non-root
user when the output format is 'dir'.
Diffstat (limited to 'src')
-rwxr-xr-x | src/virtBootstrap/virt_bootstrap.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/virtBootstrap/virt_bootstrap.py b/src/virtBootstrap/virt_bootstrap.py index 2ff1b4b..9190e80 100755 --- a/src/virtBootstrap/virt_bootstrap.py +++ b/src/virtBootstrap/virt_bootstrap.py @@ -109,6 +109,13 @@ def bootstrap(uri, dest, """ Get source object and call unpack method """ + if fmt == 'dir' and os.geteuid() != 0: + if uid_map or gid_map: + raise ValueError("UID/GID mapping with 'dir' format is " + "allowed only for root.") + logger.warning("All extracted files will be owned by the current " + "unprivileged user.") + # Get instance of progress storing module prog = progress.Progress(progress_cb) |