@@ -47,18 +47,12 @@ var (
4747 CHECK_TOPOLOGY_PLAYBOOK_STEPS = []int {
4848 playbook .CHECK_TOPOLOGY ,
4949 }
50- SUPPORTED_DEPLOY_TYPES = []string {
51- "production" ,
52- "test" ,
53- "develop" ,
54- }
5550)
5651
5752type addOptions struct {
5853 name string
5954 description string
6055 filename string
61- deployType string
6256}
6357
6458func NewAddCommand (curveadm * cli.CurveAdm ) * cobra.Command {
@@ -69,9 +63,6 @@ func NewAddCommand(curveadm *cli.CurveAdm) *cobra.Command {
6963 Short : "Add cluster" ,
7064 Args : utils .ExactArgs (1 ),
7165 Example : ADD_EXAMPLE ,
72- PreRunE : func (cmd * cobra.Command , args []string ) error {
73- return checkAddOptions (cmd )
74- },
7566 RunE : func (cmd * cobra.Command , args []string ) error {
7667 options .name = args [0 ]
7768 return runAdd (curveadm , options )
@@ -82,7 +73,7 @@ func NewAddCommand(curveadm *cli.CurveAdm) *cobra.Command {
8273 flags := cmd .Flags ()
8374 flags .StringVarP (& options .description , "description" , "m" , "" , "Description for cluster" )
8475 flags .StringVarP (& options .filename , "topology" , "f" , "" , "Specify the path of topology file" )
85- flags . StringVar ( & options . deployType , "type" , "develop" , "Specify the type of cluster" )
76+
8677 return cmd
8778}
8879
@@ -143,19 +134,6 @@ func checkTopology(curveadm *cli.CurveAdm, data string, options addOptions) erro
143134 return pb .Run ()
144135}
145136
146- func checkAddOptions (cmd * cobra.Command ) error {
147- deployType , err := cmd .Flags ().GetString ("deploy-type" )
148- if err != nil {
149- return err
150- }
151- for _ , t := range SUPPORTED_DEPLOY_TYPES {
152- if deployType == t {
153- return nil
154- }
155- }
156- return errno .ERR_UNSUPPORT_DEPLOY_TYPE .F ("deploy type: %s" , deployType )
157- }
158-
159137func runAdd (curveadm * cli.CurveAdm , options addOptions ) error {
160138 // 1) check wether cluster already exist
161139 name := options .name
@@ -185,7 +163,7 @@ func runAdd(curveadm *cli.CurveAdm, options addOptions) error {
185163
186164 // 4) insert cluster (with topology) into database
187165 uuid := uuid .NewString ()
188- err = storage .InsertCluster (name , uuid , options .description , data , options . deployType )
166+ err = storage .InsertCluster (name , uuid , options .description , data )
189167 if err != nil {
190168 return errno .ERR_INSERT_CLUSTER_FAILED .E (err )
191169 }
0 commit comments