Skip to content

Commit

Permalink
omd: make sure no root files are kept after restore
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Dec 19, 2018
1 parent 05083e2 commit fe7b06a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/omd/omd
Original file line number Diff line number Diff line change
Expand Up @@ -3748,6 +3748,10 @@ def main_restore(args, options={}):
if not reuse:
add_to_fstab(g_sitename, tmpfs_size = options.get('tmpfs-size'))

# give new user all files
if am_root:
chown_tree(g_sitedir, g_sitename)

finalize_site("restore", "apache-reload" in options)

if not am_root:
Expand Down
3 changes: 2 additions & 1 deletion t/10-omd_testsite.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BEGIN {
use lib "$FindBin::Bin/lib/lib/perl5";
}

plan( tests => 334 );
plan( tests => 338 );

my $omd_bin = TestUtils::get_omd_bin();

Expand Down Expand Up @@ -104,6 +104,7 @@ my $tests = [
# --restore
{ cmd => $omd_bin." restore /tmp/omd.backup.tgz", like => '/Restoring site testsite from /' },
{ cmd => "/bin/su - $site -c 'omd -f restore /tmp/omd.backup.tgz'", like => '/Restore completed/' },
{ cmd => "/bin/su - $site -c 'find . -user root -ls'", like => '/^$/' },

# --reset
{ cmd => "/bin/sh -c \"echo '# test newline in profile' >> /omd/sites/$site/.profile\""},
Expand Down

0 comments on commit fe7b06a

Please sign in to comment.