Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit 17c7106

Browse files
author
David Chung
authored
Merge branch 'master' into maxlife
2 parents 46a5c01 + f552304 commit 17c7106

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ DOCKER_CLIENT_VERSION?=1.24
1111
# True to run e2e test
1212
E2E_TESTS?=true
1313

14+
#Source file target
15+
SRCS := $(shell find . -type f -name '*.go')
16+
1417
# Allow turning off function inlining and variable registerization
1518
ifeq (${DISABLE_OPTIMIZATION},true)
1619
GO_GCFLAGS=-gcflags "-N -l"
@@ -128,7 +131,7 @@ clean:
128131
mkdir -p build
129132

130133
define binary_target_template
131-
build/$(1):
134+
build/$(1): $(SRCS)
132135
go build -o build/$(1) \
133136
-ldflags "-X github.com/docker/infrakit/pkg/cli.Version=$(VERSION) -X github.com/docker/infrakit/pkg/cli.Revision=$(REVISION) -X github.com/docker/infrakit/pkg/util/docker.ClientVersion=$(DOCKER_CLIENT_VERSION)" $(2)
134137
endef

examples/instance/terraform/apply.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ func (p *plugin) terraformApply() error {
2626
if err := p.lock.TryLock(); err == nil {
2727
defer p.lock.Unlock()
2828
doTerraformApply(p.Dir)
29+
} else {
30+
log.Debugln("Can't acquire lock, waiting")
2931
}
30-
log.Debugln("Can't acquire lock, waiting")
3132
time.Sleep(time.Duration(int64(rand.NormFloat64())%1000) * time.Millisecond)
3233
}
3334
}()

pkg/cli/services.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"io/ioutil"
66
"os"
77
"path"
8+
"strconv"
89
"strings"
910

1011
"github.com/docker/infrakit/pkg/discovery"
@@ -171,7 +172,15 @@ func templateProcessor(plugins func() discovery.Plugins) (*pflag.FlagSet, ToJSON
171172
key := strings.TrimSpace(kv[0])
172173
val := strings.TrimSpace(kv[1])
173174
if key != "" && val != "" {
174-
engine.Global(key, val)
175+
// Attempt to convert to int and bool types so that template operations
176+
// are not only against strings.
177+
if intVal, err := strconv.Atoi(val); err == nil {
178+
engine.Global(key, intVal)
179+
} else if boolVar, err := strconv.ParseBool(val); err == nil {
180+
engine.Global(key, boolVar)
181+
} else {
182+
engine.Global(key, val)
183+
}
175184
}
176185
}
177186

0 commit comments

Comments
 (0)