Config file extra parameters removed
[ealt-edge.git] / ocd / cli / ealt / cmd / init / mecm.go
1 /*
2 Copyright 2020 Huawei Technologies Co., Ltd.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8     http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16 package init
17
18 import (
19         "ealt/cmd/setup"
20         "strings"
21
22         "github.com/spf13/cobra"
23 )
24
25 // allCmd represents the all command
26 func NewMecmCommand() *cobra.Command {
27         var cmd = &cobra.Command{
28                 Use:   "manager",
29                 Short: "Command to install MECM Controller",
30                 Long:  `Command to Install MECM Controller Node`,
31                 RunE: func(cmd *cobra.Command, args []string) error {
32                         setupModeFlag := strings.ToLower(cmd.Flag("mode").Value.String())
33                         var err error
34                         if setupModeFlag == "dev" {
35                                 err = setup.EaltInstall("mecm")
36                         } else if setupModeFlag == "prod" {
37                                 err = setup.EaltInstall("sslmecm")
38                         }
39                         if err != nil {
40                                 return err
41                         }
42                         return nil
43                 },
44         }
45         cmd.Flags().StringP("mode", "m", "dev", "Deployment Mode")
46         return cmd
47 }