[ceph-client] Strip any errors preceding pool properties JSON
Sometimes errors appear in the 'ceph osd pool get' output before the JSON string. The returned string is saved and is assumed to contain only the JSON string with the pool properties. When errors appear in the string, pool properties are not read properly, which can cause pools to be misconfigured. This change filters that output so only the expected JSON string is returned. It can then be parsed correctly. Change-Id: I83347cc32da7e7af160b5cacc2a99de74eebebc7
This commit is contained in:
parent
45b492bcf7
commit
9c5e5102f6
@ -15,6 +15,6 @@ apiVersion: v1
|
||||
appVersion: v1.0.0
|
||||
description: OpenStack-Helm Ceph Client
|
||||
name: ceph-client
|
||||
version: 0.1.45
|
||||
version: 0.1.46
|
||||
home: https://github.com/ceph/ceph-client
|
||||
...
|
||||
|
@ -249,7 +249,9 @@ function create_pool () {
|
||||
ceph --cluster "${CLUSTER}" osd pool application enable "${POOL_NAME}" "${POOL_APPLICATION}"
|
||||
fi
|
||||
|
||||
pool_values=$(ceph --cluster "${CLUSTER}" osd pool get "${POOL_NAME}" all -f json)
|
||||
# 'tr' and 'awk' are needed here to strip off text that is echoed before the JSON string.
|
||||
# In some cases, errors/warnings are written to stdout and the JSON doesn't parse correctly.
|
||||
pool_values=$(ceph --cluster "${CLUSTER}" osd pool get "${POOL_NAME}" all -f json | tr -d '\n' | awk -F{ '{print "{" $2}')
|
||||
|
||||
if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]]; then
|
||||
if [[ "${ENABLE_AUTOSCALER}" == "true" ]]; then
|
||||
|
@ -46,4 +46,5 @@ ceph-client:
|
||||
- 0 1.43 Document the use of mon_allow_pool_size_one
|
||||
- 0.1.44 Allow pg_num_min to be overridden per pool
|
||||
- 0.1.45 Update Ceph to 17.2.6
|
||||
- 0.1.46 Strip any errors preceding pool properties JSON
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user