Skip to content

Commit 861d430

Browse files
WIP
Signed-off-by: Lukasz Gryglicki <[email protected]>
1 parent 43610f7 commit 861d430

File tree

5 files changed

+57
-1
lines changed

5 files changed

+57
-1
lines changed

cla-backend/cla/routes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ def request_company_ccla(
232232
# return cla.controllers.user.request_company_admin_access(str(user_id), str(company_id))
233233

234234

235+
# LG: porting this to golang
235236
@hug.get("/user/{user_id}/active-signature", versions=2)
236237
def get_user_active_signature(user_id: hug.types.uuid):
237238
"""
@@ -773,7 +774,7 @@ def get_projects(auth_user: check_auth):
773774
del project["project_external_id"]
774775
return projects
775776

776-
777+
# LG: This is ported to golang and no longer used in dev (still used in prod).
777778
@hug.get("/project/{project_id}", versions=2)
778779
def get_project(project_id: hug.types.uuid):
779780
"""

utils/active_signature_py.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# API_URL=https://api.lfcla.dev.platform.linuxfoundation.org DEBUG=1 ./utils/active_signature_py.sh '4b344ac4-f8d9-11ed-ac9b-b29c4ace74e9'
66
# API_URL=https://api.lfcla.dev.platform.linuxfoundation.org DEBUG=1 ./utils/active_signature_py.sh '4b344ac4-f8d9-11ed-ac9b-b29c4ace74e9'
77
# API_URL=https://api.easycla.lfx.linuxfoundation.org DEBUG='' ./utils/active_signature_py.sh '564e571e-12d7-4857-abd4-898939accdd7'
8+
# ./utils/add_store_active_signature.sh b817eb57-045a-4fe0-8473-fbb416a01d70 d8cead54-92b7-48c5-a2c8-b1e295e8f7f1
9+
# DEBUG='' ./utils/active_signature_py.sh b817eb57-045a-4fe0-8473-fbb416a01d70 | jq '.'
810

911
if [ -z "$1" ]
1012
then
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
# repo: aws --region us-east-1 --profile lfproduct-dev dynamodb scan --table-name "cla-dev-repositories"
3+
if [ -z "$STAGE" ]
4+
then
5+
STAGE=dev
6+
fi
7+
if [ -z "${1}" ]
8+
then
9+
echo "$0: you must specify user ID value as a 1st argument, like: 'b817eb57-045a-4fe0-8473-fbb416a01d70'"
10+
exit 1
11+
fi
12+
if [ -z "${2}" ]
13+
then
14+
echo "$0: you must specify project ID value as a 2nd argument, like: 'd8cead54-92b7-48c5-a2c8-b1e295e8f7f1'"
15+
exit 2
16+
fi
17+
EXPIRE_TS=$(date -d 'tomorrow' +%s)
18+
aws --profile "lfproduct-${STAGE}" dynamodb put-item --table-name "cla-${STAGE}-store" --item '{
19+
"key": {
20+
"S": "active_signature:'"${1}"'"
21+
},
22+
"value": {
23+
"S": "{\"user_id\": \"'"${1}"'\", \"project_id\": \"'"${2}"'\", \"repository_id\": 466156917, \"pull_request_id\": 3}"
24+
},
25+
"expire": {
26+
"N": "'"${EXPIRE_TS}"'"
27+
}
28+
}'

utils/scan_store.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
if [ -z "$STAGE" ]
3+
then
4+
STAGE=dev
5+
fi
6+
if [ ! -z "${DEBUG}" ]
7+
then
8+
echo "aws --profile \"lfproduct-${STAGE}\" dynamodb scan --table-name \"cla-${STAGE}-store\" --max-items 100 | jq -r '.Items'"
9+
fi
10+
aws --profile "lfproduct-${STAGE}" dynamodb scan --table-name "cla-${STAGE}-store" --max-items 100 | jq -r '.Items'

utils/set_store_expire.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
if [ -z "$STAGE" ]
3+
then
4+
STAGE=dev
5+
fi
6+
if [ -z "${1}" ]
7+
then
8+
echo "$0: you must specify ID value as a 1st argument, like: 'b817eb57-045a-4fe0-8473-fbb416a01d70'"
9+
exit 1
10+
fi
11+
if [ ! -z "${DEBUG}" ]
12+
then
13+
echo "aws --profile \"lfproduct-${STAGE}\" dynamodb update-item --table-name \"cla-${STAGE}-store\" --key '{\"key\": {\"S\": \"${1}\"}}' --update-expression \"SET expire = :newval\" --expression-attribute-values '{\":newval\": {\"N\": \"'\"$(date -d '+1 day' +%s)\"'\"}}'"
14+
fi
15+
aws --profile "lfproduct-${STAGE}" dynamodb update-item --table-name "cla-${STAGE}-store" --key "{\"key\": {\"S\": \"${1}\"}}" --update-expression "SET expire = :newval" --expression-attribute-values '{":newval": {"N": "'"$(date -d '+1 day' +%s)"'"}}'

0 commit comments

Comments
 (0)