You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by sr...@apache.org on 2022/11/16 19:04:15 UTC
[trafficcontrol] branch master updated: Revert setting `PGPASSWORD` for entire db/admin binary (#7198)
This is an automated email from the ASF dual-hosted git repository.
srijeet0406 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new 83693b5136 Revert setting `PGPASSWORD` for entire db/admin binary (#7198)
83693b5136 is described below
commit 83693b513647d457dc6f0e6117bb52f430e5e65a
Author: Zach Hoffman <zr...@apache.org>
AuthorDate: Wed Nov 16 19:04:09 2022 +0000
Revert setting `PGPASSWORD` for entire db/admin binary (#7198)
* Revert setting PGPASSWORD for entire db/admin binary
* Trigger t3c integration tests when traffic_ops/app/db is changed
---
.github/workflows/cache-config-tests.yml | 30 ++++++++++++++++++------------
traffic_ops/app/db/admin.go | 7 +++----
2 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/.github/workflows/cache-config-tests.yml b/.github/workflows/cache-config-tests.yml
index 20a0e387e6..7b184c89df 100644
--- a/.github/workflows/cache-config-tests.yml
+++ b/.github/workflows/cache-config-tests.yml
@@ -26,41 +26,47 @@ on:
workflow_dispatch:
push:
paths:
+ - cache-config/**.go
+ - cache-config/testing/**
+ - .github/actions/build-ats-test-rpm/**
+ - .github/actions/cache-config-integration-tests/**
+ - .github/actions/repo-info/**
- .github/workflows/cache-config-tests.yml
- go.mod
- go.sum
- GO_VERSION
+ - lib/atscfg-go/**.go
- lib/go-atscfg/**.go
+ - 'traffic_ops/app/db/**'
+ - '!traffic_ops/app/db/**.md'
- traffic_ops/*client/**.go
+ - 'traffic_ops/install/**'
- traffic_ops/toclientlib/**.go
- - lib/atscfg-go/**.go
- traffic_ops/traffic_ops_golang/**.go
- - cache-config/**.go
- - cache-config/testing/**
- vendor/**.go
- vendor/modules.txt
- - .github/actions/build-ats-test-rpm/**
- - .github/actions/repo-info/**
- - .github/actions/cache-config-integration-tests/**
create:
pull_request:
paths:
+ - cache-config/**.go
+ - cache-config/testing/**
+ - .github/actions/build-ats-test-rpm/**
+ - .github/actions/cache-config-integration-tests/**
+ - .github/actions/repo-info/**
- .github/workflows/cache-config-tests.yml
- go.mod
- go.sum
- GO_VERSION
+ - lib/atscfg-go/**.go
- lib/go-atscfg/**.go
+ - 'traffic_ops/app/db/**'
+ - '!traffic_ops/app/db/**.md'
- traffic_ops/*client/**.go
+ - 'traffic_ops/install/**'
- traffic_ops/toclientlib/**.go
- - lib/atscfg-go/**.go
- traffic_ops/traffic_ops_golang/**.go
- - cache-config/**.go
- - cache-config/testing/**
- vendor/**.go
- vendor/modules.txt
- - .github/actions/build-ats-test-rpm/**
- - .github/actions/repo-info/**
- - .github/actions/cache-config-integration-tests/**
types: [opened, reopened, ready_for_review, synchronize]
jobs:
diff --git a/traffic_ops/app/db/admin.go b/traffic_ops/app/db/admin.go
index 50607739be..01529c8eae 100644
--- a/traffic_ops/app/db/admin.go
+++ b/traffic_ops/app/db/admin.go
@@ -466,6 +466,7 @@ func seed() {
}
cmd := exec.Command("psql", "-h", hostIP, "-p", hostPort, "-d", dbName, "-U", dbUser, "-e", "-v", "ON_ERROR_STOP=1")
cmd.Stdin = bytes.NewBuffer(seedsBytes)
+ cmd.Env = append(os.Environ(), "PGPASSWORD="+dbPassword)
out, err := cmd.CombinedOutput()
fmt.Println(string(out))
if err != nil {
@@ -485,6 +486,7 @@ func loadSchema() {
}
cmd := exec.Command("psql", "-h", hostIP, "-p", hostPort, "-d", dbName, "-U", dbUser, "-e", "-v", "ON_ERROR_STOP=1")
cmd.Stdin = bytes.NewBuffer(schemaBytes)
+ cmd.Env = append(os.Environ(), "PGPASSWORD="+dbPassword)
out, err := cmd.CombinedOutput()
fmt.Println(string(out))
if err != nil {
@@ -503,6 +505,7 @@ func patch() {
}
cmd := exec.Command("psql", "-h", hostIP, "-p", hostPort, "-d", dbName, "-U", dbUser, "-e", "-v", "ON_ERROR_STOP=1")
cmd.Stdin = bytes.NewBuffer(patchesBytes)
+ cmd.Env = append(os.Environ(), "PGPASSWORD="+dbPassword)
out, err := cmd.CombinedOutput()
fmt.Printf(string(out))
if err != nil {
@@ -658,10 +661,6 @@ func main() {
if err := parseDBConfig(); err != nil {
die(err.Error())
}
- if err := os.Setenv("PGPASSWORD", dbPassword); err != nil {
- die("Setting PGPASSWORD: " + err.Error())
- }
-
commands := make(map[string]func())
commands[cmdCreateDB] = createDB