Skip to content

Commit 686c633

Browse files
committed
Cleanup
1 parent 05d73eb commit 686c633

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

cli/config.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,14 @@ def __export_config(endpoint: platform.Platform, what: list[str], **kwargs) -> N
179179
log.info("Exporting configuration from %s completed", kwargs["url"])
180180

181181

182-
def __read_input_file(file: str) -> dict[str, any]:
182+
def __import_config(endpoint: platform.Platform, what: list[str], data: dict[str, any], **kwargs) -> None:
183+
"""Imports a platform configuration from a JSON file"""
184+
log.info("Importing configuration to %s", kwargs[options.URL])
183185
try:
184-
with open(file, "r", encoding="utf-8") as fd:
186+
with open(kwargs[options.REPORT_FILE], "r", encoding="utf-8") as fd:
185187
data = json.loads(fd.read())
186188
except FileNotFoundError as e:
187189
utilities.exit_fatal(f"OS error while reading file: {e}", exit_code=errcodes.OS_ERROR)
188-
return data
189-
190-
191-
def __import_config(endpoint: platform.Platform, what: list[str], data: dict[str, any], **kwargs) -> None:
192-
"""Imports a platform configuration from a JSON file"""
193-
log.info("Importing configuration to %s", kwargs[options.URL])
194190
key_list = kwargs[options.KEYS]
195191

196192
calls = {
@@ -240,7 +236,7 @@ def main() -> None:
240236
if kwargs["import"]:
241237
if kwargs["file"] is None:
242238
utilities.exit_fatal("--file is mandatory to import configuration", errcodes.ARGS_ERROR)
243-
__import_config(endpoint, what, __read_input_file(kwargs[options.REPORT_FILE]), **kwargs)
239+
__import_config(endpoint, what, **kwargs)
244240
utilities.stop_clock(start_time)
245241
sys.exit(0)
246242

0 commit comments

Comments
 (0)