Skip to content

Commit 10257ce

Browse files
committed
upmap: Add basic/empty filter to jq and fix Python string/JSON issue
1 parent 854340d commit 10257ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/upmap/upmap-remapped.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def eprint(*args, **kwargs):
4444
print(*args, file=sys.stderr, **kwargs)
4545

4646
try:
47-
OSDS = json.loads(subprocess.getoutput('ceph osd ls -f json | jq -r'))
47+
OSDS = json.loads(subprocess.getoutput('ceph osd ls -f json | jq -r .'))
4848
DF = json.loads(subprocess.getoutput('ceph osd df -f json | jq -r .nodes'))
4949
except ValueError:
5050
eprint('Error loading OSD IDs')
@@ -93,7 +93,7 @@ def rm_upmap_pg_items(pgid):
9393

9494
# discover remapped pgs
9595
try:
96-
remapped_json = subprocess.getoutput('ceph pg ls remapped -f json | jq -r')
96+
remapped_json = r'{}'.format(subprocess.getoutput('ceph pg ls remapped -f json | jq -r .'))
9797
remapped = json.loads(remapped_json)
9898
except ValueError:
9999
eprint('Error loading remapped pgs')
@@ -108,7 +108,7 @@ def rm_upmap_pg_items(pgid):
108108
sys.exit(0)
109109

110110
# discover existing upmaps
111-
osd_dump_json = subprocess.getoutput('ceph osd dump -f json | jq -r')
111+
osd_dump_json = subprocess.getoutput('ceph osd dump -f json | jq -r .')
112112
osd_dump = json.loads(osd_dump_json)
113113
upmaps = osd_dump['pg_upmap_items']
114114

0 commit comments

Comments
 (0)