-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2338 from carapace-sh/add-molecule
add molecule
- Loading branch information
Showing
24 changed files
with
670 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/molecule" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var checkCmd = &cobra.Command{ | ||
Use: "check [flags]", | ||
Short: "Use the provisioner to perform a Dry-Run", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(checkCmd) | ||
|
||
checkCmd.Flags().Bool("help", false, "Show help message and exit") | ||
checkCmd.Flags().Bool("no-parallel", true, "Disable parallel mode (default)") | ||
checkCmd.Flags().Bool("parallel", false, "Enabe parallel mode") | ||
checkCmd.Flags().StringP("scenario-name", "s", "default", "Name of the scenario to target") | ||
|
||
checkCmd.MarkFlagsMutuallyExclusive("parallel", "no-parallel") | ||
|
||
carapace.Gen(checkCmd).FlagCompletion(carapace.ActionMap{ | ||
"scenario-name": molecule.ActionScenarios(), | ||
}) | ||
|
||
rootCmd.AddCommand(checkCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/molecule" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var cleanupCmd = &cobra.Command{ | ||
Use: "cleanup [flags]", | ||
Short: "Use the provisioner to cleanup any changes made to external systems", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(cleanupCmd) | ||
|
||
cleanupCmd.Flags().Bool("help", false, "Show help message and exit") | ||
cleanupCmd.Flags().StringP("scenario-name", "s", "default", "Name of the scenario to target") | ||
|
||
carapace.Gen(cleanupCmd).FlagCompletion(carapace.ActionMap{ | ||
"scenario-name": molecule.ActionScenarios(), | ||
}) | ||
|
||
rootCmd.AddCommand(cleanupCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/molecule" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var convergeCmd = &cobra.Command{ | ||
Use: "converge [flags]", | ||
Short: "Use the provisioner to configure instances", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(convergeCmd) | ||
|
||
convergeCmd.Flags().Bool("help", false, "Show help message and exit") | ||
convergeCmd.Flags().StringP("scenario-name", "s", "default", "Name of the scenario to target") | ||
|
||
carapace.Gen(convergeCmd).FlagCompletion(carapace.ActionMap{ | ||
"scenario-name": molecule.ActionScenarios(), | ||
}) | ||
|
||
rootCmd.AddCommand(convergeCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/molecule" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var createCmd = &cobra.Command{ | ||
Use: "create [flags]", | ||
Short: "Use the provisioner to start the instances", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(createCmd) | ||
|
||
createCmd.Flags().StringP("driver-name", "d", "delegated", "Name of the driver to use") | ||
createCmd.Flags().Bool("help", false, "Show help message and exit") | ||
createCmd.Flags().StringP("scenario-name", "s", "default", "Name of the scenario to target") | ||
|
||
carapace.Gen(createCmd).FlagCompletion(carapace.ActionMap{ | ||
"driver-name": molecule.ActionDrivers(), | ||
"scenario-name": molecule.ActionScenarios(), | ||
}) | ||
|
||
rootCmd.AddCommand(createCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/molecule" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var dependencyCmd = &cobra.Command{ | ||
Use: "dependency [flags]", | ||
Short: "Manage the role's dependencies", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(dependencyCmd) | ||
|
||
dependencyCmd.Flags().Bool("help", false, "Show help message and exit") | ||
dependencyCmd.Flags().StringP("scenario-name", "s", "default", "Name of the scenario to target") | ||
|
||
carapace.Gen(dependencyCmd).FlagCompletion(carapace.ActionMap{ | ||
"scenario-name": molecule.ActionScenarios(), | ||
}) | ||
|
||
rootCmd.AddCommand(dependencyCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/molecule" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var destroyCmd = &cobra.Command{ | ||
Use: "destroy [flags]", | ||
Short: "Use the provisioner to destroy the instances", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(destroyCmd) | ||
|
||
destroyCmd.Flags().Bool("all", false, "Destroy all scenarios") | ||
destroyCmd.Flags().StringP("driver-name", "d", "delegated", "Name of the driver to use") | ||
destroyCmd.Flags().Bool("help", false, "Show help message and exit") | ||
destroyCmd.Flags().Bool("no-all", true, "Don't destroy all scenarios (default)") | ||
destroyCmd.Flags().Bool("no-parallel", true, "Disable parallel mode (default)") | ||
destroyCmd.Flags().Bool("parallel", false, "Enabe parallel mode") | ||
destroyCmd.Flags().StringP("scenario-name", "s", "default", "Name of the scenario to target") | ||
|
||
destroyCmd.MarkFlagsMutuallyExclusive("all", "scenario-name") | ||
destroyCmd.MarkFlagsMutuallyExclusive("all", "no-all") | ||
destroyCmd.MarkFlagsMutuallyExclusive("parallel", "no-parallel") | ||
|
||
carapace.Gen(destroyCmd).FlagCompletion(carapace.ActionMap{ | ||
"driver-name": molecule.ActionDrivers(), | ||
"scenario-name": molecule.ActionScenarios(), | ||
}) | ||
|
||
rootCmd.AddCommand(destroyCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var driversCmd = &cobra.Command{ | ||
Use: "drivers [flags]", | ||
Short: "List drivers", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(driversCmd) | ||
|
||
driversCmd.Flags().StringP("format", "f", "plain", "Change output format") | ||
driversCmd.Flags().Bool("help", false, "Show help message and exit") | ||
|
||
carapace.Gen(driversCmd).FlagCompletion(carapace.ActionMap{ | ||
"format": carapace.ActionValues("plain", "simple"), | ||
}) | ||
|
||
rootCmd.AddCommand(driversCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/molecule" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var idempotenceCmd = &cobra.Command{ | ||
Use: "idempotence [flags]", | ||
Short: "Use the provisioner to configure instances and determine idempotence", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(idempotenceCmd) | ||
|
||
idempotenceCmd.Flags().Bool("help", false, "Show help message and exit") | ||
idempotenceCmd.Flags().StringP("scenario-name", "s", "default", "Name of the scenario to target") | ||
|
||
carapace.Gen(idempotenceCmd).FlagCompletion(carapace.ActionMap{ | ||
"scenario-name": molecule.ActionScenarios(), | ||
}) | ||
|
||
rootCmd.AddCommand(idempotenceCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var initCmd = &cobra.Command{ | ||
Use: "init [flags] COMMAND", | ||
Short: "Use the provisioner to cleanup any changes made to external systems", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(initCmd) | ||
|
||
initCmd.Flags().Bool("help", false, "Show help message and exit") | ||
|
||
rootCmd.AddCommand(initCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/molecule" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var initRoleCmd = &cobra.Command{ | ||
Use: "role [flags] ROLE_NAME", | ||
Short: "Initialize a new role for use with Molecule", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(initRoleCmd) | ||
|
||
initRoleCmd.Flags().String("dependency-name", "", "Name of galaxy dependency to initialize") | ||
initRoleCmd.Flags().StringP("driver-name", "d", "delegated", "Name of the driver to use") | ||
initRoleCmd.Flags().Bool("help", false, "Show help message and exit") | ||
initRoleCmd.Flags().String("provisioner-name", "ansible", "Name of provisioner to initialize") | ||
initRoleCmd.Flags().String("verifier-name", "ansible", "Name of verifier to initialize") | ||
|
||
carapace.Gen(initRoleCmd).FlagCompletion(carapace.ActionMap{ | ||
"driver-name": molecule.ActionDrivers(), | ||
"provisioner-name": carapace.ActionExecutables(), | ||
"verifier-name": carapace.ActionValues("ansible", "testinfra"), | ||
}) | ||
|
||
initCmd.AddCommand(initRoleCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/molecule" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var initScenarioCmd = &cobra.Command{ | ||
Use: "scenario [flags] [SCENARIO_NAME]", | ||
Short: "Initializes a new scenario to use with Molecule", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(initScenarioCmd) | ||
|
||
initScenarioCmd.Flags().String("dependency-name", "", "Name of galaxy dependency to initialize") | ||
initScenarioCmd.Flags().StringP("driver-name", "d", "delegated", "Name of the driver to use") | ||
initScenarioCmd.Flags().Bool("help", false, "Show help message and exit") | ||
initScenarioCmd.Flags().String("provisioner-name", "ansible", "Name of provisioner to initialize") | ||
initScenarioCmd.Flags().StringP("role-name", "r", "", "Name of the role to create") | ||
initScenarioCmd.Flags().String("verifier-name", "ansible", "Name of verifier to initialize") | ||
|
||
carapace.Gen(initScenarioCmd).FlagCompletion(carapace.ActionMap{ | ||
"driver-name": molecule.ActionDrivers(), | ||
"provisioner-name": carapace.ActionExecutables(), | ||
"verifier-name": carapace.ActionValues("ansible", "testinfra"), | ||
}) | ||
|
||
initCmd.AddCommand(initScenarioCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/molecule" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var listCmd = &cobra.Command{ | ||
Use: "list [flags]", | ||
Short: "List status of instances", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(listCmd) | ||
|
||
listCmd.Flags().StringP("format", "f", "simple", "Change output format") | ||
listCmd.Flags().Bool("help", false, "Show help message and exit") | ||
listCmd.Flags().StringP("scenario-name", "s", "default", "Name of the scenario to target") | ||
|
||
carapace.Gen(listCmd).FlagCompletion(carapace.ActionMap{ | ||
"format": carapace.ActionValues("plain", "simple", "yaml"), | ||
"scenario-name": molecule.ActionScenarios(), | ||
}) | ||
|
||
rootCmd.AddCommand(listCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/carapace-sh/carapace" | ||
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/molecule" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var loginCmd = &cobra.Command{ | ||
Use: "login [flags]", | ||
Short: "Login to one instance", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(loginCmd) | ||
|
||
loginCmd.Flags().Bool("help", false, "Show help message and exit") | ||
loginCmd.Flags().StringP("host", "h", "", "Host to access") | ||
loginCmd.Flags().StringP("scenario-name", "s", "default", "Name of the scenario to target") | ||
|
||
carapace.Gen(loginCmd).FlagCompletion(carapace.ActionMap{ | ||
// "host": action.ActionInstances(loginCmd), // TODO | ||
"scenario-name": molecule.ActionScenarios(), | ||
}) | ||
|
||
rootCmd.AddCommand(loginCmd) | ||
} |
Oops, something went wrong.