summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2016-03-30 13:49:50 +0200
committerLukas Nykryn <lnykryn@redhat.com>2016-03-30 13:54:33 +0200
commit5d512d54429aa9d2f4a0ca215bb2e982db720d6b (patch)
tree9a4a772e82c27809a304208533581084d8536d82
parentab19c9e45744b3a300583673ee9af0b9dddec7c1 (diff)
core: improve error message when starting template without instance
-rw-r--r--src/core/manager.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 14ee68a3d2..e739795e70 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1333,8 +1333,12 @@ int manager_load_unit_prepare(
t = unit_name_to_type(name);
- if (t == _UNIT_TYPE_INVALID || !unit_name_is_valid(name, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE))
+ if (t == _UNIT_TYPE_INVALID || !unit_name_is_valid(name, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE)) {
+ if (unit_name_is_valid(name, UNIT_NAME_TEMPLATE))
+ return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, "Unit name %s is missing the instance name.", name);
+
return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, "Unit name %s is not valid.", name);
+ }
ret = manager_get_unit(m, name);
if (ret) {