Skip to content

Commit cc4810a

Browse files
committed
rimport: Add todos.
1 parent 0d44a0b commit cc4810a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

rimport

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ def stage_data(src: Path, inputdata_root: Path, staging_root: Path) -> None:
122122
try:
123123
rel = src.resolve().relative_to(inputdata_root.resolve())
124124
except ValueError:
125+
# TODO: Do not hard-code string here
126+
# TODO: Check whether it's IN THE DIRECTORY, not whether the path contains a string
125127
if "d651077" in str(src):
126128
raise RuntimeError(f"Source file {src.name} is already published.")
127129
else:
@@ -137,13 +139,16 @@ def ensure_running_as(target_user: str, argv: list[str]) -> None:
137139
try:
138140
target_uid = pwd.getpwnam(target_user).pw_uid
139141
except KeyError:
142+
# TODO: Raise Python error instead of SystemExit
140143
print(f"rimport: target user '{target_user}' not found on this system", file=sys.stderr)
141144
raise SystemExit(2)
142145

143146
if os.geteuid() != target_uid:
144147
if not sys.stdin.isatty():
148+
# TODO: Do not hard-code "cesmdata" here
145149
print("rimport: need interactive TTY to authenticate as 'cesmdata' (2FA).\n"
146150
" Try: sudo -u cesmdata rimport …", file=sys.stderr)
151+
# TODO: Raise Python error instead of SystemExit
147152
raise SystemExit(2)
148153
# Re-exec under target user; this invokes sudo’s normal password/2FA flow.
149154
os.execvp("sudo", ["sudo", "-u", target_user, "--"] + argv)

0 commit comments

Comments
 (0)