Initial public commit of mgmt

This is a prototype that i'm attempting to "release early". Expect a lot
of changes! It is intended to be a config management tool that will:

* be event based
* execute actions in parallel
* function as a distributed system

There are a bunch more design ideas going into this, please stay tuned!
This commit is contained in:
James Shubin
2015-09-25 01:07:56 -04:00
commit 25ad05cce3
27 changed files with 2887 additions and 0 deletions

35
test/test-gofmt.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
# original version of this script from kubernetes project, under ALv2 license
set -o errexit
set -o nounset
set -o pipefail
ROOT=$(dirname "${BASH_SOURCE}")/..
GO_VERSION=($(go version))
if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.2|go1.3|go1.4') ]]; then
echo "Unknown go version '${GO_VERSION}', skipping gofmt."
exit 0
fi
cd "${ROOT}"
find_files() {
find . -not \( \
\( \
-wholename './old' \
-o -wholename './tmp' \
\) -prune \
\) -name '*.go'
}
GOFMT="gofmt" # we prefer to not use the -s flag, which is pretty annoying...
bad_files=$(find_files | xargs $GOFMT -l)
if [[ -n "${bad_files}" ]]; then
echo 'FAIL'
echo 'The following files are not properly formatted:'
echo "${bad_files}"
exit 1
fi

33
test/test-yamlfmt.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
# check for any yaml files that aren't properly formatted
set -o errexit
set -o nounset
set -o pipefail
ROOT=$(dirname "${BASH_SOURCE}")/..
cd "${ROOT}"
find_files() {
find . -not \( \
\( \
-wholename './old' \
-o -wholename './tmp' \
\) -prune \
\) -name '*.yaml'
}
bad_files=$(
for i in $(find_files); do
if ! diff -q <( ruby -e "require 'yaml'; puts YAML.load_file('$i').to_yaml" 2>/dev/null ) <( cat "$i" ) &>/dev/null; then
echo "$i"
fi
done
)
if [[ -n "${bad_files}" ]]; then
echo 'FAIL'
echo 'The following files are not properly formatted:'
echo "${bad_files}"
exit 1
fi