Skip to content

Commit

Permalink
Flag --exlude-path fix (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Mofasser authored Apr 24, 2019
1 parent d7fcb8a commit 9bd4164
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ integration-test: docker_build
-keyout ${BUILD_DIR}/out/integration-test/ssl/self-signed-key.pem \
-out ${BUILD_DIR}/out/integration-test/ssl/self-signed.pem
docker run -d --name node-cert-exporter -v ${BUILD_DIR}/out/integration-test/ssl:/certs -p 9117:9117 amimof/node-cert-exporter:${VERSION} --logtostderr=true --v=4 --path=/certs
sleep 5
sleep 3
curl -s http://127.0.0.1:9117/metrics | grep ssl_certificate_expiry_seconds
curl -s http://127.0.0.1:9117/metrics | grep 'issuer="CN=localhost,OU=amimof,O=system:nodes,L=Gothenburg,ST=Vastra Gotalands Lan,C=SE"'
curl -s http://127.0.0.1:9117/metrics | grep 'path="/certs/self-signed.pem"'
Expand All @@ -79,6 +79,13 @@ integration-test: docker_build
curl -s http://127.0.0.1:9117/metrics | grep 'email_addresses=""'
docker kill node-cert-exporter
docker rm node-cert-exporter
docker run -d --name node-cert-exporter -v ${BUILD_DIR}/out/integration-test/ssl:/certs -p 9117:9117 amimof/node-cert-exporter:${VERSION} --logtostderr=true --v=4 --path=/certs --exclude-path=/certs
sleep 3
if [ "`curl -s http://127.0.0.1:9117/metrics | grep ssl_certificate_expiry_seconds`" != "" ]; then \
exit 1; \
fi
docker kill node-cert-exporter
docker rm node-cert-exporter

linux: dep
CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BUILD_DIR}/out/${BINARY}-linux-${GOARCH} cmd/node-cert-exporter/main.go
Expand Down
2 changes: 1 addition & 1 deletion pkg/exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func findCertPaths(p string, exPaths []string) ([]string, error) {
if len(exPaths) > 0 {
for _, exPath := range exPaths {
if strings.Contains(filepath.Dir(path), exPath) || path == exPath {
continue
return nil
}
}
}
Expand Down

0 comments on commit 9bd4164

Please sign in to comment.