feature: created cases for non-YAML parsing, tho not yet implemented
This commit is contained in:
10
confctx.py
10
confctx.py
@@ -23,7 +23,7 @@ class Config:
|
||||
filepath = Path(parent_dir) / filepath
|
||||
filename: str = filepath.stem
|
||||
|
||||
self.parse_method = "yml"
|
||||
self.parse_method = "YML"
|
||||
if "." in filename:
|
||||
filename_arr = filename.split(".")
|
||||
basename: str = filename_arr[0]
|
||||
@@ -45,7 +45,13 @@ class Config:
|
||||
|
||||
self.file = open(str(self.filepath), self.mode)
|
||||
model = self.file.read()
|
||||
self.model = yams.load(model)
|
||||
|
||||
if self.parse_method == "INI":
|
||||
raise NotImplementedError
|
||||
elif self.parse_method == "TOML":
|
||||
raise NotImplementedError
|
||||
else:
|
||||
self.model = yams.load(model)
|
||||
|
||||
if self.scope == AnsibleScopes.GROUPVARS.name or self.scope == AnsibleScopes.HOSTVARS.name:
|
||||
api_key: str = model["vps_service"]["api_key"]
|
||||
|
||||
Reference in New Issue
Block a user