Merge "ELIOT-UI Portal Backend Code Added"
[eliot.git] / blueprints / common / elcli / elcli / cmd / clean.go
1 /*
2 Package cmd
3 Copyright © 2019 NAME HERE <EMAIL ADDRESS>
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 */
17
18 package cmd
19
20 import (
21         "fmt"
22
23         "github.com/spf13/cobra"
24         "elcli/cmd/util"
25 )
26
27 var (
28         elcliCleanCmdLongDescription =
29         `
30         +-------------------------------------------------+
31         | To complete cleanup execute this command. The   |
32         | command will remove all the configurations,     |
33         | clear up ports used by ELIOT cluster & uninstall|
34         | all software.                                   |
35         +-------------------------------------------------|
36         `
37         elcliCleanExample = `
38         +-------------------------------------------------+
39         | elcli clean                                     |
40         +-------------------------------------------------+
41         `
42 )
43
44 // cleanCmd represents the clean command
45 var cleanCmd = &cobra.Command{
46         Use:   "clean",
47         Short: "ELIOT Cluster Uninstall",
48         Long:  elcliCleanCmdLongDescription,
49         Example: elcliCleanExample,
50         RunE: func(cmd *cobra.Command, args []string) error{
51                 fmt.Println("clean called")
52                 err := util.EliotClean()        
53                 str:= util.GetOSVersion()
54                 fmt.Println("Print value of GetOSVersion %s", str)
55
56                 if(err != nil) {
57                         return err
58                 }
59                 return nil              
60         },
61 }
62
63 func init() {
64         rootCmd.AddCommand(cleanCmd)
65 }