daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
c62b8e
From 50a411f4b70ea27e2fd33c19394030e57a4a1280 Mon Sep 17 00:00:00 2001
c62b8e
From: Jan Synacek <jsynacek@redhat.com>
c62b8e
Date: Tue, 11 Dec 2018 13:11:25 +0100
c62b8e
Subject: [PATCH] systemctl: Allow 'edit' and 'cat' on unloaded units
c62b8e
c62b8e
Don't fail if the unit has a LoadError; otherwise `systemctl edit` cannot be
c62b8e
used to correct the error (e.g. multiple "ExecStart=" lines).
c62b8e
c62b8e
Remove file changed warning so cat output isn't interspersed with log messages.
c62b8e
c62b8e
Fixes #829
c62b8e
c62b8e
(cherry picked from commit 1e524ec6e2031629fec27906423619e3403b2f3e)
c62b8e
c62b8e
Resolves: #1649518
c62b8e
---
c62b8e
 src/systemctl/systemctl.c | 30 ------------------------------
c62b8e
 1 file changed, 30 deletions(-)
c62b8e
c62b8e
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
c62b8e
index b1862b5676..f31137787a 100644
c62b8e
--- a/src/systemctl/systemctl.c
c62b8e
+++ b/src/systemctl/systemctl.c
c62b8e
@@ -2311,42 +2311,12 @@ static int unit_find_paths(sd_bus *bus,
c62b8e
 
c62b8e
         if (!avoid_bus_cache && !unit_name_is_template(unit_name)) {
c62b8e
                 _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
c62b8e
-                _cleanup_bus_message_unref_ sd_bus_message *unit_load_error = NULL;
c62b8e
                 _cleanup_free_ char *unit = NULL;
c62b8e
-                char *unit_load_error_name, *unit_load_error_message;
c62b8e
 
c62b8e
                 unit = unit_dbus_path_from_name(unit_name);
c62b8e
                 if (!unit)
c62b8e
                         return log_oom();
c62b8e
 
c62b8e
-                if (need_daemon_reload(bus, unit_name) > 0)
c62b8e
-                        warn_unit_file_changed(unit_name);
c62b8e
-
c62b8e
-                r = sd_bus_get_property(
c62b8e
-                                bus,
c62b8e
-                                "org.freedesktop.systemd1",
c62b8e
-                                unit,
c62b8e
-                                "org.freedesktop.systemd1.Unit",
c62b8e
-                                "LoadError",
c62b8e
-                                &error,
c62b8e
-                                &unit_load_error,
c62b8e
-                                "(ss)");
c62b8e
-                if (r < 0)
c62b8e
-                        return log_error_errno(r, "Failed to get LoadError: %s", bus_error_message(&error, r));
c62b8e
-
c62b8e
-                r = sd_bus_message_read(
c62b8e
-                                unit_load_error,
c62b8e
-                                "(ss)",
c62b8e
-                                &unit_load_error_name,
c62b8e
-                                &unit_load_error_message);
c62b8e
-                if (r < 0)
c62b8e
-                        return bus_log_parse_error(r);
c62b8e
-
c62b8e
-                if (!isempty(unit_load_error_name)) {
c62b8e
-                        log_error("Unit %s is not loaded: %s", unit_name, unit_load_error_message);
c62b8e
-                        return 0;
c62b8e
-                }
c62b8e
-
c62b8e
                 r = sd_bus_get_property_string(
c62b8e
                                 bus,
c62b8e
                                 "org.freedesktop.systemd1",