diff --git a/uaclient/config.py b/uaclient/config.py index 95e47d2b60..e8c8343556 100644 --- a/uaclient/config.py +++ b/uaclient/config.py @@ -26,6 +26,7 @@ CONFIG_FIELD_ENVVAR_ALLOWLIST, DEFAULT_CONFIG_FILE, DEFAULT_DATA_DIR, + PRIVATE_SUBDIR, ) from uaclient.files import notices, state_files from uaclient.files.notices import Notice @@ -33,7 +34,6 @@ LOG = logging.getLogger(util.replace_top_level_logger_name(__name__)) -PRIVATE_SUBDIR = "private" MERGE_ID_KEY_MAP = { "availableResources": "name", "resourceEntitlements": "type", diff --git a/uaclient/defaults.py b/uaclient/defaults.py index 46a8f6d77e..62e91e2aa2 100644 --- a/uaclient/defaults.py +++ b/uaclient/defaults.py @@ -9,11 +9,11 @@ UAC_RUN_PATH = "/run/ubuntu-advantage/" DEFAULT_DATA_DIR = "/var/lib/ubuntu-advantage" MACHINE_TOKEN_FILE = "machine-token.json" -PRIVATE_SUBDIR = "/private" +PRIVATE_SUBDIR = "private" DEFAULT_PRIVATE_MACHINE_TOKEN_PATH = ( - DEFAULT_DATA_DIR + PRIVATE_SUBDIR + "/" + MACHINE_TOKEN_FILE + DEFAULT_DATA_DIR + "/" + PRIVATE_SUBDIR + "/" + MACHINE_TOKEN_FILE ) -DEFAULT_PRIVATE_DATA_DIR = DEFAULT_DATA_DIR + PRIVATE_SUBDIR +DEFAULT_PRIVATE_DATA_DIR = DEFAULT_DATA_DIR + "/" + PRIVATE_SUBDIR MESSAGES_SUBDIR = "/messages" MESSAGES_DIR = DEFAULT_DATA_DIR + MESSAGES_SUBDIR CANDIDATE_CACHE_PATH = UAC_RUN_PATH + "candidate-version" diff --git a/uaclient/files/files.py b/uaclient/files/files.py index 212245f72e..62353117bc 100644 --- a/uaclient/files/files.py +++ b/uaclient/files/files.py @@ -75,7 +75,7 @@ def __init__( ): file_name = defaults.MACHINE_TOKEN_FILE self.private_file = UAFile( - file_name, directory + defaults.PRIVATE_SUBDIR + file_name, directory + "/" + defaults.PRIVATE_SUBDIR ) self.public_file = UAFile(file_name, directory, False) self.machine_token_overlay_path = machine_token_overlay_path diff --git a/uaclient/tests/test_config.py b/uaclient/tests/test_config.py index fa213d8f24..742ed424b2 100644 --- a/uaclient/tests/test_config.py +++ b/uaclient/tests/test_config.py @@ -10,7 +10,6 @@ from uaclient import apt, exceptions, http, messages from uaclient.config import ( - PRIVATE_SUBDIR, UA_CONFIGURABLE_KEYS, VALID_UA_CONFIG_KEYS, DataPath, @@ -18,7 +17,7 @@ parse_config, ) from uaclient.conftest import FakeNotice -from uaclient.defaults import DEFAULT_CONFIG_FILE +from uaclient.defaults import DEFAULT_CONFIG_FILE, PRIVATE_SUBDIR from uaclient.entitlements import valid_services from uaclient.entitlements.entitlement_status import ApplicationStatus from uaclient.files import notices