X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=env%2Flib%2Fcommon.sh;h=8ce000621f2a00068dc44cfe129014343551269f;hb=refs%2Fchanges%2F73%2F3873%2F2;hp=39125ef3c072b1cc3dc0c3314c9deb97b1881d53;hpb=7115d7b66c30a26a65f0db4b78a8f0f6e8dc4207;p=icn.git diff --git a/env/lib/common.sh b/env/lib/common.sh index 39125ef..8ce0006 100755 --- a/env/lib/common.sh +++ b/env/lib/common.sh @@ -43,10 +43,6 @@ IRONIC_IPMI_INTERFACE_IP=${IRONIC_IPMI_INTERFACE_IP:-} BM_IMAGE_URL=${BM_IMAGE_URL:-"https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img"} BM_IMAGE=${BM_IMAGE:-"bionic-server-cloudimg-amd64.img"} -#Todo change into nodes list in json pattern -COMPUTE_NODE_FQDN=${COMPUTE_NODE_FQDN:-".akraino.org"} -COMPUTE_NODE_PASSWORD=${COMPUTE_NODE_PASSWORD:-"mypasswd"} - #refered from onap function call_api { #Runs curl with passed flags and provides @@ -81,21 +77,20 @@ function call_api { function list_nodes { NODES_FILE="${IRONIC_DATA_DIR}/nodes.json" - if [ ! -f $IRONIC_DATA_DIR/nodes.json ]; then + if [ ! -f "$NODES_FILE" ]; then exit 1 fi cat "$NODES_FILE" | \ - jq '.nodes[] | { - name, - username:.ipmi_driver_info.username, - password:.ipmi_driver_info.password, - address:.ipmi_driver_info.address - } | - .name + " " + - .username + " " + - .password + " " + - .address' \ - | sed 's/"//g' + jq -r '.nodes[] | [ + .name, + .ipmi_driver_info.username, + .ipmi_driver_info.password, + .ipmi_driver_info.address, + .os.username, + .os.password, + .os.image_name + ] | @csv' | \ + sed 's/"//g' }