Skip to content
Snippets Groups Projects
Commit c70f1e10 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

Make .agkyra with owner permissions only

parent bf0b4d63
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ The operations of a sync are similar to the operations of a cloud, as they are ...@@ -28,6 +28,7 @@ The operations of a sync are similar to the operations of a cloud, as they are
implemented in kamaki.cli.config implemented in kamaki.cli.config
""" """
import os import os
import stat
from re import match from re import match
from ConfigParser import Error from ConfigParser import Error
from kamaki.cli import config from kamaki.cli import config
...@@ -48,7 +49,7 @@ if os.path.exists(AGKYRA_DIR): ...@@ -48,7 +49,7 @@ if os.path.exists(AGKYRA_DIR):
if not os.path.isdir(AGKYRA_DIR): if not os.path.isdir(AGKYRA_DIR):
raise Exception("Cannot create dir '%s'; file exists" % AGKYRA_DIR) raise Exception("Cannot create dir '%s'; file exists" % AGKYRA_DIR)
else: else:
os.makedirs(AGKYRA_DIR) os.makedirs(AGKYRA_DIR, mode=stat.S_IRWXU)
CONFIG_PATH = os.path.join(AGKYRA_DIR, 'config.rc') CONFIG_PATH = os.path.join(AGKYRA_DIR, 'config.rc')
config.CONFIG_PATH = CONFIG_PATH config.CONFIG_PATH = CONFIG_PATH
......
...@@ -18,6 +18,7 @@ import sys ...@@ -18,6 +18,7 @@ import sys
import threading import threading
import logging import logging
import ctypes import ctypes
import stat
from functools import wraps from functools import wraps
...@@ -122,7 +123,7 @@ class SyncerSettings(): ...@@ -122,7 +123,7 @@ class SyncerSettings():
default_settings_path = join_path(home_dir, GLOBAL_SETTINGS_NAME) default_settings_path = join_path(home_dir, GLOBAL_SETTINGS_NAME)
self.settings_path = utils.to_unicode( self.settings_path = utils.to_unicode(
kwargs.get("agkyra_path", default_settings_path)) kwargs.get("agkyra_path", default_settings_path))
self.create_dir(self.settings_path) self.create_dir(self.settings_path, mode=stat.S_IRWXU)
self.instances_path = join_path(self.settings_path, INSTANCES_NAME) self.instances_path = join_path(self.settings_path, INSTANCES_NAME)
self.create_dir(self.instances_path) self.create_dir(self.instances_path)
...@@ -233,13 +234,13 @@ class SyncerSettings(): ...@@ -233,13 +234,13 @@ class SyncerSettings():
logger.info("Filesystem is case-%ssensitive" % case) logger.info("Filesystem is case-%ssensitive" % case)
self.case_insensitive = case_insensitive self.case_insensitive = case_insensitive
def create_dir(self, path): def create_dir(self, path, mode=0777):
if os.path.exists(path): if os.path.exists(path):
if os.path.isdir(path): if os.path.isdir(path):
return return
raise Exception("Cannot create dir '%s'; file exists" % path) raise Exception("Cannot create dir '%s'; file exists" % path)
logger.warning("Creating dir: '%s'" % path) logger.warning("Creating dir: '%s'" % path)
os.makedirs(path) os.makedirs(path, mode=mode)
return path return path
@ssl_fall_back @ssl_fall_back
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment