Documentation
¶
Overview ¶
Package create provides helper for creation
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CreateCmd = &cobra.Command{ Use: "create", Short: "Run a generated at playbooks/sfconfig-operator-create-*", Long: `Run a generated at playbooks/sfconfig-operator-create-*, it can be used for CI job and can be used locally ./tools/sfconfig operator create [OPTIONS] OPTIONS --bundle, -b - creates namespace for the bundle ( default: operators ) --bundlenamespace string, -B string- creates namespace for the bundle with specific name --namespace, -n - creates namespace for Software Factory ( default: sf ) --namespacename string, -N string - creates namespace for Software Factory with specific name --all, -a - executes all options in sequence --verbose, -v - verbose `, Run: func(cmd *cobra.Command, args []string) { bundle, _ := cmd.Flags().GetBool("bundle") bundlenamespace, _ := cmd.Flags().GetString("bundlenamespace") namespace, _ := cmd.Flags().GetBool("namespace") namespacename, _ := cmd.Flags().GetString("namespacename") all, _ := cmd.Flags().GetBool("all") verbose, _ := cmd.Flags().GetBool("verbose") fmt.Println(bundle) if !bundle && len(bundlenamespace) == 0 && !namespace && len(namespacename) == 0 && !all { cmd.Help() os.Exit(0) } ansiblePlaybookOptions := &playbook.AnsiblePlaybookOptions{} ansiblePlaybookConnectionOptions := &options.AnsibleConnectionOptions{} ansiblePlaybookConnectionOptions.Connection = "local" ansiblePlaybookOptions.AddExtraVar("remote_os_host", true) ansiblePlaybookOptions.AddExtraVar("hostname", "localhost") if verbose { ansiblePlaybookOptions.Verbose = true } if bundle || all { ansiblePlaybookOptions.Tags += "operator_bundle_namespace," } if len(bundlenamespace) != 0 { ansiblePlaybookOptions.AddExtraVar("bundlenamespace", bundlenamespace) } if namespace || all { ansiblePlaybookOptions.Tags += "operator_sf_namespace," } if len(namespacename) != 0 { ansiblePlaybookOptions.AddExtraVar("namespace", namespacename) } file, _ := utils.CreateTempPlaybookFile(generateTemplate()) var playbookYAML = file.Name() playbook := &playbook.AnsiblePlaybookCmd{ Playbooks: []string{playbookYAML}, ConnectionOptions: ansiblePlaybookConnectionOptions, Options: ansiblePlaybookOptions, } options.AnsibleForceColor() fmt.Println(playbook) err := playbook.Run(context.TODO()) if err != nil { panic(err) } utils.RemoveTempPlaybookFile(file) }, }
CreateCmd represents the operatordelete command
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.