mirror of https://github.com/ceph/ceph-ansible.git
common: use discovered_interpreter_python fact
in order to use the right binary name when using python cli in command
or shell module.
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 13815ad3ca
)
pull/4348/head
parent
4b2d13995d
commit
2f77704591
|
@ -116,7 +116,7 @@
|
|||
# 'sleep 5' is not that bad and should be sufficient
|
||||
- name: verify the monitor is out of the cluster
|
||||
shell: |
|
||||
{{ container_exec_cmd }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["quorum_names"])'
|
||||
{{ container_exec_cmd }} ceph --cluster {{ cluster }} -s -f json | {{ discovered_interpreter_python }} -c 'import sys, json; print(json.load(sys.stdin)["quorum_names"])'
|
||||
delegate_to: "{{ mon_host }}"
|
||||
failed_when: false
|
||||
register: result
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
- not rolling_update | bool
|
||||
block:
|
||||
- name: generate cluster fsid
|
||||
shell: python -c 'import uuid; print(str(uuid.uuid4()))'
|
||||
shell: "{{ discovered_interpreter_python }} -c 'import uuid; print(str(uuid.uuid4()))'"
|
||||
register: cluster_uuid
|
||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||
run_once: true
|
||||
|
|
|
@ -19,7 +19,7 @@ $DOCKER_EXEC test -S /var/run/ceph/{{ cluster }}-mon.{{ ansible_hostname }}.asok
|
|||
|
||||
check_quorum() {
|
||||
while [ $RETRIES -ne 0 ]; do
|
||||
$DOCKER_EXEC ceph --cluster {{ cluster }} -s --format json | python -c 'import sys, json; exit(0) if "{{ monitor_name }}" in json.load(sys.stdin)["quorum_names"] else exit(1)' && exit 0
|
||||
$DOCKER_EXEC ceph --cluster {{ cluster }} -s --format json | "{{ discovered_interpreter_python }}" -c 'import sys, json; exit(0) if "{{ monitor_name }}" in json.load(sys.stdin)["quorum_names"] else exit(1)' && exit 0
|
||||
sleep $DELAY
|
||||
let RETRIES=RETRIES-1
|
||||
done
|
||||
|
|
|
@ -4,12 +4,12 @@ DELAY="{{ handler_health_osd_check_delay }}"
|
|||
CEPH_CLI="--name client.bootstrap-osd --keyring /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring --cluster {{ cluster }}"
|
||||
|
||||
check_pgs() {
|
||||
num_pgs=$($container_exec ceph $CEPH_CLI -s -f json|python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')
|
||||
num_pgs=$($container_exec ceph $CEPH_CLI -s -f json | "{{ discovered_interpreter_python }}" -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')
|
||||
if [[ "$num_pgs" == "0" ]]; then
|
||||
return 0
|
||||
fi
|
||||
while [ $RETRIES -ne 0 ]; do
|
||||
test "$($container_exec ceph $CEPH_CLI -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')" -eq "$($container_exec ceph $CEPH_CLI -s -f json | python -c 'import sys, json; print(sum ( [ i["count"] for i in json.load(sys.stdin)["pgmap"]["pgs_by_state"] if "active+clean" in i["state_name"]]))')"
|
||||
test "$($container_exec ceph $CEPH_CLI -s -f json | "{{ discovered_interpreter_python }}" -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')" -eq "$($container_exec ceph $CEPH_CLI -s -f json | "{{ discovered_interpreter_python }}" -c 'import sys, json; print(sum ( [ i["count"] for i in json.load(sys.stdin)["pgmap"]["pgs_by_state"] if "active+clean" in i["state_name"]]))')"
|
||||
RET=$?
|
||||
test $RET -eq 0 && return 0
|
||||
sleep $DELAY
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
- name: generate monitor initial keyring
|
||||
shell: >
|
||||
python -c "import os ; import struct ;
|
||||
{{ discovered_interpreter_python }} -c "import os ; import struct ;
|
||||
import time; import base64 ; key = os.urandom(16) ;
|
||||
header = struct.pack('<hiih',1,int(time.time()),0,len(key)) ;
|
||||
print(base64.b64encode(header + key).decode())"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
- name: wait for all osd to be up
|
||||
shell: >
|
||||
test "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_osds"])')" -gt 0 &&
|
||||
test "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_osds"])')" =
|
||||
"$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_up_osds"])')"
|
||||
test "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | {{ discovered_interpreter_python }} -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_osds"])')" -gt 0 &&
|
||||
test "$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | {{ discovered_interpreter_python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_osds"])')" =
|
||||
"$({{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | {{ discovered_interpreter_python }} -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_up_osds"])')"
|
||||
register: wait_for_all_osds_up
|
||||
retries: "{{ nb_retry_wait_osd_up }}"
|
||||
delay: "{{ delay_wait_osd_up }}"
|
||||
|
|
Loading…
Reference in New Issue