Skip to content

Commit

Permalink
Fix: missing dirs creation by 'draksetup init' (#967)
Browse files Browse the repository at this point in the history
  • Loading branch information
psrok1 authored Sep 13, 2024
1 parent 3cb3734 commit 46608bb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drakrun/drakrun/draksetup/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from drakrun.lib.minio import get_minio_client
from drakrun.lib.paths import ETC_DIR, PACKAGE_DIR

from .util.ensure_dirs import ensure_dirs

log = logging.getLogger(__name__)

MINIO_ENV_CONFIG_FILE = Path("/etc/default/minio")
Expand Down Expand Up @@ -71,11 +73,9 @@ def init(
# Simple activities handled by deb packages before
# In the future, consider splitting this to remove hard dependency on systemd etc
drakrun_dir = Path(ETC_DIR)
scripts_dir = drakrun_dir / "scripts"
data_dir = PACKAGE_DIR / "data"

drakrun_dir.mkdir(exist_ok=True)
scripts_dir.mkdir(exist_ok=True)
ensure_dirs()

def create_configuration_file(config_file_name, target_dir=drakrun_dir):
target_path = target_dir / config_file_name
Expand Down
2 changes: 2 additions & 0 deletions drakrun/drakrun/draksetup/util/ensure_dirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ETC_DIR,
LIB_DIR,
PROFILE_DIR,
SCRIPTS_DIR,
VM_CONFIG_DIR,
VOLUME_DIR,
)
Expand All @@ -13,6 +14,7 @@
def ensure_dirs():
os.makedirs(ETC_DIR, exist_ok=True)
os.makedirs(VM_CONFIG_DIR, exist_ok=True)
os.makedirs(SCRIPTS_DIR, exist_ok=True)

os.makedirs(LIB_DIR, exist_ok=True)
os.makedirs(PROFILE_DIR, exist_ok=True)
Expand Down
1 change: 1 addition & 0 deletions drakrun/drakrun/lib/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

ETC_DIR = "/etc/drakrun"
VM_CONFIG_DIR = os.path.join(ETC_DIR, "configs")
SCRIPTS_DIR = os.path.join(ETC_DIR, "scripts")

LIB_DIR = "/var/lib/drakrun"
PROFILE_DIR = os.path.join(LIB_DIR, "profiles")
Expand Down

0 comments on commit 46608bb

Please sign in to comment.