Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: iam policy printing cleanups #18961

Merged
merged 4 commits into from Nov 26, 2017

Conversation

Projects
None yet
2 participants
@tchaikov
Copy link
Contributor

commented Nov 16, 2017

No description provided.

@tchaikov tchaikov requested a review from adamemerson Nov 16, 2017

@@ -1433,12 +1442,12 @@ ostream& operator <<(ostream& m, const Statement& s) {
}
if (!s.princ.empty()) {
m << "Principal: ";
print_array(m, s.princ.cbegin(), s.princ.cend());
print_dict(m, s.princ.cbegin(), s.princ.cend());
@@ -1492,7 +1501,7 @@ ostream& operator <<(ostream& m, const Statement& s) {

if (!s.conditions.empty()) {
m << "Condition: ";
print_array(m, s.conditions.cbegin(), s.conditions.cend());
print_dict(m, s.conditions.cbegin(), s.conditions.cend());

This comment has been minimized.

@tchaikov tchaikov force-pushed the tchaikov:wip-rgw-print-iam-policy branch from 0246567 to ffacc31 Nov 16, 2017

tchaikov added some commits Nov 16, 2017

common: add {,make_}ostream_joiner
it's handy to print arrays like containers.

Signed-off-by: Kefu Chai <kchai@redhat.com>
rgw: use ostream_joiner to print arrays
Signed-off-by: Kefu Chai <kchai@redhat.com>
rgw: print dict-like IAM Policy element as a dict
so they are printed like
{ Hello: World, Goodbye: [ Cruel, World ] }
instead of
[ Hello: World, Goodbye: [ Cruel, World ] ]

also, all of the print_dict() caller sites are protected by
`if (!foo.empty())`, so no need to check for empty.

Signed-off-by: Kefu Chai <kchai@redhat.com>
rgw: do not print the leading "{" for Condition
so the parentheses matches.

also add a space before the ending "}", so it looks better.

Reported-by: Bingyin Zhang <zhangbingyin@cloudin.cn>
Signed-off-by: Kefu Chai <kchai@redhat.com>

@tchaikov tchaikov force-pushed the tchaikov:wip-rgw-print-iam-policy branch from f7b4b32 to bf7e7a7 Nov 16, 2017

@tchaikov

This comment has been minimized.

Copy link
Contributor Author

commented Nov 17, 2017

retest this please

@adamemerson
Copy link
Contributor

left a comment

I like the design.

@tchaikov tchaikov merged commit 342d1bc into ceph:master Nov 26, 2017

5 checks passed

Docs: build check OK - docs built
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
make check make check succeeded
Details
make check (arm64) make check succeeded
Details

@tchaikov tchaikov deleted the tchaikov:wip-rgw-print-iam-policy branch Nov 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.