This repository was archived by the owner on Nov 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
GPII-3138: Update Prefs Safes and their GPII Keys in the data base #6
Open
klown
wants to merge
34
commits into
gpii-ops:master
Choose a base branch
from
klown:GPII-3138
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 17 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
edfc334
GPII-3138: Modified snapset loading to remove existing snapsets, the…
klown 760b795
GPII-3138: Script to update snapsets.
klown 3583141
GPII-3138: Script to update snapsets.
klown f2374d4
GPII-3138: Script to update snapsets in the database.
klown c1a494f
GPII-3138: Script to update snapsets in the database.
klown a8a161f
GPII-3138: Script to update snapsets in the database
klown 98e70d3
GPII-3138: Update snapsets in the database
klown d042026
GPII-3138: Update snapsets in the database
klown 96bddc6
GPII-3138: Update snapsets in the database
klown 7a290b2
GPII-3138: Update snapsets in the database
klown 01908db
GPII-3138: Update snapsets in the database
klown 372e9c4
GPII-3138: Update snapsets in the database
klown 8118574
GPII-3138: Update snapsets in the database
klown d42e2a5
GPII-3138: Update snapsets in the database
klown a730327
GPII-3138: Update snapsets in the database
klown 0e9577b
GPII-3138: Update snapsets in the database.
klown 933d03f
GPII-3138: Docker image that updates snapset in the database
klown 0ba06e4
GPII-3138: Docker image that updates snapset in the database
klown 9bb3f46
GPII-3138: Docker image that updates snapset in the database
klown 8c60cd8
GPII-3138: Docker image that updates snapset in the database
klown ab35aa1
GPII-3138: Docker image that updates snapset in the database
klown 0034b4d
GPII-3138: Docker image that updates snapset in the database
klown 2059195
GPII-3138: Docker image that updates snapset in the database
klown 29b414e
GPII-3138: Docker image that updates snapset in the database
klown c9cf927
GPII-3138: Docker image that updates snapsets in the database
klown 82aa358
GPII-3138: Docker image that updates snapsets in the database
klown c14879c
GPII-3138: Docker image that updates snapsets in the database
klown b7bea34
GPII-3138: Docker image that updates snapsets in the database
klown 9b4b3f1
GPII-3138: Docker image that updates snapsets in the database
klown 0ec50b3
GPII-3138: Docker image that updates snapsets in the database
klown 05e8dcc
GPII-3138: Docker image that updates snapsets in the database
klown a147932
GPII-3138: Docker image that updates snapsets in the database
klown ab4d265
GPII-3138: Docker image that updates snapsets in the database
klown 2680cd3
GPII-3138: Docker image that updates snapsets in the database
klown File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| #!/bin/sh | ||
|
|
||
| STATIC_DATA_DIR=${STATIC_DATA_DIR:-/home/node/universal/testData/dbData} | ||
| BUILD_DATA_DIR=${BUILD_DATA_DIR:-/home/node/universal/build/dbData/snapset} | ||
|
|
||
| log() { | ||
| echo "$(date +'%Y-%m-%d %H:%M:%S') - $1" | ||
| } | ||
|
|
||
| # Verify variables | ||
| if [ -z "$COUCHDB_URL" ]; then | ||
| echo "COUCHDB_URL environment variable must be defined" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -d "$STATIC_DATA_DIR" -o ! "$(ls -A $STATIC_DATA_DIR/*.json)" ]; then | ||
| echo "STATIC_DATA_DIR ($STATIC_DATA_DIR) must exist and contain data" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -d "$BUILD_DATA_DIR" -o ! "$(ls -A $BUILD_DATA_DIR/*.json)" ]; then | ||
| echo "BUILD_DATA_DIR ($BUILD_DATA_DIR) must exist and contain data" | ||
| exit 1 | ||
| fi | ||
|
|
||
| log "Starting" | ||
| log "CouchDB: $COUCHDB_URL" | ||
| log "Clear index: $CLEAR_INDEX" | ||
| log "Static: $STATIC_DATA_DIR" | ||
| log "Build: $BUILD_DATA_DIR" | ||
| log "Working directory: `pwd`" | ||
|
|
||
| # Set up universal | ||
| git clone --depth 1 https://github.com/GPII/universal.git | ||
| cd universal | ||
|
|
||
| npm install json5 | ||
| npm install fs | ||
| npm install rimraf | ||
| npm install mkdirp | ||
| npm install infusion | ||
| rm -f package-lock.json | ||
| node scripts/convertPrefs.js testData/preferences/ build/dbData/snapset snapset | ||
|
|
||
| # Initialize (possibly clear) data base | ||
| if [ ! -z "$CLEAR_INDEX" ]; then | ||
| log "Deleting database at $COUCHDB_URL" | ||
|
||
| if ! curl -fsS -X DELETE "$COUCHDB_URL"; then | ||
| log "Error deleting database" | ||
| fi | ||
| fi | ||
|
|
||
| log "Creating database at $COUCHDB_URL" | ||
|
||
| if ! curl -fsS -X PUT "$COUCHDB_URL"; then | ||
| log "Database already exists at $COUCHDB_URL" | ||
| fi | ||
|
|
||
| # Submit data | ||
| node scripts/deleteAndLoadSnapsets.js $COUCHDB_URL $STATIC_DATA_DIR $BUILD_DATA_DIR | ||
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not log (unsanitized) COUCHDB_URL as it may contain credentials.
(I see that the code was doing so before, but I'd appreciate if you could fix it while you're in here.)
I see two obvious fixes:
Remove these log lines.
Sanitize
COUCHDB_URLintoCOUCHDB_URL_SANITIZEDand use the latter for logging. I think the followingsedis pretty bulletproof:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that. I sanitized a similar log message in the related node script (in universal) at an earlier suggestion of yours, but didn't likewise here. I'll use your
sedcommand as you suggest.