Skip to content

Commit

Permalink
fix: fix previous commit
Browse files Browse the repository at this point in the history
Some commands had the verification before reading the configuration. Fuck.
  • Loading branch information
alexppg committed Jul 7, 2021
1 parent e5f881a commit 28473c2
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 37 deletions.
6 changes: 4 additions & 2 deletions cmd/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ func cleanup(cmd *cobra.Command, args []string) {
logger := helpers.GetLogger(debug)
scenario, _ = cmd.Flags().GetString("scenario")

logger.Info("Begin cleanup")

configuration, err = config.ReadConfiguration(scenario)
customError.CheckGenericError(logger, err)

Expand All @@ -34,9 +32,13 @@ func cleanup(cmd *cobra.Command, args []string) {
"linter": strings.Replace(configuration.Linter, "\n", " && ", -1),
}).Debug("Configuration to use")

logger.Info("Syntax")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

logger.Info("Begin cleanup")

err = cli.Cleanup(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

Expand Down
6 changes: 4 additions & 2 deletions cmd/converge.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ func converge(cmd *cobra.Command, args []string) {
logger := helpers.GetLogger(debug)
scenario, _ = cmd.Flags().GetString("scenario")

logger.Info("Begin converge")

configuration, err = config.ReadConfiguration(scenario)
customError.CheckGenericError(logger, err)

Expand All @@ -34,9 +32,13 @@ func converge(cmd *cobra.Command, args []string) {
"linter": strings.Replace(configuration.Linter, "\n", " && ", -1),
}).Debug("Configuration to use")

logger.Info("Syntax")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

logger.Info("Begin converge")

err = cli.Converge(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

Expand Down
6 changes: 4 additions & 2 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ func create(cmd *cobra.Command, args []string) {
logger := helpers.GetLogger(debug)
scenario, _ = cmd.Flags().GetString("scenario")

logger.Info("Begin create")

configuration, err = config.ReadConfiguration(scenario)
customError.CheckGenericError(logger, err)

Expand All @@ -34,9 +32,13 @@ func create(cmd *cobra.Command, args []string) {
"linter": strings.Replace(configuration.Linter, "\n", " && ", -1),
}).Debug("Configuration to use")

logger.Info("Syntax")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

logger.Info("Begin create")

err = cli.Create(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

Expand Down
12 changes: 7 additions & 5 deletions cmd/dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ func dependency(cmd *cobra.Command, args []string) {
logger := helpers.GetLogger(debug)
scenario, _ = cmd.Flags().GetString("scenario")

logger.Info("Begin dependency")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

configuration, err = config.ReadConfiguration(scenario)
customError.CheckGenericError(logger, err)

Expand All @@ -36,6 +31,13 @@ func dependency(cmd *cobra.Command, args []string) {
"linter": strings.Replace(configuration.Linter, "\n", " && ", -1),
}).Debug("Configuration to use")

logger.Info("Syntax")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

logger.Info("Begin dependency")

err = cli.Dependency(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

Expand Down
12 changes: 7 additions & 5 deletions cmd/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ func destroy(cmd *cobra.Command, args []string) {
logger := helpers.GetLogger(debug)
scenario, _ = cmd.Flags().GetString("scenario")

logger.Info("Begin destroy")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

configuration, err = config.ReadConfiguration(scenario)
customError.CheckGenericError(logger, err)

Expand All @@ -37,6 +32,13 @@ func destroy(cmd *cobra.Command, args []string) {
"linter": strings.Replace(configuration.Linter, "\n", " && ", -1),
}).Debug("Configuration to use")

logger.Info("Syntax")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

logger.Info("Begin destroy")

err = cli.Destroy(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

Expand Down
12 changes: 7 additions & 5 deletions cmd/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ func lint(cmd *cobra.Command, args []string) {
logger := helpers.GetLogger(debug)
scenario, _ = cmd.Flags().GetString("scenario")

logger.Info("Begin linting")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

configuration, err = config.ReadConfiguration(scenario)
customError.CheckGenericError(logger, err)

Expand All @@ -37,6 +32,13 @@ func lint(cmd *cobra.Command, args []string) {
"linter": strings.Replace(configuration.Linter, "\n", " && ", -1),
}).Debug("Configuration to use")

logger.Info("Syntax")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

logger.Info("Begin linting")

err = cli.Lint(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

Expand Down
12 changes: 7 additions & 5 deletions cmd/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ func prepare(cmd *cobra.Command, args []string) {
logger := helpers.GetLogger(debug)
scenario, _ = cmd.Flags().GetString("scenario")

logger.Info("Begin prepare")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

configuration, err = config.ReadConfiguration(scenario)
customError.CheckGenericError(logger, err)

Expand All @@ -36,6 +31,13 @@ func prepare(cmd *cobra.Command, args []string) {
"linter": strings.Replace(configuration.Linter, "\n", " && ", -1),
}).Debug("Configuration to use")

logger.Info("Syntax")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

logger.Info("Begin prepare")

err = cli.Prepare(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

Expand Down
3 changes: 0 additions & 3 deletions cmd/syntax.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ func syntax(cmd *cobra.Command, args []string) {

logger.Info("Begin syntax")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

configuration, err = config.ReadConfiguration(scenario)
customError.CheckGenericError(logger, err)

Expand Down
3 changes: 0 additions & 3 deletions cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ func test(cmd *cobra.Command, args []string) {
logger := helpers.GetLogger(debug)
scenario, _ = cmd.Flags().GetString("scenario")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

configuration, err = config.ReadConfiguration(scenario)
customError.CheckGenericError(logger, err)

Expand Down
12 changes: 7 additions & 5 deletions cmd/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ func verify(cmd *cobra.Command, args []string) {
logger := helpers.GetLogger(debug)
scenario, _ = cmd.Flags().GetString("scenario")

logger.Info("Begin verify")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

configuration, err = config.ReadConfiguration(scenario)
customError.CheckGenericError(logger, err)

Expand All @@ -37,6 +32,13 @@ func verify(cmd *cobra.Command, args []string) {
"linter": strings.Replace(configuration.Linter, "\n", " && ", -1),
}).Debug("Configuration to use")

logger.Info("Syntax")

err = cli.Syntax(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

logger.Info("Begin verify")

err = cli.Verify(scenario, configuration, logger)
customError.CheckGenericError(logger, err)

Expand Down

0 comments on commit 28473c2

Please sign in to comment.