ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
1abbee
From 9b33863a2cfa31bbe57bab685776b64731f528f1 Mon Sep 17 00:00:00 2001
1abbee
From: Lukas Nykryn <lnykryn@redhat.com>
1abbee
Date: Wed, 30 Mar 2016 13:49:50 +0200
1abbee
Subject: [PATCH] core: improve error message when starting template without
1abbee
 instance
1abbee
1abbee
Cherry-picked from: 5d512d54429aa9d2f4a0ca215bb2e982db720d6b
1abbee
Resolves: #1142369
1abbee
---
1abbee
 src/core/manager.c | 6 +++++-
1abbee
 1 file changed, 5 insertions(+), 1 deletion(-)
1abbee
1abbee
diff --git a/src/core/manager.c b/src/core/manager.c
c62b8e
index bde17ce0be..bb5050303c 100644
1abbee
--- a/src/core/manager.c
1abbee
+++ b/src/core/manager.c
1abbee
@@ -1328,8 +1328,12 @@ int manager_load_unit_prepare(
1abbee
 
1abbee
         t = unit_name_to_type(name);
1abbee
 
1abbee
-        if (t == _UNIT_TYPE_INVALID || !unit_name_is_valid(name, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE))
1abbee
+        if (t == _UNIT_TYPE_INVALID || !unit_name_is_valid(name, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE)) {
1abbee
+                if (unit_name_is_valid(name, UNIT_NAME_TEMPLATE))
1abbee
+                        return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, "Unit name %s is missing the instance name.", name);
1abbee
+
1abbee
                 return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, "Unit name %s is not valid.", name);
1abbee
+        }
1abbee
 
1abbee
         ret = manager_get_unit(m, name);
1abbee
         if (ret) {