diff options
author | Matteo Croce <teknoraver@meta.com> | 2023-12-15 15:48:20 +0100 |
---|---|---|
committer | Matteo Croce <teknoraver@meta.com> | 2023-12-19 13:52:41 +0100 |
commit | b408d46b83266dc7608bda06762a06cb01138f13 (patch) | |
tree | fd7baa2e6edc2db2c05ef322deea68ed0ea9129f | |
parent | dbus-wait-for-jobs: change 'quiet' flag to enum (diff) | |
download | systemd-b408d46b83266dc7608bda06762a06cb01138f13.tar.xz systemd-b408d46b83266dc7608bda06762a06cb01138f13.zip |
systemctl: show success messages when showing transaction
Extend `--show-transaction` so it shows a success message when an unit
is successfully started.
-rw-r--r-- | src/shared/bus-wait-for-jobs.c | 9 | ||||
-rw-r--r-- | src/shared/bus-wait-for-jobs.h | 1 | ||||
-rw-r--r-- | src/systemctl/systemctl-start-unit.c | 1 |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/shared/bus-wait-for-jobs.c b/src/shared/bus-wait-for-jobs.c index d3f33cc376..b3280c15df 100644 --- a/src/shared/bus-wait-for-jobs.c +++ b/src/shared/bus-wait-for-jobs.c @@ -279,8 +279,15 @@ static int check_wait_response(BusWaitForJobs *d, WaitJobsFlags flags, const cha return -EOPNOTSUPP; else if (streq(d->result, "once")) return -ESTALE; - else if (STR_IN_SET(d->result, "done", "skipped")) + else if (streq(d->result, "done")) { + if (FLAGS_SET(flags, BUS_WAIT_JOBS_LOG_SUCCESS)) + log_info("Job for %s finished.", strna(d->name)); return 0; + } else if (streq(d->result, "skipped")) { + if (FLAGS_SET(flags, BUS_WAIT_JOBS_LOG_SUCCESS)) + log_info("Job for %s was skipped.", strna(d->name)); + return 0; + } return log_debug_errno(SYNTHETIC_ERRNO(EIO), "Unexpected job result, assuming server side newer than us: %s", d->result); diff --git a/src/shared/bus-wait-for-jobs.h b/src/shared/bus-wait-for-jobs.h index 7a64ad40db..4d56c079ab 100644 --- a/src/shared/bus-wait-for-jobs.h +++ b/src/shared/bus-wait-for-jobs.h @@ -7,6 +7,7 @@ typedef enum WaitJobsFlags { BUS_WAIT_JOBS_LOG_ERROR = 1 << 0, + BUS_WAIT_JOBS_LOG_SUCCESS = 1 << 1, } WaitJobsFlags; typedef struct BusWaitForJobs BusWaitForJobs; diff --git a/src/systemctl/systemctl-start-unit.c b/src/systemctl/systemctl-start-unit.c index cd7aac18b6..c844f7e1e7 100644 --- a/src/systemctl/systemctl-start-unit.c +++ b/src/systemctl/systemctl-start-unit.c @@ -391,6 +391,7 @@ int verb_start(int argc, char *argv[], void *userdata) { WaitJobsFlags flags = 0; SET_FLAG(flags, BUS_WAIT_JOBS_LOG_ERROR, !arg_quiet); + SET_FLAG(flags, BUS_WAIT_JOBS_LOG_SUCCESS, arg_show_transaction); r = bus_wait_for_jobs(w, flags, make_extra_args(extra_args)); if (r < 0) return r; |