Simplify some scripts and remove some unnecessary jq usage

jq is powerful tool but in some points it's kind of overkill and jq
can be replaced by simple openstack command with appropriate options.

Change-Id: I5cb09b953d725482a525be16be31f0e2ecf42966
This commit is contained in:
Radoslaw Smigielski 2018-11-06 12:52:52 +01:00 committed by Natal Ngétal
parent 1d03dfbd80
commit 72d9519f78
4 changed files with 4 additions and 4 deletions

View File

@ -70,7 +70,7 @@
- name: assert UC services started
shell: |
source {{ undercloud_rc }} ;
timeout 10 openstack stack list -f json | jq -c -r '.[]|.["Stack Name"]'
timeout 10 openstack stack list -f value -c "Stack Name"
ignore_errors: true
register: oc_name
until: oc_name.stdout.find('{{ overcloud_stack_name }}') != -1

View File

@ -87,7 +87,7 @@
- name: register overcloud nodes ip address
shell: |
source {{ undercloud_rc }}
openstack server list -f json | jq -r -c '.[] | .Networks' | grep -oP '[0-9.]+'
openstack server list -f value -c Networks | grep -oP '[0-9.]+'
register: node_ip
- name: copy certificate to the overcloud nodes and update the trusted store

View File

@ -88,7 +88,7 @@ while true; do
echo "Block migrating {{ instance }} back to {{ node_name }} ..."
nova live-migration --block-migrate {{ instance }} {{ node_name }}
fi
INSTANCE_HOST=$(openstack server show {{ instance }} -f json | jq -r -c '. | .["OS-EXT-SRV-ATTR:host"]')
INSTANCE_HOST=$(openstack server show {{ instance }} -f value -c OS-EXT-SRV-ATTR:host)
if [ $INSTANCE_HOST == '{{ node_name }}' ]; then
break
fi

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -eux
SERVER_ID=$(openstack server list -f json | jq -r -c '.[0] | .ID')
SERVER_ID=$(openstack server list -f value -c ID --limit 1)
SERVER_FIP=$(openstack server show -f json ${SERVER_ID} | jq -r -c '.addresses' | grep -oP ',.*' | sed s/,\ //)
SERVER_SSH_USER={{ workload_user }}