aboutsummaryrefslogtreecommitdiff
path: root/scripts/send_and_run.tcl
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-16 00:22:38 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-16 18:08:12 +0100
commitc15f2234474ff8a8266e26856702b3c561050667 (patch)
tree5df6dfb44ee2d37fbd9cf7b701bdc7881c575857 /scripts/send_and_run.tcl
parent985b53a258ee18eaca8d437ae532c232a6d19921 (diff)
downloadPuppet-c15f2234474ff8a8266e26856702b3c561050667.tar.gz
Puppet-c15f2234474ff8a8266e26856702b3c561050667.tar.zst
Puppet-c15f2234474ff8a8266e26856702b3c561050667.zip
Move scripts to separate chunks
Diffstat (limited to 'scripts/send_and_run.tcl')
-rwxr-xr-xscripts/send_and_run.tcl31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/send_and_run.tcl b/scripts/send_and_run.tcl
new file mode 100755
index 0000000..a087a2d
--- /dev/null
+++ b/scripts/send_and_run.tcl
@@ -0,0 +1,31 @@
1#!/usr/bin/expect -f
2set dest [lindex $argv 0]
3set password [lindex $argv 1]
4set git_branch [lindex $argv 2]
5set environment [lindex $argv 3]
6set script [lindex $argv 4]
7set files [lrange $argv 4 end]
8
9if {$password == ""} {
10 set ask_password 0
11} else {
12 set ask_password 1
13}
14
15set scriptname [file tail $script]
16
17set sshopts [split "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no"]
18
19set timeout -1
20spawn scp {*}$sshopts {*}$files $dest:/tmp
21if {$ask_password} {
22 expect "assword:"
23 send "$password\n"
24}
25expect eof
26spawn ssh {*}$sshopts $dest /tmp/$scriptname $git_branch $environment
27if {$ask_password} {
28 expect "assword:"
29 send "$password\n"
30}
31expect eof