network-generator: Add logging

We stick to debug logging because in some cases network-generator
will fall back to trying another parsing function if one fails, so
if we return an error it's not necessarily a failure.
This commit is contained in:
Daan De Meyer
2024-04-02 22:52:02 +02:00
parent 19e980eb92
commit 3cb618084a
3 changed files with 90 additions and 76 deletions

View File

@@ -48,7 +48,7 @@ static int network_save(Network *network, const char *dest_dir) {
r = conservative_rename(temp_path, p);
if (r < 0)
return r;
return log_error_errno(r, "Failed to rename '%s' to '%s': %m", temp_path, p);
temp_path = mfree(temp_path);
return 0;
@@ -79,7 +79,7 @@ static int netdev_save(NetDev *netdev, const char *dest_dir) {
r = conservative_rename(temp_path, p);
if (r < 0)
return r;
return log_error_errno(r, "Failed to rename '%s' to '%s': %m", temp_path, p);
temp_path = mfree(temp_path);
return 0;
@@ -113,7 +113,7 @@ static int link_save(Link *link, const char *dest_dir) {
r = conservative_rename(temp_path, p);
if (r < 0)
return r;
return log_error_errno(r, "Failed to rename '%s' to '%s': %m", temp_path, p);
temp_path = mfree(temp_path);
return 0;

File diff suppressed because it is too large Load Diff

View File

@@ -49,7 +49,7 @@ run_network_generator() {
rm -rf "${WORK_DIR:?}"/*
stderr="$WORK_DIR/stderr"
if ! "$GENERATOR_BIN" --root "$WORK_DIR" 2>"$stderr"; then
if ! SYSTEMD_LOG_LEVEL="info" "$GENERATOR_BIN" --root "$WORK_DIR" 2>"$stderr"; then
echo >&2 "Generator failed when parsing $SYSTEMD_PROC_CMDLINE"
cat >&2 "$stderr"
return 1