aboutsummaryrefslogtreecommitdiffstats
path: root/onap-client/onap_client/config.py
diff options
context:
space:
mode:
authorstark, steven <steven.stark@att.com>2020-09-17 13:04:35 -0700
committerstark, steven <steven.stark@att.com>2020-09-17 13:04:35 -0700
commit35375724d9657de99adb8e530e1be21305555a40 (patch)
tree28806a1a1317426546ffdb9755d6f632ce088605 /onap-client/onap_client/config.py
parent591c548e569423dad8d106d4d2cd26bc5ce24b19 (diff)
[VVP] Updating onap-client
Removing dependency on distutils moving etc/ to package resource Adding support for volume creation and delete Removing module level imports Adding delete capability to spec-engine Adding kwarg to pass Client instance to functions Issue-ID: VVP-469 Signed-off-by: stark, steven <steven.stark@att.com> Change-Id: Ie00065f54411c8ff40ea20c35fe919ce15f65e6a
Diffstat (limited to 'onap-client/onap_client/config.py')
-rw-r--r--onap-client/onap_client/config.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/onap-client/onap_client/config.py b/onap-client/onap_client/config.py
index 6fe43e9..3b85bf8 100644
--- a/onap-client/onap_client/config.py
+++ b/onap-client/onap_client/config.py
@@ -34,11 +34,12 @@
# limitations under the License.
#
# ============LICENSE_END============================================
-
-import distutils.sysconfig
import logging
import os
import yaml
+from importlib_resources import files
+
+from onap_client import etc
class Config:
@@ -75,24 +76,24 @@ class Config:
)
if not config_data:
- with open("{}/config.example.yaml".format(PATH), "r") as f:
+ with open(os.path.join(files(etc), "config.example.yaml"), "r") as f:
config_data = yaml.safe_load(f)
self.config = config_data
for key in keys:
self.config = self.config.get(key, {})
+ @property
+ def payload_directory(self):
+ return os.path.join(files(etc), "payloads")
+
+ @property
+ def application_id(self):
+ return "robot-ete"
+
def load_config(config_file, *config_args):
config = Config(config_file)
config.load(*config_args)
return config
-
-
-PATH = "{}/onap_client".format(distutils.sysconfig.PREFIX)
-PAYLOADS_DIR = "{}/payloads".format(PATH)
-APPLICATION_ID = "robot-ete"
-CONFIG_ENV = os.environ.get("OC_CONFIG")
-CONFIG_FILE = CONFIG_ENV or "/etc/onap_client/config.yaml"
-APP_CONFIG = load_config(CONFIG_FILE, "onap_client")