From ff6c6cc117245f7717b672ae4dcea22d304aa42f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 26 Sep 2018 23:40:39 +0200 Subject: [PATCH] nspawn: when --quiet is passed, simply downgrade log messages to LOG_DEBUG (#10181) With this change almost all log messages that are suppressed through --quiet are not actually suppressed anymore, but simply downgraded to LOG_DEBUG. Previously we did it this way for some log messages and fully suppressed them for others. With this it's pretty much systematic. Inspired by #10122. --- src/nspawn/nspawn.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index e3bfe85..1e20f46 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -2934,8 +2934,8 @@ static int outer_child( } } - if (!arg_quiet) - log_info("Selected user namespace base " UID_FMT " and range " UID_FMT ".", arg_uid_shift, arg_uid_range); + log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, + "Selected user namespace base " UID_FMT " and range " UID_FMT ".", arg_uid_shift, arg_uid_range); } if (dissected_image) { @@ -4351,16 +4351,15 @@ int main(int argc, char *argv[]) { BTRFS_SNAPSHOT_FALLBACK_IMMUTABLE | BTRFS_SNAPSHOT_RECURSIVE | BTRFS_SNAPSHOT_QUOTA); - if (r == -EEXIST) { - if (!arg_quiet) - log_info("Directory %s already exists, not populating from template %s.", arg_directory, arg_template); - } else if (r < 0) { + if (r == -EEXIST) + log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, + "Directory %s already exists, not populating from template %s.", arg_directory, arg_template); + else if (r < 0) { log_error_errno(r, "Couldn't create snapshot %s from %s: %m", arg_directory, arg_template); goto finish; - } else { - if (!arg_quiet) - log_info("Populated %s from template %s.", arg_directory, arg_template); - } + } else + log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, + "Populated %s from template %s.", arg_directory, arg_template); } } -- 2.7.4