Skip to content

Commit 390f979

Browse files
authored
Invoke pbench-agent profile for PUT API
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`.
1 parent 7c34f17 commit 390f979

File tree

6 files changed

+22
-1
lines changed

6 files changed

+22
-1
lines changed

server/bin/pbench-dispatch.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ fi
6363
# Optional "PUT API" bearer token for sending tar balls to the "new" Pbench
6464
# Server.
6565
put_token=$(getconf.py put-token pbench-server)
66+
if [[ -n "${put_token}" ]]; then
67+
agent_profile=$(getconf.py agent-profile pbench-server)
68+
if [[ ! -e "${agent_profile}" ]]; then
69+
echo "Failed: PUT API token provided but no pbench-agent profile" >> ${errlog}
70+
exit 2
71+
fi
72+
source ${agent_profile}
73+
fi
6674

6775
qdir=$(getconf.py pbench-quarantine-dir pbench-server)
6876
if [[ -z "${qdir}" ]]; then

server/bin/state/test-12.config/pbench-server.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ install-dir = %(unittest-dir)s/opt/pbench-server
22

33
[pbench-server]
44
put-token = 71ac1fe3f0743aa710e82000e553ec30
5+
agent-profile = %(unittest-dir)s/agent-profile
56

67
[config]
78
path = %(unittest-dir)s/tmp, %(install-dir)s/lib/config

server/bin/state/test-12.reset

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
rm ${_testroot}/agent-profile
4+
exit ${?}

server/bin/state/test-12.setup

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/bash
22

3+
cat > ${_testroot}/agent-profile <<-EOF
4+
export _PBENCH_AGENT_CONFIG="fake"
5+
EOF
36
mkdir pbench-local/archive.backup
47
exit ${?}

server/bin/state/test-21.reset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test-12.reset

server/bin/test-bin/pbench-results-push

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#! /bin/bash
2+
3+
echo "${0##*/} $*" >> $_testlog
4+
test -n "${_PBENCH_AGENT_CONFIG}"
5+
exit ${?}

0 commit comments

Comments
 (0)