Skip to content
This repository was archived by the owner on Jun 11, 2021. It is now read-only.

Commit c730a7b

Browse files
committed
Set logging to INFO and WARN on removing vendored modules
1 parent 76765b3 commit c730a7b

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

cmd/install.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var installCmd = &cobra.Command{
4444
Use: "install",
4545
Short: "Installs the modules in your Terrafile",
4646
Run: func(cmd *cobra.Command, args []string) {
47+
jww.WARN.Printf("Removing all modules in %s", VendorDir)
4748

4849
os.RemoveAll(VendorDir)
4950
os.MkdirAll(VendorDir, os.ModePerm)
@@ -75,11 +76,12 @@ var installCmd = &cobra.Command{
7576
}
7677

7778
func init() {
79+
jww.SetStdoutThreshold(jww.LevelInfo)
7880
rootCmd.AddCommand(installCmd)
7981
}
8082

8183
func getRegistrySource(name string, source string, version string) (string, string) {
82-
jww.WARN.Printf("[%s] Looking up %s version %s in Terraform registry", name, source, version)
84+
jww.INFO.Printf("[%s] Looking up %s version %s in Terraform registry", name, source, version)
8385
if version == "master" {
8486
err := errors.New("Registry module version must be specified")
8587
CheckIfError(err)
@@ -128,13 +130,13 @@ func validRegistry(source string) bool {
128130
}
129131

130132
func copyFile(name string, src string, dst string) {
131-
jww.WARN.Printf("[%s] Copying from %s", name, src)
133+
jww.INFO.Printf("[%s] Copying from %s", name, src)
132134
err := copy.Copy(src, dst)
133135
CheckIfError(err)
134136
}
135137

136138
func gitCheckout(name string, repo string, version string, directory string) {
137-
jww.WARN.Printf("[%s] Checking out %s from %s", name, version, repo)
139+
jww.INFO.Printf("[%s] Checking out %s from %s", name, version, repo)
138140

139141
r, err := git.PlainClone(directory, false, &git.CloneOptions{
140142
URL: repo,

main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ package main
2222

2323
import (
2424
"github.com/devopsmakers/xterrafile/cmd"
25-
jww "github.com/spf13/jwalterweatherman"
2625
)
2726

2827
func main() {
29-
jww.SetStdoutThreshold(jww.LevelWarn)
3028
cmd.Execute()
3129
}

main_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func TestTerraformWithTerrafilePath(t *testing.T) {
3333
}
3434
// Assert output
3535
for _, output := range []string{
36+
"Removing all modules in vendor/xterrafile",
3637
"Checking out master from git@github.com:terraform-aws-modules/terraform-aws-vpc",
3738
"Checking out v1.46.0 from git@github.com:terraform-aws-modules/terraform-aws-vpc",
3839
"Checking out 01601169c00c68f37d5df8a80cc17c88f02c04d0 from git@github.com:terraform-aws-modules/terraform-aws-vpc",

0 commit comments

Comments
 (0)