Skip to content

Commit

Permalink
Invoke pbench-agent profile for PUT API
Browse files Browse the repository at this point in the history
We use a level of indirection in the `pbench-server.cfg` file to
configure the location of the pbench-agent `profile` to use.  The
`pbench-server` section will have option of `agent-profile` that
specifies (typically) `/etc/profile.d/pbench-agent.sh`.
  • Loading branch information
portante authored Mar 7, 2023
1 parent 7c34f17 commit 390f979
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1 deletion.
8 changes: 8 additions & 0 deletions server/bin/pbench-dispatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ fi
# Optional "PUT API" bearer token for sending tar balls to the "new" Pbench
# Server.
put_token=$(getconf.py put-token pbench-server)
if [[ -n "${put_token}" ]]; then
agent_profile=$(getconf.py agent-profile pbench-server)
if [[ ! -e "${agent_profile}" ]]; then
echo "Failed: PUT API token provided but no pbench-agent profile" >> ${errlog}
exit 2
fi
source ${agent_profile}
fi

qdir=$(getconf.py pbench-quarantine-dir pbench-server)
if [[ -z "${qdir}" ]]; then
Expand Down
1 change: 1 addition & 0 deletions server/bin/state/test-12.config/pbench-server.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ install-dir = %(unittest-dir)s/opt/pbench-server

[pbench-server]
put-token = 71ac1fe3f0743aa710e82000e553ec30
agent-profile = %(unittest-dir)s/agent-profile

[config]
path = %(unittest-dir)s/tmp, %(install-dir)s/lib/config
Expand Down
4 changes: 4 additions & 0 deletions server/bin/state/test-12.reset
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

rm ${_testroot}/agent-profile
exit ${?}
3 changes: 3 additions & 0 deletions server/bin/state/test-12.setup
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash

cat > ${_testroot}/agent-profile <<-EOF
export _PBENCH_AGENT_CONFIG="fake"
EOF
mkdir pbench-local/archive.backup
exit ${?}
1 change: 1 addition & 0 deletions server/bin/state/test-21.reset
1 change: 0 additions & 1 deletion server/bin/test-bin/pbench-results-push

This file was deleted.

5 changes: 5 additions & 0 deletions server/bin/test-bin/pbench-results-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /bin/bash

echo "${0##*/} $*" >> $_testlog
test -n "${_PBENCH_AGENT_CONFIG}"
exit ${?}

0 comments on commit 390f979

Please sign in to comment.