diff --git a/command/deploy.go b/command/deploy.go index ea828dd20..f3a1e5d85 100644 --- a/command/deploy.go +++ b/command/deploy.go @@ -4,12 +4,12 @@ import ( "fmt" "strings" + "github.com/hashicorp/levant/helper" + "github.com/hashicorp/levant/levant" + "github.com/hashicorp/levant/levant/structs" + "github.com/hashicorp/levant/logging" + "github.com/hashicorp/levant/template" nomad "github.com/hashicorp/nomad/api" - "github.com/jrasell/levant/helper" - "github.com/jrasell/levant/levant" - "github.com/jrasell/levant/levant/structs" - "github.com/jrasell/levant/logging" - "github.com/jrasell/levant/template" ) // DeployCommand is the command implementation that allows users to deploy a diff --git a/command/deploy_test.go b/command/deploy_test.go index 6db2492ac..6ae55bcba 100644 --- a/command/deploy_test.go +++ b/command/deploy_test.go @@ -3,7 +3,7 @@ package command import ( "testing" - "github.com/jrasell/levant/template" + "github.com/hashicorp/levant/template" ) func TestDeploy_checkCanaryAutoPromote(t *testing.T) { diff --git a/command/dispatch.go b/command/dispatch.go index d52d1f13c..ea8b536f7 100644 --- a/command/dispatch.go +++ b/command/dispatch.go @@ -6,9 +6,9 @@ import ( "os" "strings" + "github.com/hashicorp/levant/levant" + "github.com/hashicorp/levant/logging" flaghelper "github.com/hashicorp/nomad/helper/flag-helpers" - "github.com/jrasell/levant/levant" - "github.com/jrasell/levant/logging" ) // DispatchCommand is the command implementation that allows users to diff --git a/command/meta.go b/command/meta.go index 0133aa836..99a585048 100644 --- a/command/meta.go +++ b/command/meta.go @@ -5,7 +5,7 @@ import ( "flag" "io" - "github.com/jrasell/levant/helper" + "github.com/hashicorp/levant/helper" "github.com/mitchellh/cli" ) diff --git a/command/plan.go b/command/plan.go index 4099fcefb..caee6d907 100644 --- a/command/plan.go +++ b/command/plan.go @@ -4,11 +4,11 @@ import ( "fmt" "strings" - "github.com/jrasell/levant/helper" - "github.com/jrasell/levant/levant" - "github.com/jrasell/levant/levant/structs" - "github.com/jrasell/levant/logging" - "github.com/jrasell/levant/template" + "github.com/hashicorp/levant/helper" + "github.com/hashicorp/levant/levant" + "github.com/hashicorp/levant/levant/structs" + "github.com/hashicorp/levant/logging" + "github.com/hashicorp/levant/template" ) // PlanCommand is the command implementation that allows users to plan a diff --git a/command/render.go b/command/render.go index c2fa1026c..cda7b5c7b 100644 --- a/command/render.go +++ b/command/render.go @@ -6,8 +6,8 @@ import ( "os" "strings" - "github.com/jrasell/levant/helper" - "github.com/jrasell/levant/template" + "github.com/hashicorp/levant/helper" + "github.com/hashicorp/levant/template" ) // RenderCommand is the command implementation that allows users to render a diff --git a/command/scale_in.go b/command/scale_in.go index 907bf436b..dbedcd5a6 100644 --- a/command/scale_in.go +++ b/command/scale_in.go @@ -3,9 +3,9 @@ package command import ( "strings" - "github.com/jrasell/levant/levant/structs" - "github.com/jrasell/levant/logging" - "github.com/jrasell/levant/scale" + "github.com/hashicorp/levant/levant/structs" + "github.com/hashicorp/levant/logging" + "github.com/hashicorp/levant/scale" ) // ScaleInCommand is the command implementation that allows users to scale a diff --git a/command/scale_out.go b/command/scale_out.go index 8beb5b3d2..71db6c350 100644 --- a/command/scale_out.go +++ b/command/scale_out.go @@ -3,9 +3,9 @@ package command import ( "strings" - "github.com/jrasell/levant/levant/structs" - "github.com/jrasell/levant/logging" - "github.com/jrasell/levant/scale" + "github.com/hashicorp/levant/levant/structs" + "github.com/hashicorp/levant/logging" + "github.com/hashicorp/levant/scale" ) // ScaleOutCommand is the command implementation that allows users to scale a diff --git a/command/version.go b/command/version.go index fd35b8c20..a4ba34be7 100644 --- a/command/version.go +++ b/command/version.go @@ -3,15 +3,15 @@ package command import ( "fmt" - "github.com/jrasell/levant/buildtime" "github.com/mitchellh/cli" ) +var _ cli.Command = &VersionCommand{} + // VersionCommand is a Command implementation that prints the version. type VersionCommand struct { - Version string - VersionPrerelease string - UI cli.Ui + Version string + UI cli.Ui } // Help provides the help information for the version command. @@ -26,18 +26,6 @@ func (c *VersionCommand) Synopsis() string { // Run executes the version command. func (c *VersionCommand) Run(_ []string) int { - - v := fmt.Sprintf("Levant v%s", c.Version) - - if c.VersionPrerelease != "" { - v = v + fmt.Sprintf("-%s", c.VersionPrerelease) - } - - c.UI.Output(v) - c.UI.Output(fmt.Sprintf("Date: %s", buildtime.BuildDate)) - c.UI.Output(fmt.Sprintf("Commit: %s", buildtime.GitCommit)) - c.UI.Output(fmt.Sprintf("Branch: %s", buildtime.GitBranch)) - c.UI.Output(fmt.Sprintf("State: %s", buildtime.GitState)) - c.UI.Output(fmt.Sprintf("Summary: %s", buildtime.GitSummary)) + fmt.Println(c.Version) return 0 } diff --git a/command/version_test.go b/command/version_test.go deleted file mode 100644 index 2a645690f..000000000 --- a/command/version_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package command - -import ( - "testing" - - "github.com/mitchellh/cli" -) - -func TestVersionCommand_implements(t *testing.T) { - var _ cli.Command = &VersionCommand{} -} diff --git a/helper/files_test.go b/helper/files_test.go index 511030994..959bc29a8 100644 --- a/helper/files_test.go +++ b/helper/files_test.go @@ -29,7 +29,7 @@ func TestHelper_GetDefaultTmplFile(t *testing.T) { // Use write file as tmpfile adds a prefix which doesn't work with the // GetDefaultTmplFile function. - err := ioutil.WriteFile(f, d1, 0644) + err := ioutil.WriteFile(f, d1, 0600) if err != nil { t.Fatal(err) } @@ -67,7 +67,7 @@ func TestHelper_GetDefaultVarFile(t *testing.T) { // Use write file as tmpfile adds a prefix which doesn't work with the // GetDefaultTmplFile function. - err := ioutil.WriteFile(tc.VarFile, d1, 0644) + err := ioutil.WriteFile(tc.VarFile, d1, 0600) if err != nil { t.Fatal(err) } diff --git a/levant/deploy.go b/levant/deploy.go index 8ea60b0cf..7e5047945 100644 --- a/levant/deploy.go +++ b/levant/deploy.go @@ -6,9 +6,9 @@ import ( "strings" "time" + "github.com/hashicorp/levant/client" + "github.com/hashicorp/levant/levant/structs" nomad "github.com/hashicorp/nomad/api" - "github.com/jrasell/levant/client" - "github.com/jrasell/levant/levant/structs" "github.com/pkg/errors" "github.com/rs/zerolog/log" ) diff --git a/levant/dispatch.go b/levant/dispatch.go index 728d43749..f0e0d6de0 100644 --- a/levant/dispatch.go +++ b/levant/dispatch.go @@ -1,8 +1,8 @@ package levant import ( + "github.com/hashicorp/levant/client" nomad "github.com/hashicorp/nomad/api" - "github.com/jrasell/levant/client" "github.com/rs/zerolog/log" ) diff --git a/levant/plan.go b/levant/plan.go index b100cadbc..3d4a5f1e0 100644 --- a/levant/plan.go +++ b/levant/plan.go @@ -3,9 +3,9 @@ package levant import ( "fmt" + "github.com/hashicorp/levant/client" + "github.com/hashicorp/levant/levant/structs" nomad "github.com/hashicorp/nomad/api" - "github.com/jrasell/levant/client" - "github.com/jrasell/levant/levant/structs" "github.com/rs/zerolog/log" ) diff --git a/scale/scale.go b/scale/scale.go index 16c3f1317..4b66a28d6 100644 --- a/scale/scale.go +++ b/scale/scale.go @@ -1,10 +1,10 @@ package scale import ( + "github.com/hashicorp/levant/client" + "github.com/hashicorp/levant/levant" + "github.com/hashicorp/levant/levant/structs" nomad "github.com/hashicorp/nomad/api" - "github.com/jrasell/levant/client" - "github.com/jrasell/levant/levant" - "github.com/jrasell/levant/levant/structs" "github.com/rs/zerolog/log" ) diff --git a/scale/scale_test.go b/scale/scale_test.go index aad17f492..d4277a60a 100644 --- a/scale/scale_test.go +++ b/scale/scale_test.go @@ -3,8 +3,8 @@ package scale import ( "testing" + "github.com/hashicorp/levant/levant/structs" nomad "github.com/hashicorp/nomad/api" - "github.com/jrasell/levant/levant/structs" ) func TestScale_updateTaskGroup(t *testing.T) { diff --git a/template/render.go b/template/render.go index b5d542ab7..ce890351e 100644 --- a/template/render.go +++ b/template/render.go @@ -7,14 +7,13 @@ import ( "io/ioutil" "path" - "github.com/jrasell/levant/client" - "github.com/jrasell/levant/helper" - "github.com/rs/zerolog/log" - yaml "gopkg.in/yaml.v2" - + "github.com/hashicorp/levant/client" + "github.com/hashicorp/levant/helper" nomad "github.com/hashicorp/nomad/api" "github.com/hashicorp/nomad/jobspec" "github.com/hashicorp/terraform/config" + "github.com/rs/zerolog/log" + yaml "gopkg.in/yaml.v2" ) // RenderJob takes in a template and variables performing a render of the diff --git a/test/acctest/acctest.go b/test/acctest/acctest.go index 7f7e01d57..8e8692ce4 100644 --- a/test/acctest/acctest.go +++ b/test/acctest/acctest.go @@ -145,7 +145,7 @@ func CheckTaskGroupCount(groupName string, count int) TestStateFunc { } } -// newNomadClient creates a Nomad API client configrable by NOMAD_ +// newNomadClient creates a Nomad API client configurable by NOMAD_ // env variables or returns an error if Nomad is in an unhealthy state func newNomadClient() (*nomad.Client, error) { c, err := nomad.NewClient(nomad.DefaultConfig()) @@ -158,9 +158,8 @@ func newNomadClient() (*nomad.Client, error) { return nil, err } - if !resp.Server.Ok || !resp.Client.Ok { + if (resp.Server != nil && !resp.Server.Ok) || (resp.Client != nil && !resp.Client.Ok) { return nil, fmt.Errorf("agent unhealthy") } - return c, nil } diff --git a/test/acctest/deploy.go b/test/acctest/deploy.go index b654b7796..0c232e660 100644 --- a/test/acctest/deploy.go +++ b/test/acctest/deploy.go @@ -3,9 +3,9 @@ package acctest import ( "fmt" - "github.com/jrasell/levant/levant" - "github.com/jrasell/levant/levant/structs" - "github.com/jrasell/levant/template" + "github.com/hashicorp/levant/levant" + "github.com/hashicorp/levant/levant/structs" + "github.com/hashicorp/levant/template" ) // DeployTestStepRunner implements TestStepRunner to execute a levant deployment diff --git a/test/deploy_test.go b/test/deploy_test.go index 2dd8df60c..2f8584fd1 100644 --- a/test/deploy_test.go +++ b/test/deploy_test.go @@ -3,7 +3,7 @@ package test import ( "testing" - "github.com/jrasell/levant/test/acctest" + "github.com/hashicorp/levant/test/acctest" ) func TestDeploy_basic(t *testing.T) {