2 Copyright 2019 The Kubeedge Authors.
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
8 http://www.apache.org/licenses/LICENSE-2.0
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.
22 types "elcli/cmd/common"
25 //DockerInstTool embedes Common struct and contains the default docker version
26 //It implements ToolsInstaller interface
27 type DockerInstTool struct {
32 //InstallTools sets the OS interface, checks if docker installation is required or not.
33 //If required then install the said version.
34 func (d *DockerInstTool) InstallTools() error {
35 d.SetOSInterface(GetOSInterface())
36 d.SetDockerVersion(d.ToolVersion)
38 action, err := d.IsDockerInstalled(d.DefaultToolVer)
43 case types.VersionNAInRepo:
44 return fmt.Errorf("Expected Docker version is not available in OS repo")
45 case types.AlreadySameVersionExist:
46 fmt.Println("Same version of docker already installed in this host")
48 case types.DefVerInstallRequired:
49 d.SetDockerVersion(d.DefaultToolVer)
51 case types.NewInstallRequired:
52 err := d.InstallDocker()
57 return fmt.Errorf("Error in getting the docker version from host")
63 //TearDown shoud uninstall docker, but it is not required either for cloud or edge node.
64 //It is defined so that DockerInstTool implements ToolsInstaller interface
65 func (d *DockerInstTool) TearDown() error {