summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-07-22 09:26:57 +0300
committerLars Wirzenius <liw@liw.fi>2023-07-22 09:26:57 +0300
commit15df63ab57dc92d59c03799c6aa30e2e93681c7b (patch)
tree66cb41bae99387bc9c12103ab6e9c8bd4159a96f
parentf3e7fa557fb64d9d09aeffa93c56bb96a49d7cb6 (diff)
downloadv-i-15df63ab57dc92d59c03799c6aa30e2e93681c7b.tar.gz
chore: remove logging that was added for debugging
It's too verbose to be useful. Sponsored-by: author
-rwxr-xr-xconfigure-installer27
1 files changed, 0 insertions, 27 deletions
diff --git a/configure-installer b/configure-installer
index b11cc6e..2e97354 100755
--- a/configure-installer
+++ b/configure-installer
@@ -71,40 +71,24 @@ class Config:
return self.config.get("wifi_name"), self.config.get("wifi_password")
def _get_from_file_or_cmd(self, prefix, msg, hostname):
- log("_get: A")
filename = self.config.get(f"{prefix}_file")
- log("_get: B")
if filename is not None:
- log("_get: C")
log(f"reading {msg} from {filename}")
- log("_get: D")
return cat(filename)
- log("_get: E")
cmd = self.config.get(f"{prefix}_cmd")
- log("_get: F")
if hostname is not None:
- log("_get: G")
cmd = hostname.join(cmd.split("$HOST"))
- log("_get: H")
if cmd is not None:
- log("_get: I")
user = self.config.get("cmd_as_user")
- log("_get: J")
if user is not None:
- log("_get: K")
log(f"reading {msg} from command (as {user}): {cmd}")
- log("_get: L")
return run(cmd, user=user)
else:
- log("_get: M")
log(f"reading {msg} from command: {cmd}")
- log("_get: N")
return run(cmd)
- log("_get: O")
log(f"can't read {msg}")
- log("_get: Z")
return None
@@ -119,26 +103,15 @@ def unmount(path):
def run(cmd, user=None):
- log(f"run: A - user={user!r}")
if user is not None:
- log("run: B")
argv = ["sudo", "-u", user, "--", "/bin/bash", "-c", cmd]
- log("run: C")
log(f"argv: {argv}")
- log("run: D")
p = subprocess.run(argv, capture_output=True)
- log("run: E")
else:
- log("run: F")
- log(f"cmd={cmd!r}")
p = subprocess.run(cmd, shell=True, capture_output=True)
- log("run: G")
if p.returncode != 0:
- log("run: H")
sys.stderr.write(p.stderr.decode())
- log("run: J")
sys.exit(1)
- log("run: Z")
return p.stdout.decode()