summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commits.go5
-rw-r--r--examples/worker1/worker1.cfg15
-rw-r--r--examples/worker2/worker2.cfg12
-rwxr-xr-xscorsh.sh6
-rw-r--r--types.go6
5 files changed, 25 insertions, 19 deletions
diff --git a/commits.go b/commits.go
index 4cc67a3..e85c976 100644
--- a/commits.go
+++ b/commits.go
@@ -176,7 +176,12 @@ func walkCommits(msg spoolMsg, w *worker) error {
// 2) then for each command in the message
for _, c := range cmdMsg.Commands {
+ if c.Cmd == "" {
+ log.Printf("[worker: %s] empty command\n", w.Name)
+ continue
+ }
// a) check that the command is among those accepted by the worker
+ debug.log("[worker: %s] validating command: %s\n", w.Name, c.Cmd)
cmdCfg, goodCmd := findCmdConfig(c.Cmd, w)
debug.log("[worker: %s] goodCmd: %s\n", w.Name, goodCmd)
diff --git a/examples/worker1/worker1.cfg b/examples/worker1/worker1.cfg
index 4883181..f9a97f4 100644
--- a/examples/worker1/worker1.cfg
+++ b/examples/worker1/worker1.cfg
@@ -11,9 +11,9 @@
w_commands:
[
{
- t_name: "LOG",
- t_keyrings: ["allowed_users.asc"],
- t_actions: [
+ c_name: "LOG",
+ c_keyrings: ["allowed_users.asc"],
+ c_actions: [
{
a_url: "file:///home/katolaz/bin/scorsh_script.sh"
## a_hash: "12da324fb76s924acbce"
@@ -21,11 +21,12 @@ w_commands:
]
},
{
- t_name: "build",
- t_keyrings: ["allowed_users.asc"],
- t_actions: [
+ c_name: "build",
+ c_keyrings: ["allowed_users.asc"],
+ c_actions: [
{
- a_url: "file:///home/katolaz/bin/scorsh_script.sh"
+ a_url: "file:///home/katolaz/bin/scorsh_script.sh",
+ a_hash: "aa606bc152824c1b650d7e71e2e92bb69a9b7c861c69cd439d17902488e5f76e"
}
]
}
diff --git a/examples/worker2/worker2.cfg b/examples/worker2/worker2.cfg
index 32a088a..fa6e2ad 100644
--- a/examples/worker2/worker2.cfg
+++ b/examples/worker2/worker2.cfg
@@ -2,18 +2,18 @@
w_commands:
[
{
- t_name: "DEPLOY",
- t_keyrings: ["allowed_users.asc"],
- t_actions: [
+ c_name: "DEPLOY",
+ c_keyrings: ["allowed_users.asc"],
+ c_actions: [
{
a_url: "file:///home/katolaz/bin/deploy.sh"
}
]
},
{
- t_name: "build",
- t_keyrings: ["allowed_users.asc"],
- t_actions: [
+ c_name: "build",
+ c_keyrings: ["allowed_users.asc"],
+ c_actions: [
{
a_url: "file:///home/katolaz/bin/scorsh_build.sh"
}
diff --git a/scorsh.sh b/scorsh.sh
index 4a3a0bd..fefac2d 100755
--- a/scorsh.sh
+++ b/scorsh.sh
@@ -7,7 +7,7 @@
## func
build_command(){
- TAG=$1
+ CMD=$1
shift
ARGS=$@
@@ -22,7 +22,7 @@ build_command(){
scorsh:
[
{
- s_tag: "$TAG",
+ s_cmd: "$CMD",
s_args: [${ARGLIST}]
}
]
@@ -34,7 +34,7 @@ EOF
if [ $# -le 0 ]; then
- echo "Usage: $0 <tag> [<arg>...]"
+ echo "Usage: $0 <cmd> [<arg>...]"
exit 1
fi
diff --git a/types.go b/types.go
index 517528b..795e82f 100644
--- a/types.go
+++ b/types.go
@@ -34,9 +34,9 @@ type action struct {
// commandCfg represents a command configured on the server side
type commandCfg struct {
- Name string `yaml:"t_name"`
- Keyrings []string `yaml:"t_keyrings"`
- Actions []action `yaml:"t_actions"`
+ Name string `yaml:"c_name"`
+ Keyrings []string `yaml:"c_keyrings"`
+ Actions []action `yaml:"c_actions"`
}
// workerCfg represents the static configuration of a worker