Skip to content

Commit a7c1c50

Browse files
authored
Merge pull request ceph#45835 from tchaikov/wip-55189
common/ceph_json: dump bool using f->dump_bool() Reviewed-by: Casey Bodley <[email protected]> Reviewed-by: Anthony D'Atri <[email protected]>
2 parents 73ccf6e + 6677658 commit a7c1c50

File tree

4 files changed

+43
-12
lines changed

4 files changed

+43
-12
lines changed

PendingReleaseNotes

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,41 @@
55
defaults to "/var/log/ceph/ops-log-$cluster-$name.log".
66
* The SPDK backend for BlueStore is now able to connect to an NVMeoF target.
77
Please note that this is not an officially supported feature.
8+
* RGW's pubsub interface now returns boolean fields using bool. Before this change,
9+
`/topics/<topic-name>` returns "stored_secret" and "persistent" using a string
10+
of "true" or "false" with quotes around them. After this change, these fields
11+
are returned without quotes so they can be decoded as boolean values in JSON.
12+
The same applies to the `is_truncated` field returned by `/subscriptions/<sub-name>`.
13+
* RGW's response of `Action=GetTopicAttributes&TopicArn=<topic-arn>` REST API now
14+
returns `HasStoredSecret` and `Persistent` as boolean in the JSON string
15+
encoded in `Attributes/EndPoint`.
16+
* All boolean fields previously rendered as string by `rgw-admin` command when
17+
the JSON format is used are now rendered as boolean. If your scripts/tools
18+
relies on this behavior, please update them accordingly. The impacted field names
19+
are:
20+
* absolute
21+
* add
22+
* admin
23+
* appendable
24+
* bucket_key_enabled
25+
* delete_marker
26+
* exists
27+
* has_bucket_info
28+
* high_precision_time
29+
* index
30+
* is_master
31+
* is_prefix
32+
* is_truncated
33+
* linked
34+
* log_meta
35+
* log_op
36+
* pending_removal
37+
* read_only
38+
* retain_head_object
39+
* rule_exist
40+
* start_with_full_sync
41+
* sync_from_all
42+
* syncstopped
43+
* system
44+
* truncated
45+
* user_stats_sync

doc/radosgw/pubsub-module.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ Response will have the following format (JSON):
280280
"push_endpoint":"",
281281
"push_endpoint_args":"",
282282
"push_endpoint_topic":"",
283-
"stored_secret":"",
284-
"persistent":""
283+
"stored_secret":false,
284+
"persistent":true,
285285
},
286286
"arn":""
287287
"opaqueData":""
@@ -519,7 +519,7 @@ The response will hold information on the current marker and whether there are m
519519

520520
::
521521

522-
{"next_marker":"","is_truncated":"",...}
522+
{"next_marker":"","is_truncated":false,...}
523523

524524

525525
The actual content of the response is depended with how the subscription was created.

src/common/ceph_json.cc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,7 @@ void encode_json(const char *name, const char *val, Formatter *f)
531531

532532
void encode_json(const char *name, bool val, Formatter *f)
533533
{
534-
string s;
535-
if (val)
536-
s = "true";
537-
else
538-
s = "false";
539-
540-
f->dump_string(name, s);
534+
f->dump_bool(name, val);
541535
}
542536

543537
void encode_json(const char *name, int val, Formatter *f)

src/pybind/mgr/dashboard/services/rgw_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import logging
66
import re
77
import xml.etree.ElementTree as ET # noqa: N814
8-
from distutils.util import strtobool
98
from subprocess import SubprocessError
109

1110
from mgr_util import build_url
@@ -467,7 +466,7 @@ def user_exists(self, user_id=None):
467466
def _is_system_user(self, admin_path, userid, request=None) -> bool:
468467
# pylint: disable=unused-argument
469468
response = request()
470-
return strtobool(response['data']['system'])
469+
return response['data']['system']
471470

472471
def is_system_user(self) -> bool:
473472
return self._is_system_user(self.admin_path, self.userid)

0 commit comments

Comments
 (0)