diff --git a/config.go b/config.go index 3c9ae17b..68d62dfc 100644 --- a/config.go +++ b/config.go @@ -27,7 +27,6 @@ const ( entryPoint = "entry-point" tgfVersion = "tgf-recommended-version" recommendedImage = "recommended-image" - flushCache = "flush-cache" ) type tgfConfig struct { @@ -38,7 +37,6 @@ type tgfConfig struct { RecommendedMinimalVersion string RecommendedImage string Debug string - FlushCache string } func (config *tgfConfig) complete() bool { @@ -121,10 +119,6 @@ func (config *tgfConfig) SetValue(key, value string) { if config.RecommendedImage == "" { config.RecommendedImage = value } - case flushCache: - if config.FlushCache == "" { - config.FlushCache = value - } default: fmt.Fprintf(os.Stderr, "Unknown parameter %s = %s\n", key, value) } diff --git a/docker.go b/docker.go index 4c06fce5..16d07630 100644 --- a/docker.go +++ b/docker.go @@ -13,7 +13,7 @@ import ( "github.com/gruntwork-io/terragrunt/util" ) -func callDocker(config tgfConfig, mapHome bool, args ...string) { +func callDocker(config tgfConfig, mapHome bool, flushCache bool, args ...string) { command := append([]string{config.EntryPoint}, args...) // Change the default log level for terragrunt @@ -28,7 +28,7 @@ func callDocker(config tgfConfig, mapHome bool, args ...string) { } } - if config.FlushCache != "" && config.EntryPoint == "terragrunt" { + if flushCache && config.EntryPoint == "terragrunt" { command = append(command, "--terragrunt-source-update") } diff --git a/main.go b/main.go index 9f18ccf8..fc0793f3 100644 --- a/main.go +++ b/main.go @@ -34,7 +34,7 @@ func main() { getVersion = app.Switch("version", "Get the current version of tgf", 'v').Bool() loggingLevel = app.Argument("logging", "Set the logging level (critical=0, error=1, warning=2, notice=3, info=4, debug=5)", 'l').PlaceHolder("").String() noHome = app.Switch("no-home", "Disable the mapping of the home directory").Bool() - flush = app.Switch("flush-cache", "Pass --terragrunt-update-source to terragrunt to flush the cache", 'f').Bool() + flushCache = app.Switch("flush-cache", "Pass --terragrunt-update-source to terragrunt to flush the cache", 'f').Bool() ) app.Author("Coveo") kingpin.CommandLine = app.Application @@ -61,9 +61,6 @@ func main() { config.SetValue(dockerDebug, "yes") } - if *flush { - config.SetValue(flushCache, "yes") - } if *tag != "" { split := strings.Split(config.Image, ":") config.Image = strings.Join([]string{split[0], *tag}, ":") @@ -87,5 +84,5 @@ func main() { fmt.Fprintf(os.Stderr, "A new version of tgf image is available, you use %s. The recommended image is %s\n\n", config.Image, config.RecommendedImage) } - callDocker(config, !*noHome, unmanaged...) + callDocker(config, !*noHome, *flushCache, unmanaged...) }