Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit bfc7ff2

Browse files
author
Federico Guerinoni
committed
Remove dead code
Signed-off-by: Federico Guerinoni <guerra@develer.com>
1 parent bd909cd commit bfc7ff2

File tree

2 files changed

+6
-60
lines changed

2 files changed

+6
-60
lines changed

install.go

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@ import (
3535
"net"
3636
"net/http"
3737
"os"
38+
"os/exec"
3839
"path/filepath"
3940
"strings"
4041
"time"
4142

4243
"github.com/arduino/arduino-connector/auth"
43-
"github.com/docker/docker/api/types"
44-
docker "github.com/docker/docker/client"
4544
mqtt "github.com/eclipse/paho.mqtt.golang"
4645
"github.com/facchinm/service"
4746
"github.com/kardianos/osext"
@@ -106,45 +105,13 @@ func createConfigFolder() error {
106105
return nil
107106
}
108107

109-
func retrieveDockerImages() ([]string, error) {
110-
imageListOptions := types.ImageListOptions{All: true}
111-
112-
cli, err := docker.NewClientWithOpts(docker.WithVersion("1.38"))
113-
if err != nil {
114-
return []string{}, err
115-
}
116-
117-
images, err := cli.ImageList(context.Background(), imageListOptions)
118-
if err != nil {
119-
return []string{}, err
108+
func isDockerInstalled() (bool, error) {
109+
_, err := exec.LookPath("docker")
110+
if err == nil {
111+
return true, nil
120112
}
121113

122-
imgs := []string{}
123-
for _, v := range images {
124-
imgs = append(imgs, v.RepoTags[0])
125-
}
126-
return imgs, nil
127-
}
128-
129-
func retrieveDockerContainer() ([]string, error) {
130-
cli, err := docker.NewClientWithOpts(docker.WithVersion("1.38"))
131-
if err != nil {
132-
return []string{}, err
133-
}
134-
135-
containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{All: true})
136-
if err != nil {
137-
return []string{}, err
138-
}
139-
140-
cs := []string{}
141-
for _, v := range containers {
142-
cs = append(cs, v.ID)
143-
}
144-
145-
fmt.Println("containers when create config: ", cs)
146-
147-
return cs, nil
114+
return false, nil
148115
}
149116

150117
func isNetManagerInstalled() bool {

install_test.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -364,28 +364,13 @@ func connectTestClient(crtPath, keyPath string) (mqtt.Client, error) {
364364
return mqttClient, nil
365365
}
366366

367-
func isDockerInstalled() (bool, error) {
368-
_, err := exec.LookPath("docker")
369-
if err == nil {
370-
return true, nil
371-
}
372-
373-
return false, nil
374-
}
375-
376367
func TestInstallDocker(t *testing.T) {
377368
checkAndInstallDocker()
378369
installed, err := isDockerInstalled()
379370
assert.True(t, err == nil)
380371
assert.True(t, installed)
381372
}
382373

383-
func isNetManagerInstalled() bool {
384-
cmd := exec.Command("bash", "-c", "dpkg --get-selections | grep network-manager")
385-
out, _ := cmd.CombinedOutput()
386-
return !strings.Contains(string(out), "deinstall") && len(out) != 0
387-
}
388-
389374
func TestInstallNetworkManager(t *testing.T) {
390375
assert.False(t, isNetManagerInstalled())
391376
checkAndInstallNetworkManager()
@@ -399,12 +384,6 @@ func TestInstallNetworkManager(t *testing.T) {
399384
assert.True(t, isNetManagerInstalled())
400385
}
401386

402-
func TestInstallUbuntuDockerPath(t *testing.T) {
403-
value, err := isDockerInstalled()
404-
assert.False(t, value)
405-
assert.True(t, err == nil)
406-
}
407-
408387
func TestInstallAlpineDockerPath(t *testing.T) {
409388
value, err := isDockerInstalled()
410389
assert.True(t, value)

0 commit comments

Comments
 (0)