Skip to content

Commit 4116d42

Browse files
authored
Merge pull request #7 from ni/users/pthong/remove_cli_env_var
Removed NITLSCONFIG_CLI_ENV_VAR
2 parents be259f3 + 0f037b4 commit 4116d42

2 files changed

Lines changed: 4 additions & 30 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Installed and imported as `nitlsconfig`; developed at
88

99
## Runtime dependencies
1010

11-
- nitlsconfig executable, discoverable, or explicit path to NITLSCONFIG_CLI
11+
- nitlsconfig executable, discoverable.
1212

1313
## Install
1414

src/nitlsconfig/cli.py

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
import argparse
66
import json
7-
import os
8-
import pathlib
9-
import platform
107
import subprocess # nosec B404 - required to invoke the trusted nitlsconfig CLI
118
import sys
129
from dataclasses import dataclass, field
@@ -15,8 +12,6 @@
1512

1613
ALLOWED_SCOPES: Tuple[str, ...] = ("client", "server")
1714

18-
NITLSCONFIG_CLI_ENV_VAR = "NITLSCONFIG_CLI"
19-
2015
# Expected JSON root keys from nitlsconfig output.
2116
ROLE_TO_JSON_ROOT_KEY = {
2217
"client": "client",
@@ -334,30 +329,9 @@ def run_nitlsconfig_command(
334329
timeout=30,
335330
) # nosec B603 - argv is passed shell-free and executable selection is controlled
336331
except FileNotFoundError as ex:
337-
fallback_root = os.environ.get(NITLSCONFIG_CLI_ENV_VAR)
338-
if fallback_root and fallback_root != executable:
339-
suffix = ".exe" if platform.system().lower() == "windows" else ""
340-
fallback_executable = pathlib.Path(fallback_root) / f"nitlsconfig{suffix}"
341-
fallback_executable_str = str(fallback_executable)
342-
fallback_argv = [fallback_executable_str, *command_args]
343-
try:
344-
completed = subprocess.run(
345-
fallback_argv,
346-
capture_output=True,
347-
text=True,
348-
check=False,
349-
timeout=30,
350-
) # nosec B603 - argv is passed shell-free and fallback executable is explicit
351-
argv = fallback_argv
352-
except FileNotFoundError as fallback_ex:
353-
raise ExecutableNotFoundError(
354-
"Unable to find nitlsconfig executable. "
355-
f"Tried {executable!r} and {NITLSCONFIG_CLI_ENV_VAR}={fallback_root!r}."
356-
) from fallback_ex
357-
else:
358-
raise ExecutableNotFoundError(
359-
"Unable to find nitlsconfig executable. " f"Tried {executable!r}."
360-
) from ex
332+
raise ExecutableNotFoundError(
333+
"Unable to find nitlsconfig executable. " f"Tried {executable!r}."
334+
) from ex
361335

362336
if completed.returncode != 0:
363337
command_display = " ".join(argv)

0 commit comments

Comments
 (0)