Skip to content
Snippets Groups Projects
Commit e3ca52cf authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch 'director-cli-errorcode' into 'master'

director-cli: check http status instead of existcode on object creation

See merge request !39
parents 0cc08944 a9d94a6e
No related branches found
No related tags found
1 merge request!39director-cli: check http status instead of existcode on object creation
...@@ -23,10 +23,11 @@ ...@@ -23,10 +23,11 @@
# 2023-10-25 v0.8 ah generate json with "jo"; optimze http requests on services; parallel service function call # 2023-10-25 v0.8 ah generate json with "jo"; optimze http requests on services; parallel service function call
# 2023-11-02 v0.9 ah fix json genration for multiple ports # 2023-11-02 v0.9 ah fix json genration for multiple ports
# 2023-11-03 v0.10 ah fix json key for service link # 2023-11-03 v0.10 ah fix json key for service link
# 2024-03-26 v0.11 ah on service creation: use http status code instead of exitcode
# ====================================================================== # ======================================================================
_version="0.10" _version="0.11"
which curl >/dev/null || exit 1 which curl >/dev/null || exit 1
which jo >/dev/null || exit 1 which jo >/dev/null || exit 1
...@@ -503,7 +504,9 @@ hostDefaultgroups="groups[]=iml groups[]=iml-server" ...@@ -503,7 +504,9 @@ hostDefaultgroups="groups[]=iml groups[]=iml-server"
_action=update _action=update
fi 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}" echo "OK $_action service ${IDC_service__obj_name}"
return 0 return 0
else else
...@@ -525,7 +528,9 @@ hostDefaultgroups="groups[]=iml groups[]=iml-server" ...@@ -525,7 +528,9 @@ hostDefaultgroups="groups[]=iml groups[]=iml-server"
# create command if it does not exist # create command if it does not exist
if serviceCreateOrUpdate >/dev/null ; then if serviceCreateOrUpdate >/dev/null ; then
if ! ObjAction exists svclink; 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" echo "OK: linked service ${checkName} on host [$MY_NAME] was created"
else else
echo "ERROR :-/ unable to create linked service ${checkName} on host [$MY_NAME]" echo "ERROR :-/ unable to create linked service ${checkName} on host [$MY_NAME]"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment