summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-07-24 23:52:47 +0300
committerLars Wirzenius <liw@liw.fi>2015-07-24 23:52:47 +0300
commit5265e26397597a5333c179842d3e0a41b769de96 (patch)
tree5bd9090824121079ccb7db416e55e0e415eec02c /yarns
parent9c32d15124dd64e333f924eed8a9fc50b20dd6e9 (diff)
downloadansibleness-5265e26397597a5333c179842d3e0a41b769de96.tar.gz
Check hostname
Diffstat (limited to 'yarns')
-rw-r--r--yarns/100-willikins.yarn2
-rw-r--r--yarns/900-implements.yarn21
-rwxr-xr-xyarns/run.sh5
3 files changed, 27 insertions, 1 deletions
diff --git a/yarns/100-willikins.yarn b/yarns/100-willikins.yarn
index 8f20cdc..d12e45e 100644
--- a/yarns/100-willikins.yarn
+++ b/yarns/100-willikins.yarn
@@ -7,3 +7,5 @@ backups. It is only ever accessed over ssh (including sftp).
GIVEN server name is willikins
THEN server responds to ping
+ WHEN running ssh willikins hostname
+ THEN output matches willikins
diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn
index 5b9d0f9..d4b1ee5 100644
--- a/yarns/900-implements.yarn
+++ b/yarns/900-implements.yarn
@@ -15,3 +15,24 @@ Does the server respond to a ping?
IMPLEMENTS THEN server responds to ping
. "$DATADIR/config.sh"
ping -c1 "$SERVER"
+
+## Running command over ssh
+
+Run a command on the server over ssh, capturing stdout and stderr and
+exit code for later inspection.
+
+ IMPLEMENTS WHEN running ssh (.*)
+ if ssh $MATCH_1 > "$DATADIR/stdout" 2> "$DATADIR/stderr"
+ then
+ echo 0 > "$DATADIR/exit"
+ else
+ echo $? > "$DATADIR/exit"
+ fi
+
+## Inspect results of running a command
+
+The stdout, stderr, and exit code have been saved. Inspect them.
+
+ IMPLEMENTS THEN output matches (.+)
+ cat "$DATADIR/stdout"
+ grep "$MATCH_1" "$DATADIR/stdout"
diff --git a/yarns/run.sh b/yarns/run.sh
index 4f7f7af..f34bb6d 100755
--- a/yarns/run.sh
+++ b/yarns/run.sh
@@ -1,4 +1,7 @@
#!/bin/sh
cd "$(dirname "$0")"
-yarn *.yarn
+yarn \
+ --env "SSH_AGENT_PID=$SSH_AGENT_PID" \
+ --env "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" \
+ *.yarn