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

More scripts #801

Merged
merged 20 commits into from
Jul 18, 2019
Merged

More scripts #801

merged 20 commits into from
Jul 18, 2019

Conversation

fisx
Copy link
Contributor

@fisx fisx commented Jul 15, 2019

No description provided.

@fisx
Copy link
Contributor Author

fisx commented Jul 15, 2019

I am going to tests these later (unless somebody will be faster than me), but this is ready for review.

Copy link
Member

@jschaul jschaul left a comment

Choose a reason for hiding this comment

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

I didn't try all the scripts yet, just fixed a parse problem in one of them. I wonder if we could write a test for these scripts (so we notice if they become broken in the future)?

echo "Created the invitation, sleeping 1 second..." 1>&2
sleep 1

ERR='{"code":409,"message":"The given e-mail address is in use.","label":"email-exists"}'
Copy link
Member

Choose a reason for hiding this comment

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

This is not the only error case; the team ID or the user ID could also be incorrect, or the permissions for that admin_userid could not be sufficient. Perhaps you could abort the script on any 4xx, not just this particular 409.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

like this?: 311c13c

@@ -0,0 +1,81 @@
#!/usr/bin/env bash

set -ex
Copy link
Member

Choose a reason for hiding this comment

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

is -x verbosity necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like it. If you don't let me know and I'll remove it.

deploy/services-demo/create_team_members.sh Outdated Show resolved Hide resolved
@fisx
Copy link
Contributor Author

fisx commented Jul 16, 2019

tried this on staging:

./create_team_members.sh -a ... -t ... -h http://localhost:8080 -c test.csv

with

13d36c88-a7e6-11e9-b223-17f9008c907c@mailinator.com,Frau Eins
191979ee-a7e6-11e9-95dd-33b87ece1d4e@mailinator.com,Herr Zwei
1a2e785c-a7e6-11e9-b369-db410f934c12@mailinator.com,Grünling

2019-07-16-182703_2048x1152_scrot

mailinator doesn't work any more without registration, but seeing pending users is good enough for me.

@fisx fisx requested a review from jschaul July 16, 2019 16:33
-a <admin uuid>: User ID of the inviting admin. default: ${ADMIN_UUID}
-t <team uuid>: ID of the inviting team. default: ${TEAM_UUID}
-h <host>: Base URI of brig. default: ${BRIG_HOST}
-c: input file containing info on the invitees in format 'Email,UserName'. default: ${CSV_FILE}
Copy link
Member

Choose a reason for hiding this comment

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

perhaps "-c <input_file>: file containing ...

END=$((COUNT + START - 1))
for i in $(seq "$START" "$END")
do
EMAIL='w'$(printf "%03d" "$i")"@example.com"
Copy link
Member

Choose a reason for hiding this comment

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

perhaps a comment or something to tell the user the emails start with 'w'?

Copy link
Contributor

Choose a reason for hiding this comment

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

One thing that we should be careful about is that we actually send out emails with this request.
Sending emails to example.com will trigger an email being sent out and may lower our reputation.
Perhaps make the domain configurable and explain that, currently, we effectively send out the emails (and perhaps we need an extra endpoint/flag that prevents sending it over the Wire?)
@fisx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, only saw that after I merged... I'll make another PR and ping you.

TEAM=$(echo "$CURL_OUT" | tail -1 | sed 's/.*\"team\":\"\([a-z0-9-]*\)\".*/\1/')

if [ "$TEAM" != "$TEAM_UUID" ]; then
echo "unexpected error: user got assigned to no / the wrong team?!"
Copy link
Member

Choose a reason for hiding this comment

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

perhaps dump the curl_out here?

@fisx fisx merged commit c2f0a02 into develop Jul 18, 2019
@fisx fisx deleted the more-scripts branch July 18, 2019 11:02
@fisx fisx mentioned this pull request Jul 18, 2019
@fisx fisx mentioned this pull request Jul 30, 2019
@fisx fisx mentioned this pull request Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants