)]}'
{"helm-toolkit/templates/scripts/_db-pg-init.sh.tpl":[{"author":{"_account_id":23928,"name":"Pete Birley","email":"petebirley@gmail.com","username":"portdirect"},"change_message_id":"1c117fce88c9a408afd1f6460ec4f90af024da53","unresolved":false,"context_lines":[{"line_number":56,"context_line":"pgsql_superuser_cmd \"SELECT 1 FROM pg_database WHERE datname \u003d \u0027$USER_DB_NAME\u0027\" | grep -q 1 || pgsql_superuser_cmd \"CREATE DATABASE $USER_DB_NAME\""},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"#create db user"},{"line_number":59,"context_line":"pgsql_superuser_cmd \"SELECT * FROM pg_roles WHERE rolname \u003d \u0027$USER_DB_USER\u0027;\" | tail -n +3 | head -n -2 | grep -q 1 || \\"},{"line_number":60,"context_line":"    pgsql_superuser_cmd \"CREATE ROLE ${USER_DB_USER} LOGIN PASSWORD \u0027$USER_DB_PASS\u0027;\" \u0026\u0026 pgsql_superuser_cmd \"ALTER USER ${USER_DB_USER} WITH SUPERUSER\""},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"#Set password everytime. This is required for cases when we would want password rotation to take effect and set the updated password for a user."}],"source_content_type":"text/x-smarty","patch_set":1,"id":"9fdfeff1_1af85447","line":59,"range":{"start_line":59,"start_character":80,"end_line":59,"end_character":115},"updated":"2019-02-07 20:44:13.000000000","message":"can we get this into a nicer awk statement, it still makes me sad every time I see this.","commit_id":"f637d0f7b88a7049ab0d38b6885f1467f78d26f6"},{"author":{"_account_id":22259,"name":"Nishant Kumar","email":"nishant.e.kumar@att.com","username":"nishant.e.kumar"},"change_message_id":"ed72195feafb1691efe7115bb4dc010bb77415fa","unresolved":false,"context_lines":[{"line_number":56,"context_line":"pgsql_superuser_cmd \"SELECT 1 FROM pg_database WHERE datname \u003d \u0027$USER_DB_NAME\u0027\" | grep -q 1 || pgsql_superuser_cmd \"CREATE DATABASE $USER_DB_NAME\""},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"#create db user"},{"line_number":59,"context_line":"pgsql_superuser_cmd \"SELECT * FROM pg_roles WHERE rolname \u003d \u0027$USER_DB_USER\u0027;\" | tail -n +3 | head -n -2 | grep -q 1 || \\"},{"line_number":60,"context_line":"    pgsql_superuser_cmd \"CREATE ROLE ${USER_DB_USER} LOGIN PASSWORD \u0027$USER_DB_PASS\u0027;\" \u0026\u0026 pgsql_superuser_cmd \"ALTER USER ${USER_DB_USER} WITH SUPERUSER\""},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"#Set password everytime. This is required for cases when we would want password rotation to take effect and set the updated password for a user."}],"source_content_type":"text/x-smarty","patch_set":1,"id":"9fdfeff1_72c07b7d","line":59,"range":{"start_line":59,"start_character":80,"end_line":59,"end_character":115},"in_reply_to":"9fdfeff1_1af85447","updated":"2019-02-11 19:40:01.000000000","message":"I am not sure why are we using the tail and head commands. I have removed them from the next PS. The exit status is as expected using \"grep -q 1\". Let me know if further cleanup is required.","commit_id":"f637d0f7b88a7049ab0d38b6885f1467f78d26f6"},{"author":{"_account_id":22259,"name":"Nishant Kumar","email":"nishant.e.kumar@att.com","username":"nishant.e.kumar"},"change_message_id":"9c44fa2ec2c37918ba94d6b3969992d53df73d70","unresolved":false,"context_lines":[{"line_number":56,"context_line":"pgsql_superuser_cmd \"SELECT 1 FROM pg_database WHERE datname \u003d \u0027$USER_DB_NAME\u0027\" | grep -q 1 || pgsql_superuser_cmd \"CREATE DATABASE $USER_DB_NAME\""},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"#create db user"},{"line_number":59,"context_line":"pgsql_superuser_cmd \"SELECT * FROM pg_roles WHERE rolname \u003d \u0027$USER_DB_USER\u0027;\" | tail -n +3 | head -n -2 | grep -q 1 || \\"},{"line_number":60,"context_line":"    pgsql_superuser_cmd \"CREATE ROLE ${USER_DB_USER} LOGIN PASSWORD \u0027$USER_DB_PASS\u0027;\" \u0026\u0026 pgsql_superuser_cmd \"ALTER USER ${USER_DB_USER} WITH SUPERUSER\""},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"#Set password everytime. This is required for cases when we would want password rotation to take effect and set the updated password for a user."}],"source_content_type":"text/x-smarty","patch_set":1,"id":"9fdfeff1_59f680d9","line":59,"range":{"start_line":59,"start_character":80,"end_line":59,"end_character":115},"in_reply_to":"9fdfeff1_72c07b7d","updated":"2019-02-14 02:36:36.000000000","message":"Some analysis of the command here - http://paste.openstack.org/show/745058/","commit_id":"f637d0f7b88a7049ab0d38b6885f1467f78d26f6"},{"author":{"_account_id":26449,"name":"Scott Hussey","email":"sthussey@att.com","username":"sh8121"},"change_message_id":"9e47eb3f2111d9168e5897aa04c81d8fd1ee687d","unresolved":false,"context_lines":[{"line_number":64,"context_line":"#give permissions to user"},{"line_number":65,"context_line":"pgsql_superuser_cmd \"GRANT ALL PRIVILEGES ON DATABASE $USER_DB_NAME to $USER_DB_USER;\""},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"if [[ -v SHIPYARD_AUXILIARY_CONFIG ]]; then"},{"line_number":68,"context_line":"   echo \"Applying additional config for Shipyard\""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"   # Grant permissions to shipyard user to the airflow dataabase tables"},{"line_number":71,"context_line":"   # This will allow shipyard user to query airflow database"},{"line_number":72,"context_line":"   psql -h ${DB_HOST} -p ${DB_PORT} -U ${DB_ADMIN_USER} -d ${AIRFLOW_DB_NAME} \\"},{"line_number":73,"context_line":"   --command\u003d\"GRANT select, insert, update, delete on all tables in schema public to $USER_DB_USER;\""},{"line_number":74,"context_line":"fi"},{"line_number":75,"context_line":"{{- end }}"}],"source_content_type":"text/x-smarty","patch_set":4,"id":"9fdfeff1_37051c7b","line":74,"range":{"start_line":67,"start_character":0,"end_line":74,"end_character":2},"updated":"2019-02-22 14:59:16.000000000","message":"Let\u0027s remove the Airship specific stuff from here and just make two jobs in the Shipyard chart - one to create the DB and user and then a second that will run this special magic. entrypoint dependencies can be used to serialize the jobs.","commit_id":"725443ae69b40384a4b98a77444cd768dea1d3ff"},{"author":{"_account_id":22259,"name":"Nishant Kumar","email":"nishant.e.kumar@att.com","username":"nishant.e.kumar"},"change_message_id":"918d3dcacfdc217de6e71076b1ae9dab0ade8a6e","unresolved":false,"context_lines":[{"line_number":64,"context_line":"#give permissions to user"},{"line_number":65,"context_line":"pgsql_superuser_cmd \"GRANT ALL PRIVILEGES ON DATABASE $USER_DB_NAME to $USER_DB_USER;\""},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"if [[ -v SHIPYARD_AUXILIARY_CONFIG ]]; then"},{"line_number":68,"context_line":"   echo \"Applying additional config for Shipyard\""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"   # Grant permissions to shipyard user to the airflow dataabase tables"},{"line_number":71,"context_line":"   # This will allow shipyard user to query airflow database"},{"line_number":72,"context_line":"   psql -h ${DB_HOST} -p ${DB_PORT} -U ${DB_ADMIN_USER} -d ${AIRFLOW_DB_NAME} \\"},{"line_number":73,"context_line":"   --command\u003d\"GRANT select, insert, update, delete on all tables in schema public to $USER_DB_USER;\""},{"line_number":74,"context_line":"fi"},{"line_number":75,"context_line":"{{- end }}"}],"source_content_type":"text/x-smarty","patch_set":4,"id":"9fdfeff1_d86ddd99","line":74,"range":{"start_line":67,"start_character":0,"end_line":74,"end_character":2},"in_reply_to":"9fdfeff1_37051c7b","updated":"2019-02-22 16:59:58.000000000","message":"Done","commit_id":"725443ae69b40384a4b98a77444cd768dea1d3ff"},{"author":{"_account_id":22636,"name":"Cliff Parsons","email":"cliffhparsons@aol.com","username":"cliffparsons"},"change_message_id":"05678d949d6630bf5f6f2eec2bd4f3d81c160e5b","unresolved":false,"context_lines":[{"line_number":15,"context_line":"{{- define \"helm-toolkit.scripts.pg_db_init\" }}"},{"line_number":16,"context_line":"#!/bin/bash"},{"line_number":17,"context_line":"set -ex"},{"line_number":18,"context_line":"export HOME\u003d/tmp"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"pgsql_superuser_cmd () {"},{"line_number":21,"context_line":"  DB_COMMAND\u003d\"$1\""}],"source_content_type":"text/x-smarty","patch_set":6,"id":"9fdfeff1_62443f48","line":18,"range":{"start_line":18,"start_character":0,"end_line":18,"end_character":16},"updated":"2019-02-22 19:17:12.000000000","message":"I don\u0027t see HOME being used anywhere, can we remove it?","commit_id":"e9062029fd77c843c99cb5c8d9336768910309e7"},{"author":{"_account_id":22259,"name":"Nishant Kumar","email":"nishant.e.kumar@att.com","username":"nishant.e.kumar"},"change_message_id":"cb37e7d341d6c0b5e830b9b9605c5a3c714601d4","unresolved":false,"context_lines":[{"line_number":15,"context_line":"{{- define \"helm-toolkit.scripts.pg_db_init\" }}"},{"line_number":16,"context_line":"#!/bin/bash"},{"line_number":17,"context_line":"set -ex"},{"line_number":18,"context_line":"export HOME\u003d/tmp"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"pgsql_superuser_cmd () {"},{"line_number":21,"context_line":"  DB_COMMAND\u003d\"$1\""}],"source_content_type":"text/x-smarty","patch_set":6,"id":"9fdfeff1_f4fe8e03","line":18,"range":{"start_line":18,"start_character":0,"end_line":18,"end_character":16},"in_reply_to":"9fdfeff1_62443f48","updated":"2019-02-25 15:12:34.000000000","message":"Done","commit_id":"e9062029fd77c843c99cb5c8d9336768910309e7"},{"author":{"_account_id":22636,"name":"Cliff Parsons","email":"cliffhparsons@aol.com","username":"cliffparsons"},"change_message_id":"05678d949d6630bf5f6f2eec2bd4f3d81c160e5b","unresolved":false,"context_lines":[{"line_number":22,"context_line":"  if [[ ! -z $2 ]]; then"},{"line_number":23,"context_line":"      EXPORT PGDATABASE\u003d$2"},{"line_number":24,"context_line":"  fi"},{"line_number":25,"context_line":"  psql \\"},{"line_number":26,"context_line":"  -h ${DB_HOST} \\"},{"line_number":27,"context_line":"  -p ${DB_PORT} \\"},{"line_number":28,"context_line":"  -U ${DB_ADMIN_USER} \\"}],"source_content_type":"text/x-smarty","patch_set":6,"id":"9fdfeff1_42349bde","line":25,"range":{"start_line":25,"start_character":2,"end_line":25,"end_character":6},"updated":"2019-02-22 19:17:12.000000000","message":"might be better to specify the full path","commit_id":"e9062029fd77c843c99cb5c8d9336768910309e7"},{"author":{"_account_id":22259,"name":"Nishant Kumar","email":"nishant.e.kumar@att.com","username":"nishant.e.kumar"},"change_message_id":"cb37e7d341d6c0b5e830b9b9605c5a3c714601d4","unresolved":false,"context_lines":[{"line_number":22,"context_line":"  if [[ ! -z $2 ]]; then"},{"line_number":23,"context_line":"      EXPORT PGDATABASE\u003d$2"},{"line_number":24,"context_line":"  fi"},{"line_number":25,"context_line":"  psql \\"},{"line_number":26,"context_line":"  -h ${DB_HOST} \\"},{"line_number":27,"context_line":"  -p ${DB_PORT} \\"},{"line_number":28,"context_line":"  -U ${DB_ADMIN_USER} \\"}],"source_content_type":"text/x-smarty","patch_set":6,"id":"9fdfeff1_14047214","line":25,"range":{"start_line":25,"start_character":2,"end_line":25,"end_character":6},"in_reply_to":"9fdfeff1_42349bde","updated":"2019-02-25 15:12:34.000000000","message":"Done","commit_id":"e9062029fd77c843c99cb5c8d9336768910309e7"},{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"ed0d768fd3510a84fceb2e967dce6e3483116523","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright 2017 The Openstack-Helm Authors."},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"# Licensed under the Apache License, Version 2.0 (the \"License\");"},{"line_number":4,"context_line":"# you may not use this file except in compliance with the License."}],"source_content_type":"text/x-smarty","patch_set":7,"id":"9fdfeff1_0856372b","line":1,"range":{"start_line":1,"start_character":12,"end_line":1,"end_character":16},"updated":"2019-02-28 21:20:34.000000000","message":"nit: 2019","commit_id":"7f21b85128ea4e6e64998b916f065c3100f5c4f7"},{"author":{"_account_id":29668,"name":"cheng li","email":"cheng1.li@intel.com","username":"chengli3"},"change_message_id":"68a4dee6e4ee3805c13c95841c4245cb472dde60","unresolved":false,"context_lines":[{"line_number":54,"context_line":"}"},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"#create db"},{"line_number":57,"context_line":"pgsql_superuser_cmd \"SELECT 1 FROM pg_database WHERE datname \u003d \u0027$USER_DB_NAME\u0027\" | grep -q \"(1 row)\" || pgsql_superuser_cmd \"CREATE DATABASE $USER_DB_NAME\""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"#create db user"},{"line_number":60,"context_line":"pgsql_superuser_cmd \"SELECT * FROM pg_roles WHERE rolname \u003d \u0027$USER_DB_USER\u0027;\" | grep -q \"(1 row)\" || \\"}],"source_content_type":"text/x-smarty","patch_set":7,"id":"9fdfeff1_b457a65a","line":57,"range":{"start_line":57,"start_character":0,"end_line":57,"end_character":98},"updated":"2019-02-25 16:06:00.000000000","message":"Why not use `select count` here?","commit_id":"7f21b85128ea4e6e64998b916f065c3100f5c4f7"},{"author":{"_account_id":29668,"name":"cheng li","email":"cheng1.li@intel.com","username":"chengli3"},"change_message_id":"ead1b89def7164123220978f6e954b149c5cc3fa","unresolved":false,"context_lines":[{"line_number":54,"context_line":"}"},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"#create db"},{"line_number":57,"context_line":"pgsql_superuser_cmd \"SELECT 1 FROM pg_database WHERE datname \u003d \u0027$USER_DB_NAME\u0027\" | grep -q \"(1 row)\" || pgsql_superuser_cmd \"CREATE DATABASE $USER_DB_NAME\""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"#create db user"},{"line_number":60,"context_line":"pgsql_superuser_cmd \"SELECT * FROM pg_roles WHERE rolname \u003d \u0027$USER_DB_USER\u0027;\" | grep -q \"(1 row)\" || \\"}],"source_content_type":"text/x-smarty","patch_set":7,"id":"9fdfeff1_e657b659","line":57,"range":{"start_line":57,"start_character":0,"end_line":57,"end_character":98},"in_reply_to":"9fdfeff1_5ad8d751","updated":"2019-02-26 05:14:26.000000000","message":"Seems you are getting the count of databases named \u0027$USER_DB_NAME\u0027, right?\nYou test it by `grep -q \"(1 row)\"`, but \"(1 row)\" seems not the sql query result, it\u0027s more like additional info. This may vary cross postgresql versions, I didn\u0027t check, but if there is an old version which print \"(1 rows)\".","commit_id":"7f21b85128ea4e6e64998b916f065c3100f5c4f7"},{"author":{"_account_id":22259,"name":"Nishant Kumar","email":"nishant.e.kumar@att.com","username":"nishant.e.kumar"},"change_message_id":"0ecf691ece4b5885da0f4bad4e0b3eac45950ed3","unresolved":false,"context_lines":[{"line_number":54,"context_line":"}"},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"#create db"},{"line_number":57,"context_line":"pgsql_superuser_cmd \"SELECT 1 FROM pg_database WHERE datname \u003d \u0027$USER_DB_NAME\u0027\" | grep -q \"(1 row)\" || pgsql_superuser_cmd \"CREATE DATABASE $USER_DB_NAME\""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"#create db user"},{"line_number":60,"context_line":"pgsql_superuser_cmd \"SELECT * FROM pg_roles WHERE rolname \u003d \u0027$USER_DB_USER\u0027;\" | grep -q \"(1 row)\" || \\"}],"source_content_type":"text/x-smarty","patch_set":7,"id":"9fdfeff1_5ad8d751","line":57,"range":{"start_line":57,"start_character":0,"end_line":57,"end_character":98},"in_reply_to":"9fdfeff1_b457a65a","updated":"2019-02-25 23:52:39.000000000","message":"how is that beneficial? I was reading about it and the `count` function could be a bit slow as it runs on the complete table. Do you have an example for any efficient logic? I can give a try on my dev envrionment","commit_id":"7f21b85128ea4e6e64998b916f065c3100f5c4f7"},{"author":{"_account_id":22259,"name":"Nishant Kumar","email":"nishant.e.kumar@att.com","username":"nishant.e.kumar"},"change_message_id":"b1fe399c3809610836b42491eaf7474832265ccd","unresolved":false,"context_lines":[{"line_number":54,"context_line":"}"},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"#create db"},{"line_number":57,"context_line":"pgsql_superuser_cmd \"SELECT 1 FROM pg_database WHERE datname \u003d \u0027$USER_DB_NAME\u0027\" | grep -q \"(1 row)\" || pgsql_superuser_cmd \"CREATE DATABASE $USER_DB_NAME\""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"#create db user"},{"line_number":60,"context_line":"pgsql_superuser_cmd \"SELECT * FROM pg_roles WHERE rolname \u003d \u0027$USER_DB_USER\u0027;\" | grep -q \"(1 row)\" || \\"}],"source_content_type":"text/x-smarty","patch_set":7,"id":"9fdfeff1_15d0d0f6","line":57,"range":{"start_line":57,"start_character":0,"end_line":57,"end_character":98},"in_reply_to":"9fdfeff1_e657b659","updated":"2019-02-26 17:53:24.000000000","message":"I am checking for existence of the database and using `grep` alongwith it to determine the exit status of the command and decide whether to execute the `||` command or not. I am not postgres expert but I have found similiar approaches as above while exploring. \n\nI will try to see if i can find something else.","commit_id":"7f21b85128ea4e6e64998b916f065c3100f5c4f7"}]}
