Skip to content

Commit

Permalink
Bugfixes before versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
langston-barrett committed Jun 19, 2015
1 parent 8bd74d0 commit 7d01130
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This readme documents the current (development) version of distributive.
Distributive is a tool for running distributed health checks in datacenters.
It was designed with Consul in mind, but is platform agnostic. It is simple
to configure (with JSON checklists) and easy to deploy and run. It has no
dependencies, and can be shipped as a speedy 4MB (yes, megabytes!) binary.
dependencies, and can be shipped as a speedy 7MB (yes, megabytes!) binary.

Usually, some external server will ask the host to execute this program, reading
a checklist from a JSON file, and will record this program's exit code and
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func validateParameters(chk Check) {
// parameters, and exits otherwise. Can't do much with a broken check!
checkParameterLength := func(chk Check, expected int) {
given := len(chk.Parameters)
if given == 0 {
if given == 0 || expected == 0 {
msg := "Invalid check:"
msg += "\n\tCheck type: " + chk.Check
log.Fatal(msg)
Expand Down
4 changes: 2 additions & 2 deletions network.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,10 @@ func urlToBytes(urlstr string) []byte {
return body
}

// responseMatch asks: does the response from this URL match this regexp?
// responseMatches asks: does the response from this URL match this regexp?
// TODO fix verbosity. We need a more generic error method! One that anyone
// can use!
func responseMatch(parameters []string) (exitCode int, exitMessage string) {
func responseMatches(parameters []string) (exitCode int, exitMessage string) {
urlstr := parameters[0]
re := parseUserRegex(parameters[1])
body := urlToBytes(urlstr)
Expand Down
2 changes: 1 addition & 1 deletion register.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func registerChecks() {
registerCheck("routingtabledestination", routingTableDestination, 1)
registerCheck("routingtableinterface", routingTableInterface, 1)
registerCheck("routingtablegateway", routingTableGateway, 1)
registerCheck("responsematch", responseMatch, 2)
registerCheck("responsematches", responseMatches, 2)
registerCheck("module", module, 1)
registerCheck("kernelparameter", kernelParameter, 1)
registerCheck("dockerimage", dockerImage, 1)
Expand Down
2 changes: 1 addition & 1 deletion samples/network-fail.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"Parameters" : ["google.com:80", "1ns"]
},
{
"Check": "responseMatch",
"Check": "responseMatches",
"Parameters": ["http://google.com:80", "yahoo"]
}
]
Expand Down
2 changes: 1 addition & 1 deletion samples/network.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"Parameters" : ["google.com:80", "20s"]
},
{
"Check": "responseMatch",
"Check": "responseMatches",
"Parameters": ["http://google.com:80", "g(o{2})gle"]
}
]
Expand Down

0 comments on commit 7d01130

Please sign in to comment.