@@ -47,18 +47,12 @@ var (
47
47
CHECK_TOPOLOGY_PLAYBOOK_STEPS = []int {
48
48
playbook .CHECK_TOPOLOGY ,
49
49
}
50
- SUPPORTED_DEPLOY_TYPES = []string {
51
- "production" ,
52
- "test" ,
53
- "develop" ,
54
- }
55
50
)
56
51
57
52
type addOptions struct {
58
53
name string
59
54
description string
60
55
filename string
61
- deployType string
62
56
}
63
57
64
58
func NewAddCommand (curveadm * cli.CurveAdm ) * cobra.Command {
@@ -69,9 +63,6 @@ func NewAddCommand(curveadm *cli.CurveAdm) *cobra.Command {
69
63
Short : "Add cluster" ,
70
64
Args : utils .ExactArgs (1 ),
71
65
Example : ADD_EXAMPLE ,
72
- PreRunE : func (cmd * cobra.Command , args []string ) error {
73
- return checkAddOptions (cmd )
74
- },
75
66
RunE : func (cmd * cobra.Command , args []string ) error {
76
67
options .name = args [0 ]
77
68
return runAdd (curveadm , options )
@@ -82,7 +73,7 @@ func NewAddCommand(curveadm *cli.CurveAdm) *cobra.Command {
82
73
flags := cmd .Flags ()
83
74
flags .StringVarP (& options .description , "description" , "m" , "" , "Description for cluster" )
84
75
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
+
86
77
return cmd
87
78
}
88
79
@@ -143,19 +134,6 @@ func checkTopology(curveadm *cli.CurveAdm, data string, options addOptions) erro
143
134
return pb .Run ()
144
135
}
145
136
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
-
159
137
func runAdd (curveadm * cli.CurveAdm , options addOptions ) error {
160
138
// 1) check wether cluster already exist
161
139
name := options .name
@@ -185,7 +163,7 @@ func runAdd(curveadm *cli.CurveAdm, options addOptions) error {
185
163
186
164
// 4) insert cluster (with topology) into database
187
165
uuid := uuid .NewString ()
188
- err = storage .InsertCluster (name , uuid , options .description , data , options . deployType )
166
+ err = storage .InsertCluster (name , uuid , options .description , data )
189
167
if err != nil {
190
168
return errno .ERR_INSERT_CLUSTER_FAILED .E (err )
191
169
}
0 commit comments