@@ -29,7 +29,11 @@ public function setup()
29
29
{
30
30
$ isBranch = $ this ->branch && $ this ->branch ->isBranch ();
31
31
$ branchOnly = $ this ->object ->get ('id ' ) === null ;
32
- if ($ isBranch && $ this ->object instanceof IcingaObject && $ this ->object ->isTemplate ()) {
32
+ if (
33
+ $ isBranch
34
+ && $ this ->object instanceof IcingaObject
35
+ && ($ this ->object ->isTemplate () && ! $ this ->object instanceof IcingaServiceSet)
36
+ ) {
33
37
$ this ->addHtml (Hint::error ($ this ->translate (
34
38
'Templates cannot be cloned in Configuration Branches '
35
39
)));
@@ -146,7 +150,11 @@ public function onSuccess()
146
150
$ object ->getObjectName ()
147
151
);
148
152
149
- if ($ object ->isTemplate () && $ this ->branch && $ this ->branch ->isBranch ()) {
153
+ if (
154
+ $ this ->branch
155
+ && $ this ->branch ->isBranch ()
156
+ && ($ object ->isTemplate () && ! ($ object instanceof IcingaServiceSet))
157
+ ) {
150
158
throw new IcingaException ('Cloning templates is not available for Branches ' );
151
159
}
152
160
@@ -211,8 +219,13 @@ public function onSuccess()
211
219
if ($ new instanceof IcingaHost) {
212
220
$ clone ->set ('host_id ' , $ newId );
213
221
} elseif ($ new instanceof IcingaServiceSet) {
214
- $ clone ->set ('service_set_id ' , $ newId );
222
+ if ($ this ->branch && $ this ->branch ->isBranch ()) {
223
+ $ clone ->set ('service_set ' , $ newName );
224
+ } else {
225
+ $ clone ->set ('service_set_id ' , $ newId );
226
+ }
215
227
}
228
+
216
229
$ store ->store ($ clone );
217
230
}
218
231
0 commit comments