Commit 1d4d3a33 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos: Make data-log accessible for instances users.

parent fe3c3fa2
......@@ -79,7 +79,7 @@ def do_collect(conf):
raise
log_directory = "%s/var/data-log" % conf.get("slapos", "instance_root")
mkdir_p(log_directory)
mkdir_p(log_directory, 0o755)
database = Database(log_directory)
computer = Computer(ComputerSnapshot())
......
......@@ -37,6 +37,7 @@ import subprocess
import sys
import tempfile
import time
import stat
import traceback
import warnings
import logging
......@@ -352,8 +353,17 @@ class Slapgrid(object):
raise OSError('%s does not exist.' % self.instance_root)
# Creates everything needed
# Create directory accessible for the instances.
var_directory = os.path.join(self.instance_root, 'var')
if not os.path.isdir(var_directory):
os.mkdir(var_directory)
os.chmod(var_directory, stat.S_IRWXU | stat.S_IROTH | stat.S_IXOTH | \
stat.S_IRGRP | stat.S_IXGRP )
mkdir_p(os.path.join(self.instance_root, 'var'), 0o755)
# Creates instance_root structure
createPrivateDirectory(os.path.join(self.instance_root, 'var'))
createPrivateDirectory(os.path.join(self.instance_root, 'var', 'log'))
createPrivateDirectory(os.path.join(self.instance_root, 'var', 'run'))
......
......@@ -34,6 +34,7 @@ import shutil
import signal
import socket
import sys
import stat
import tempfile
import textwrap
import time
......@@ -535,6 +536,8 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self.assertEqual(self.grid.processComputerPartitionList(), slapgrid.SLAPGRID_SUCCESS)
self.assertItemsEqual(os.listdir(self.instance_root), ['etc', 'var'])
self.assertItemsEqual(os.listdir(self.software_root), [])
st = os.stat(os.path.join(self.instance_root, 'var'))
self.assertEquals(stat.S_IMODE(st.st_mode), 0o755)
def test_one_partition(self):
computer = ComputerForTest(self.software_root, self.instance_root)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment