Skip to content

Commit

Permalink
HDX_CONFIG_DIR was fixed if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
agustinhydrolix committed Aug 9, 2024
1 parent 2bb0b0c commit 8df6e2a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
8 changes: 1 addition & 7 deletions src/hdx_cli/cli_interface/common/cached_operations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import json
import requests

from ...library_api.common.config_constants import HDX_CONFIG_DIR
from ...library_api.common.exceptions import HdxCliException, ResourceNotFoundException
from ...library_api.common.context import ProfileUserContext
from ...library_api.utility.decorators import find_in_disk_cache
Expand All @@ -10,12 +10,6 @@

logger = get_logger()

try:
from ...library_api.common.config_constants import HDX_CONFIG_DIR
except FileNotFoundError as e:
logger.error(f'{e}')
sys.exit(1)


def find_kafka(user_ctx: ProfileUserContext):
return access_resource(user_ctx,
Expand Down
8 changes: 7 additions & 1 deletion src/hdx_cli/library_api/common/config_constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import os
import sys
from pathlib import Path

from hdx_cli.library_api.common.logging import get_logger

logger = get_logger()

__all__ = ['HDX_CONFIG_DIR', 'PROFILE_CONFIG_FILE', 'PROFILE_CACHE_DIR']

HDX_CONFIG_DIR_DEFAULT = Path.home() / '.hdx_cli'
Expand All @@ -12,4 +17,5 @@


if HDX_CONFIG_DIR_ENV and not HDX_CONFIG_DIR.exists():
raise FileNotFoundError(f"The specified directory in 'HDX_CONFIG_DIR': {HDX_CONFIG_DIR} does not exist.")
logger.error(f"The specified directory in 'HDX_CONFIG_DIR': {HDX_CONFIG_DIR} does not exist.")
sys.exit(1)
2 changes: 0 additions & 2 deletions src/hdx_cli/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import dataclasses as dc

import click
from trogon import tui

Expand Down

0 comments on commit 8df6e2a

Please sign in to comment.