summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/containers.go12
-rw-r--r--pkg/api/handlers/utils/containers.go2
-rw-r--r--pkg/domain/infra/abi/play.go4
-rw-r--r--pkg/machine/pull.go2
-rw-r--r--pkg/specgen/generate/kube/kube.go2
-rw-r--r--pkg/systemd/generate/common_test.go4
-rw-r--r--pkg/util/filters.go2
7 files changed, 17 insertions, 11 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index e7146a5d8..d97a4d3bd 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -26,6 +26,7 @@ import (
"github.com/docker/go-units"
"github.com/gorilla/schema"
"github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
)
func RemoveContainer(w http.ResponseWriter, r *http.Request) {
@@ -148,14 +149,19 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
containers = containers[:query.Limit]
}
}
- var list = make([]*handlers.Container, len(containers))
- for i, ctnr := range containers {
+ list := make([]*handlers.Container, 0, len(containers))
+ for _, ctnr := range containers {
api, err := LibpodToContainer(ctnr, query.Size)
if err != nil {
+ if errors.Cause(err) == define.ErrNoSuchCtr {
+ // container was removed between the initial fetch of the list and conversion
+ logrus.Debugf("Container %s removed between initial fetch and conversion, ignoring in output", ctnr.ID())
+ continue
+ }
utils.InternalServerError(w, err)
return
}
- list[i] = api
+ list = append(list, api)
}
utils.WriteResponse(w, http.StatusOK, list)
}
diff --git a/pkg/api/handlers/utils/containers.go b/pkg/api/handlers/utils/containers.go
index 91e02abf1..c4c9cc2ea 100644
--- a/pkg/api/handlers/utils/containers.go
+++ b/pkg/api/handlers/utils/containers.go
@@ -76,7 +76,7 @@ func WaitContainerDocker(w http.ResponseWriter, r *http.Request) {
exitCode, err := waitDockerCondition(ctx, name, interval, condition)
msg := ""
if err != nil {
- logrus.Errorf("error while waiting on condtion: %q", err)
+ logrus.Errorf("error while waiting on condition: %q", err)
msg = err.Error()
}
responseData := handlers.ContainerWaitOKBody{
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index 4a13a8029..6ddd4a042 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -428,7 +428,7 @@ func readConfigMapFromFile(r io.Reader) (v1.ConfigMap, error) {
return cm, nil
}
-// splitMultiDocYAML reads mutiple documents in a YAML file and
+// splitMultiDocYAML reads multiple documents in a YAML file and
// returns them as a list.
func splitMultiDocYAML(yamlContent []byte) ([][]byte, error) {
var documentList [][]byte
@@ -471,7 +471,7 @@ func getKubeKind(obj []byte) (string, error) {
}
// sortKubeKinds adds the correct creation order for the kube kinds.
-// Any pod dependecy will be created first like volumes, secrets, etc.
+// Any pod dependency will be created first like volumes, secrets, etc.
func sortKubeKinds(documentList [][]byte) ([][]byte, error) {
var sortedDocumentList [][]byte
diff --git a/pkg/machine/pull.go b/pkg/machine/pull.go
index 41abe6993..d9f34057f 100644
--- a/pkg/machine/pull.go
+++ b/pkg/machine/pull.go
@@ -170,7 +170,7 @@ func Decompress(localPath, uncompressedPath string) error {
// Will error out if file without .xz already exists
// Maybe extracting then renameing is a good idea here..
-// depends on xz: not pre-installed on mac, so it becomes a brew dependecy
+// depends on xz: not pre-installed on mac, so it becomes a brew dependency
func decompressXZ(src string, output io.Writer) error {
fmt.Println("Extracting compressed file")
cmd := exec.Command("xzcat", "-k", src)
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go
index 7aeec9d41..1347ed1e0 100644
--- a/pkg/specgen/generate/kube/kube.go
+++ b/pkg/specgen/generate/kube/kube.go
@@ -56,7 +56,7 @@ func ToPodGen(ctx context.Context, podName string, podYAML *v1.PodTemplateSpec)
}
p.DNSServer = servers
}
- // search domans
+ // search domains
if domains := dnsConfig.Searches; len(domains) > 0 {
p.DNSSearch = domains
}
diff --git a/pkg/systemd/generate/common_test.go b/pkg/systemd/generate/common_test.go
index 30e758127..fdcc9d21b 100644
--- a/pkg/systemd/generate/common_test.go
+++ b/pkg/systemd/generate/common_test.go
@@ -199,8 +199,8 @@ func TestEscapeSystemdArguments(t *testing.T) {
[]string{"foo", `"command with backslash \\"`},
},
{
- []string{"foo", `command with two backslashs \\`},
- []string{"foo", `"command with two backslashs \\\\"`},
+ []string{"foo", `command with two backslashes \\`},
+ []string{"foo", `"command with two backslashes \\\\"`},
},
}
diff --git a/pkg/util/filters.go b/pkg/util/filters.go
index 43bf646f1..e252c1ddf 100644
--- a/pkg/util/filters.go
+++ b/pkg/util/filters.go
@@ -94,7 +94,7 @@ func PrepareFilters(r *http.Request) (*map[string][]string, error) {
return &filterMap, nil
}
-// MatchLabelFilters matches labels and returs true if they are valid
+// MatchLabelFilters matches labels and returns true if they are valid
func MatchLabelFilters(filterValues []string, labels map[string]string) bool {
outer:
for _, filterValue := range filterValues {