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

Use jq instead of grep -P for finding users to delete during integrat… #2319

Merged
merged 3 commits into from
Sep 20, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions bin/cleanup-integration
Original file line number Diff line number Diff line change
@@ -62,8 +62,7 @@ for stack in $(cf stacks | awk '/INTEGRATION-STACK/ { print $1 }'); do
cf curl -X DELETE "/v3/stacks/$(cf stack --guid $stack)"
done

CF_USERS=$(cf curl /v3/users | grep -oP '(?<="total_results":)[^"]*' |grep -o '[0-9]\+')
USER_PAGES=$(( $CF_USERS / 50 + 1))
USER_PAGES=$(cf curl /v3/users | jq -r .pagination.total_pages)

for ((i=1; i<=${USER_PAGES}; i++)) ; do
cf curl "/v3/users?per_page=50&page=${i}" | \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line needs to remove the per_page=50 part because the change above I made is just getting the total number of paginated pages for whatever the default number of users of the page is