aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2014-07-10 08:57:45 +0100
committerAlex Bennée <alex.bennee@linaro.org>2014-07-10 09:17:25 +0100
commit277ee9f7a99ed9585a2d778707889d7ba38a1a0a (patch)
treee1c3be614d0f73d3d63d72cb56a9c3a6d26f183f
parent49cf199525730c9a293ca4b6676dd058a23209a7 (diff)
hacking_session_debian: optional ping of user on IRC
If the IRC_USER environment variable is set we ping the user once the hacking session is up and running to let them know it's ready for them. The IRC_SERVER defaults to irc.freenode.net. Change-Id: I77a7e642f7f3defcbdb5079b13ac523f3a0f0149 Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
-rw-r--r--README.rst2
-rw-r--r--debian-hacking-example.json4
-rw-r--r--hacking-session-debian.yaml4
-rwxr-xr-xinvoke_session_debian21
4 files changed, 18 insertions, 13 deletions
diff --git a/README.rst b/README.rst
index 749b430..0c99f8e 100644
--- a/README.rst
+++ b/README.rst
@@ -10,6 +10,8 @@ Parameters
==========
* GATEWAY - The gateway for the network the target device is on (check with your LAVA admins)
* PUB_KEY - A plain-text string containing the ssh public key(s) you wish to use to connect to the device over ssh
+ * IRC_NICK - An IRC nickname to notify when ready (Debian only)
+ * IRC_SERVER - The IRC server to use (Debian only)
* testdef - The test definition (distrbution specific)
* **hacking-session-debian.yaml** - run the hacking session on a Debian or Ubuntu filesystem, *openssh-server will be installed using the package manager*
diff --git a/debian-hacking-example.json b/debian-hacking-example.json
index 422e53d..4c20958 100644
--- a/debian-hacking-example.json
+++ b/debian-hacking-example.json
@@ -14,7 +14,9 @@
"git-repo": "http://staging.git.linaro.org/git/lava-team/hacking-session.git",
"parameters": {
"PUB_KEY": "<PUB_KEY (REQUIRED) (DEFAULT=None)>",
- "GATEWAY": "<GATEWAY (OPTIONAL) (DEFAULT=10.0.0.1)>"
+ "GATEWAY": "<GATEWAY (OPTIONAL) (DEFAULT=None)>",
+ "IRC_USER": "<IRC NICK (OPTIONAL) (DEFAULT=None)>",
+ "IRC_SERVER": "<IRC SERVER (OPTIONAL) (DEFAULT=irc.freenode.net)>"
},
"testdef": "hacking-session-debian.yaml"
}
diff --git a/hacking-session-debian.yaml b/hacking-session-debian.yaml
index c8be181..f3b2294 100644
--- a/hacking-session-debian.yaml
+++ b/hacking-session-debian.yaml
@@ -6,12 +6,16 @@ metadata:
params:
PUB_KEY: None
+ IRC_SERVER: irc.freenode.net
install:
deps:
- openssh-server
- wget
+ - python-irc
run:
steps:
- ./setup_session_debian "$PUB_KEY"
+ - export IRC_SERVER
+ - export IRC_USER
- ./invoke_session_debian "$GATEWAY"
diff --git a/invoke_session_debian b/invoke_session_debian
index 10e72e5..6137c4b 100755
--- a/invoke_session_debian
+++ b/invoke_session_debian
@@ -22,21 +22,18 @@ hostname=$(cat /etc/hostname)
# Set the PATH to use the LAVA api
echo "export PATH=/lava/bin/:$PATH" > ~/.bashrc
-echo ""
-echo ""
+SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${USER}@${ip_addr} (${hostname})"
echo "*******************************************************************************************************"
-echo -n "Please connect to: "
-echo -n "ssh "
-echo -n "-o UserKnownHostsFile=/dev/null "
-echo -n "-o StrictHostKeyChecking=no "
-echo -n "root@"
-echo -n $ip_addr
-echo -n " "
-echo -n "("
-echo -n $hostname
-echo ")"
+echo "Please connect to: ${SSH_COMMAND}"
echo "*******************************************************************************************************"
echo ""
+if [ ! -z "${IRC_USER}" -a -e /usr/share/doc/python-irc/examples/irccat2.py ]; then
+ # make a unique user
+ cat <<EOF | python /usr/share/doc/python-irc/examples/irccat2.py ${IRC_SERVER} hs-${RANDOM} ${IRC_USER}
+Your hacking session is now ready
+Please connect to: ${SSH_COMMAND}"
+EOF
+fi
echo ""
mkdir -p /run
mkdir -p /run/hacking