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

Tweak invite script #877

Merged
merged 3 commits into from
Oct 18, 2019
Merged
Changes from all 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
22 changes: 16 additions & 6 deletions deploy/services-demo/create_team_members.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

set -e

ADMIN_UUID="a09e9521-e14e-4285-ad71-47caa97f4a16"
TEAM_UUID="9e57a378-0dca-468f-9661-7872f5f1c910"
BRIG_HOST="http://localhost:8082"
CSV_FILE="myfile.csv"
ADMIN_UUID="n/a"
TEAM_UUID="n/a"
BRIG_HOST="http://localhost:8080"
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that the 8082 default was due to the fact that this is generally the port used by brig in integration tests and when starting services

CSV_FILE="n/a"

USAGE="
This bash script can be used to invite members to a given team. Input
Expand All @@ -19,6 +19,17 @@ USAGE: $0
-t <team uuid>: ID of the inviting team. default: ${TEAM_UUID}
-h <host>: Base URI of brig. default: ${BRIG_HOST}
-c <input file>: file containing info on the invitees in format 'Email,UserName'. default: ${CSV_FILE}

If you tee(1) stdout, stderr of this script into a log file, you can
grep that log file for errors like this:

$ grep code out.log | grep email-exists # the most common case
$ grep code out.log | grep -v email-exists

If you are in a hurry, you may want to change the sleep(1) at the end
of the invite loop to less than a second. If you want to give up on
the first error, add an exit(1) where we check the $INVIDATION_ID.

"

# Option parsing:
Expand Down Expand Up @@ -73,8 +84,7 @@ do

if ( ( echo "$INVITATION_ID" | grep -q '"code"' ) &&
( echo "$INVITATION_ID" | grep -q '"label"' ) ) ; then
echo "Got an error, aborting: $INVITATION_ID"
exit 1
echo "failed inviting $USER_NAME <$EMAIL>: $INVITATION_ID"
fi

echo "Sleeping 1 second..." 1>&2
Expand Down