diff --git a/muranoagent/execution_plan_queue.py b/muranoagent/execution_plan_queue.py index 058c655f..9a019155 100644 --- a/muranoagent/execution_plan_queue.py +++ b/muranoagent/execution_plan_queue.py @@ -32,7 +32,12 @@ class ExecutionPlanQueue(object): def __init__(self): self._plans_folder = os.path.join(CONF.storage, 'plans') if not os.path.exists(self._plans_folder): - os.makedirs(self._plans_folder) + os.makedirs(self._plans_folder, 0o700) + else: + try: + os.chmod(self._plans_folder, 0o700) + except OSError: + pass def put_execution_plan(self, execution_plan): timestamp = str(int(time.time() * 10000)) diff --git a/muranoagent/files_manager.py b/muranoagent/files_manager.py index 234eef8e..84d935fc 100644 --- a/muranoagent/files_manager.py +++ b/muranoagent/files_manager.py @@ -40,7 +40,7 @@ class FilesManager(object): CONF.storage, 'files', execution_plan.ID) if os.path.exists(self._cache_folder): self.clear() - os.makedirs(self._cache_folder) + os.makedirs(self._cache_folder, 0o700) def put_file(self, file_id, script): if type(file_id) is dict: diff --git a/muranoagent/tests/unit/test_app.py b/muranoagent/tests/unit/test_app.py index d8707281..6d4260ce 100644 --- a/muranoagent/tests/unit/test_app.py +++ b/muranoagent/tests/unit/test_app.py @@ -31,8 +31,9 @@ CONF = cfg.CONF class TestApp(base.MuranoAgentTestCase, fixtures.FunctionFixture): + @mock.patch('os.chmod') @mock.patch('os.path.exists') - def setUp(self, mock_path): + def setUp(self, mock_path, mock_chmod): super(TestApp, self).setUp() mock_path.return_value = True self.agent = app.MuranoAgent()