Skip to content

Commit

Permalink
script updates
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewQuijano committed Aug 19, 2024
1 parent 7ea8d7f commit 7a48bf6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
3 changes: 2 additions & 1 deletion scripts/fninstr.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def merge(v, vors):
if args.read:
for filename in rest:
print("FILE [%s] " % filename)
y = yaml.load(open(filename))
with open(filename, 'r') as file:
y = yaml.safe_load(file)
assert (y is not None), "Missing output file from fninstr"
for x in y:
# print x
Expand Down
26 changes: 16 additions & 10 deletions scripts/setup_postgres.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/bash
set -ex

# shellcheck disable=SC2034
sudo=""
if [ $EUID -ne 0 ]; then
SUDO=sudo
fi

PGPASS="${HOME}/.pgpass"

if [ ! -f "${PGPASS}" ]; then
Expand All @@ -10,17 +16,17 @@ if [ ! -f "${PGPASS}" ]; then
pg_hba="/etc/postgresql/${postgres_version}/main/pg_hba.conf"
postgres_password='postgrespostgres'

sudo sed -i.bak -E 's/^(local\s+all\s+postgres\s+)md5$/\1peer/' "${pg_hba}"
sudo service postgresql reload
$SUDO sed -i.bak -E 's/^(local\s+all\s+postgres\s+)md5$/\1peer/' "${pg_hba}"
$SUDO service postgresql reload

password_sql="ALTER USER postgres WITH PASSWORD '${postgres_password}';"
sudo -u postgres psql -c "${password_sql}"
$SUDO -u postgres psql -c "${password_sql}"

echo "*:*:*:postgres:${postgres_password}" > "${PGPASS}"
chmod 600 "${PGPASS}"

sudo sed -i.bak -E 's/^(local\s+all\s+postgres\s+)peer$/\1md5/' "${pg_hba}"
sudo service postgresql reload
$SUDO sed -i.bak -E 's/^(local\s+all\s+postgres\s+)peer$/\1md5/' "${pg_hba}"
$SUDO service postgresql reload
fi

# Define the PostgreSQL version
Expand All @@ -31,12 +37,12 @@ PG_CONF="/etc/postgresql/${PG_VERSION}/main/postgresql.conf"
PG_HBA="/etc/postgresql/${PG_VERSION}/main/pg_hba.conf"

# Update listen_addresses and password_encryption in postgresql.conf
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '0.0.0.0, localhost'/g" $PG_CONF
sed -i "s/#password_encryption = scram-sha-256/password_encryption = md5/g" $PG_CONF
$SUDO sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '0.0.0.0, localhost'/g" $PG_CONF
$SUDO sed -i "s/#password_encryption = scram-sha-256/password_encryption = md5/g" $PG_CONF

# Update pg_hba.conf
echo "host all all 0.0.0.0/0 md5" >> $PG_HBA
sed -i 's/scram-sha-256/md5/g' $PG_HBA
$SUDO echo "host all all 0.0.0.0/0 md5" >> $PG_HBA
$SUDO sed -i 's/scram-sha-256/md5/g' $PG_HBA

# Restart PostgreSQL service
service postgresql restart
$SUDO service postgresql restart
4 changes: 2 additions & 2 deletions scripts/vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ if [ "$(jq -r .injfixupsscript $json)" != "null" ]; then
injfixupsscript="${injfixupsscript/\{bug_build\}/$bug_build}"
fi

# buildhost="$(jq -r '.buildhost // "docker"' $json)"
buildhost="localhost"
buildhost="$(jq -r '.buildhost // "docker"' $json)"
# buildhost="localhost"
pandahost="$(jq -r '.pandahost // "docker"' $json)"
testinghost="$(jq -r '.testinghost // "docker"' $json)"
logs="$output_dir/$name/logs"
Expand Down

0 comments on commit 7a48bf6

Please sign in to comment.