Even more logging fixes
Some checks failed
Lint Checks / Run linter (pull_request) Successful in 37s
Webapp Test / Run webapp test suite (pull_request) Successful in 4m20s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m26s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 7m30s
Smoke Test / Run basic test suite (pull_request) Failing after 13m18s

This commit is contained in:
Thomas E Lackey 2024-02-21 18:43:16 -06:00
parent 4a4d48ddb9
commit bff7ac2e12

View File

@ -41,12 +41,16 @@ class AttrDict(dict):
def logged_cmd(log_file, *vargs):
try:
print(" ".join(vargs), file=log_file)
result = subprocess.run(vargs, capture_output=True, stdout=log_file, stderr=log_file)
if log_file:
print(" ".join(vargs), file=log_file)
result = subprocess.run(vargs, capture_output=True)
result.check_returncode()
return result.stdout.decode()
except Exception as err:
print(str(err), file=log_file)
if result:
print(result.stderr.decode(), file=log_file)
else:
print(str(err), file=log_file)
raise err
@ -184,7 +188,7 @@ class LaconicRegistryClient:
self.set_name(name, new_record_id)
return new_record_id
finally:
logged_cmd("rm", "-rf", tmpdir)
logged_cmd(self.log_file, "rm", "-rf", tmpdir)
def set_name(self, name, record_id):
logged_cmd(self.log_file, "laconic", "-c", self.config_file, "cns", "name", "set", name, record_id)