diff options
author | 2015-11-13 18:46:50 +0100 | |
---|---|---|
committer | 2015-11-13 19:50:52 +0100 | |
commit | 17f62e9bd00f5fefd486475861b06d3ec6b7ee10 (patch) | |
tree | 2ae63a9b91d5968733db25892a72f7f46a5e430a /src/core/dbus-manager.c | |
parent | man: document our definition of a year and a month (diff) | |
download | systemd-17f62e9bd00f5fefd486475861b06d3ec6b7ee10.tar.gz systemd-17f62e9bd00f5fefd486475861b06d3ec6b7ee10.tar.bz2 systemd-17f62e9bd00f5fefd486475861b06d3ec6b7ee10.zip |
core: enable transient unit support for slice units
Diffstat (limited to 'src/core/dbus-manager.c')
-rw-r--r-- | src/core/dbus-manager.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 72ad6121e..67e4e8b21 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -655,7 +655,18 @@ static int transient_unit_from_message( if (r < 0) return r; - if (u->load_state != UNIT_NOT_FOUND || + /* Check if the unit already exists or is already referenced, + * in a number of different ways. Note that to cater for unit + * types such as slice, we are generally fine with units that + * are marked UNIT_LOADED even even though nothing was + * actually loaded, as those unit types don't require a file + * on disk to validly load. */ + + if (!IN_SET(u->load_state, UNIT_NOT_FOUND, UNIT_LOADED) || + u->fragment_path || + u->source_path || + !strv_isempty(u->dropin_paths) || + u->refs || set_size(u->dependencies[UNIT_REFERENCED_BY]) > 0) return sd_bus_error_setf(error, BUS_ERROR_UNIT_EXISTS, "Unit %s already exists.", name); |