summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/bindings/system/system.go12
-rw-r--r--pkg/domain/infra/tunnel/containers.go23
-rw-r--r--pkg/varlinkapi/system.go2
3 files changed, 26 insertions, 11 deletions
diff --git a/pkg/bindings/system/system.go b/pkg/bindings/system/system.go
index e567e7a86..ed960b8e0 100644
--- a/pkg/bindings/system/system.go
+++ b/pkg/bindings/system/system.go
@@ -112,12 +112,12 @@ func Version(ctx context.Context) (*entities.SystemVersionReport, error) {
f, _ := strconv.ParseFloat(component.APIVersion, 64)
b, _ := time.Parse(time.RFC3339, component.BuildTime)
report.Server = &define.Version{
- RemoteAPIVersion: int64(f),
- Version: component.Version.Version,
- GoVersion: component.GoVersion,
- GitCommit: component.GitCommit,
- Built: b.Unix(),
- OsArch: fmt.Sprintf("%s/%s", component.Os, component.Arch),
+ APIVersion: int64(f),
+ Version: component.Version.Version,
+ GoVersion: component.GoVersion,
+ GitCommit: component.GitCommit,
+ Built: b.Unix(),
+ OsArch: fmt.Sprintf("%s/%s", component.Os, component.Arch),
}
return &report, err
}
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go
index a031b740e..30c4a8359 100644
--- a/pkg/domain/infra/tunnel/containers.go
+++ b/pkg/domain/infra/tunnel/containers.go
@@ -87,10 +87,25 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
}
for _, c := range ctrs {
report := entities.StopReport{Id: c.ID}
- report.Err = containers.Stop(ic.ClientCxt, c.ID, &options.Timeout)
- // TODO we need to associate errors returned by http with common
- // define.errors so that we can equity tests. this will allow output
- // to be the same as the native client
+ if err = containers.Stop(ic.ClientCxt, c.ID, &options.Timeout); err != nil {
+ // These first two are considered non-fatal under the right conditions
+ if errors.Cause(err).Error() == define.ErrCtrStopped.Error() {
+ logrus.Debugf("Container %s is already stopped", c.ID)
+ reports = append(reports, &report)
+ continue
+ } else if options.All && errors.Cause(err).Error() == define.ErrCtrStateInvalid.Error() {
+ logrus.Debugf("Container %s is not running, could not stop", c.ID)
+ reports = append(reports, &report)
+ continue
+ }
+
+ // TODO we need to associate errors returned by http with common
+ // define.errors so that we can equity tests. this will allow output
+ // to be the same as the native client
+ report.Err = err
+ reports = append(reports, &report)
+ continue
+ }
reports = append(reports, &report)
}
return reports, nil
diff --git a/pkg/varlinkapi/system.go b/pkg/varlinkapi/system.go
index 82efe9b5d..308f02274 100644
--- a/pkg/varlinkapi/system.go
+++ b/pkg/varlinkapi/system.go
@@ -28,7 +28,7 @@ func (i *VarlinkAPI) GetVersion(call iopodman.VarlinkCall) error {
versionInfo.GitCommit,
time.Unix(versionInfo.Built, 0).Format(time.RFC3339),
versionInfo.OsArch,
- versionInfo.RemoteAPIVersion,
+ versionInfo.APIVersion,
)
}