From 6733dc96ceadeb9cd6d415411cedf1837171abfa Mon Sep 17 00:00:00 2001 From: siddharthist Date: Fri, 10 Jul 2015 08:55:35 -0500 Subject: [PATCH] Minor fixes --- .gitignore | 10 +--------- README.md | 12 ++++++------ run.sh | 2 +- src/github.com/CiscoCloud/distributive/main.go | 8 ++++---- .../CiscoCloud/distributive/workers/filesystem.go | 3 ++- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 217df7b..cb55585 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ +distributive test.json test.go run.sh -<<<<<<< HEAD bin/ .gvp/ .godeps/ @@ -9,11 +9,3 @@ bin/ *.swp *.rpm *.bak -======= -bin/* -.gvp/* -*.swp -*.rpm -*.bak -*.rpm*.bak ->>>>>>> master diff --git a/README.md b/README.md index 173b25e..b44ae2b 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ provides many services not included in Distributive, and solves a very different problem. Distributive is simple, lightweight, and easy to configure, and doesn't provide its own scheduling, dashboard, etc. It is designed to be used within frameworks such as Sensu and Consul. Luckily, Distributive conforms to -[Nagios exit code specifications] [Nagios], and can be used just like any other +[Nagios exit code specifications], and can be used just like any other plugin. Its advantage over other plugins is that it is small, fast, and has no dependencies. @@ -170,25 +170,25 @@ Getting Help Feature requests, documentation requests, help installing and using, pull requests, and other comments or questions are all always welcome. We strive to provide expedient and detailed support for anyone using our software. Please -submit any requests via our [Github Issues Page] [issues], where someone will +submit any requests via our [Github Issues Page], where someone will see it and get to work promptly. License ======= Copyright © 2015 Cisco Systems, Inc. -Licensed under the [Apache License, Version 2.0] [license] (the "License"). +Licensed under the [Apache License, Version 2.0] (the "License"). Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -[1]: http://www.apache.org/licenses/LICENSE-2.0 "license" +[1]: http://www.apache.org/licenses/LICENSE-2.0 "Apache License, Version 2.0" [2]: https://github.com/CiscoCloud/distributive/wiki "wiki" -[3]: https://github.com/CiscoCloud/distributive/issues "issues" +[3]: https://github.com/CiscoCloud/distributive/issues "Github Issues Page" [4]: https://bintray.com/ciscocloud/rpm/Distributive/view#files "bintray" [5]: https://www.consul.io/docs/agent/checks.html "Consul" [6]: https://sensuapp.org/docs/0.18/checks "Sensu" -[7]: https://nagios-plugins.org/doc/guidelines.html#AEN78 "Nagios" +[7]: https://nagios-plugins.org/doc/guidelines.html#AEN78 "Nagios exit code specifications" [8]: https://golang.org/doc/code.html#GOPATH "gopath" [9]: https://github.com/pote/gpm "gpm" [10]: https://github.com/pote/gvp "gvp" diff --git a/run.sh b/run.sh index 922d6a8..c2c1b21 100755 --- a/run.sh +++ b/run.sh @@ -1,3 +1,3 @@ #!/bin/bash source build.sh -sudo ./bin/distributive -d "" -f samples/systemctl-fail.json --verbosity="debug" +sudo ./bin/distributive -d samples --verbosity="info" diff --git a/src/github.com/CiscoCloud/distributive/main.go b/src/github.com/CiscoCloud/distributive/main.go index 6da58e0..2ef1ca1 100644 --- a/src/github.com/CiscoCloud/distributive/main.go +++ b/src/github.com/CiscoCloud/distributive/main.go @@ -271,15 +271,15 @@ func runChecks(chklst Checklist) Checklist { chklst.Codes = append(chklst.Codes, code) chklst.Messages = append(chklst.Messages, msg) // were errors encountered? - no := "" + passed := "failed" if code == 0 { - no = " no" + passed = "passed" } // warn log happens later log.WithFields(log.Fields{ "name": chk.Name, "type": chk.Check, - }).Info("Check exited with" + no + " errors") + }).Info("Check " + passed) } return chklst } @@ -314,7 +314,7 @@ func main() { log.WithFields(log.Fields{ "checklist": chklst.Name, "report": report, - }).Warn("Some checks failed, printing checklist report") + }).Warn("Check(s) failed, printing checklist report") } else { log.WithFields(log.Fields{ "checklist": chklst.Name, diff --git a/src/github.com/CiscoCloud/distributive/workers/filesystem.go b/src/github.com/CiscoCloud/distributive/workers/filesystem.go index db261d6..a84aa2d 100644 --- a/src/github.com/CiscoCloud/distributive/workers/filesystem.go +++ b/src/github.com/CiscoCloud/distributive/workers/filesystem.go @@ -117,7 +117,8 @@ func fileContains(parameters []string) (exitCode int, exitMessage string) { if regex.Match(wrkutils.FileToBytes(path)) { return 0, "" } - return 1, "File does not match regexp:\n\tFile: " + path + msg := "File does not match regexp:\n\tFile: " + return 1, msg + path + "\n\tRegexp" + regex.String() } // permissions checks to see if a file's octal permissions match the given set