From ebdb49bbdb14580548a53afaded71224adec0f0c Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Tue, 26 Mar 2024 16:27:20 +0100
Subject: [PATCH] director-cli: check http status instead of existcode on
 object creation

---
 director-cli.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/director-cli.sh b/director-cli.sh
index eb0b846..690f5e1 100755
--- a/director-cli.sh
+++ b/director-cli.sh
@@ -503,7 +503,9 @@ hostDefaultgroups="groups[]=iml groups[]=iml-server"
       _action=update
     fi
 
-    if ObjAction $_action service; then
+    # if ObjAction $_action service; then
+    ObjAction $_action service
+    if [ -z "$(http.isOk)" ]; then
       echo "OK $_action service ${IDC_service__obj_name}"
       return 0
     else
@@ -525,7 +527,9 @@ hostDefaultgroups="groups[]=iml groups[]=iml-server"
       # create command if it does not exist
       if serviceCreateOrUpdate >/dev/null ; then
         if ! ObjAction exists svclink; then
-          if ObjAction create svclink; then
+          # if ObjAction create svclink; then
+          ObjAction create svclink
+          if [ -z "$(http.isOk)" ]; then
             echo "OK: linked service ${checkName} on host [$MY_NAME] was created"
           else
             echo "ERROR :-/ unable to create linked service ${checkName} on host [$MY_NAME]"
-- 
GitLab