]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Make python print statements python3 compatible
authorJohn Fulton <fulton@redhat.com>
Fri, 1 Feb 2019 13:32:14 +0000 (08:32 -0500)
committermergify[bot] <mergify[bot]@users.noreply.github.com>
Fri, 1 Feb 2019 15:23:27 +0000 (15:23 +0000)
The restart_osd_daemon.sh generated from the j2 template
contains a python call which uses 'print x' instead of
'print(x)'. Add the missing parentheses to make this call
compatible with both 2 and 3.

Also add parentheses to other python print calls found
in roles/ceph-client/defaults/main.yml and
infrastructure-playbooks/cluster-os-migration.yml.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1671721
Signed-off-by: John Fulton <fulton@redhat.com>
group_vars/clients.yml.sample
infrastructure-playbooks/untested-by-ci/cluster-os-migration.yml
roles/ceph-client/defaults/main.yml
roles/ceph-handler/templates/restart_osd_daemon.sh.j2

index 34926b2027a7c1345e3df851b33dcd29e13af366..41732efd84c86126982d15c63a3c76edc6f5151e 100644 (file)
@@ -44,7 +44,7 @@ dummy:
 # Eg:
 #  $ ceph-authtool --gen-print-key
 #  or
-#  $ python2 -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)"
+#  $ python2 -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))"
 #
 # To use a particular secret, you have to add 'key' to the dict below, so something like:
 # - { name: client.test, key: "AQAin8tUMICVFBAALRHNrV0Z4MXupRw4v9JQ6Q==" ...
index e09d85bfc118a49226264f9c613147eacd9573f5..6ff8702dd640c60982d5960d57b379cb1d094c62 100644 (file)
 
     - name: Waiting for clean PGs...
       shell: >
-        test "[""$(ceph -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')""]" = "$(ceph -s -f json | python -c 'import sys, json; print [ i["count"] for i in json.load(sys.stdin)["pgmap"]["pgs_by_state"] if i["state_name"] == "active+clean"]')"
+        test "[""$(ceph -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')""]" = "$(ceph -s -f json | python -c 'import sys, json; print([ i["count"] for i in json.load(sys.stdin)["pgmap"]["pgs_by_state"] if i["state_name"] == "active+clean"])')"
       register: result
       until: result.rc == 0
       retries: 10
index 35a5f6976ae5d28d5b1ad6e309442da552af2594..22a6de76bc686cd0c782f9bebbe4ddce4050a6bd 100644 (file)
@@ -36,7 +36,7 @@ pools:
 # Eg:
 #  $ ceph-authtool --gen-print-key
 #  or
-#  $ python2 -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)"
+#  $ python2 -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))"
 #
 # To use a particular secret, you have to add 'key' to the dict below, so something like:
 # - { name: client.test, key: "AQAin8tUMICVFBAALRHNrV0Z4MXupRw4v9JQ6Q==" ...
index 253d2371d907d4af0156b27f779db2a2b2418b04..76ed0d5ea7285b4613daf47071abe5e405df7bdd 100644 (file)
@@ -9,7 +9,7 @@ check_pgs() {
     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 | 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"]]))')"
     RET=$?
     test $RET -eq 0 && return 0
     sleep $DELAY