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.go29
-rw-r--r--pkg/network/netconflist.go9
-rw-r--r--pkg/varlinkapi/system.go2
4 files changed, 36 insertions, 16 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 d02c54e76..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
@@ -357,7 +372,11 @@ func startAndAttach(ic *ContainerEngine, name string, detachKeys *string, input,
func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []string, options entities.ContainerStartOptions) ([]*entities.ContainerStartReport, error) {
var reports []*entities.ContainerStartReport
for _, name := range namesOrIds {
- report := entities.ContainerStartReport{Id: name}
+ report := entities.ContainerStartReport{
+ Id: name,
+ RawInput: name,
+ ExitCode: 125,
+ }
if options.Attach {
report.Err = startAndAttach(ic, name, &options.DetachKeys, options.Stdin, options.Stdout, options.Stderr)
if report.Err == nil {
diff --git a/pkg/network/netconflist.go b/pkg/network/netconflist.go
index 34ff00024..4271d3f54 100644
--- a/pkg/network/netconflist.go
+++ b/pkg/network/netconflist.go
@@ -21,10 +21,11 @@ func NewNcList(name, version string) NcList {
// NewHostLocalBridge creates a new LocalBridge for host-local
func NewHostLocalBridge(name string, isGateWay, isDefaultGW, ipMasq bool, ipamConf IPAMHostLocalConf) *HostLocalBridge {
hostLocalBridge := HostLocalBridge{
- PluginType: "bridge",
- BrName: name,
- IPMasq: ipMasq,
- IPAM: ipamConf,
+ PluginType: "bridge",
+ BrName: name,
+ IPMasq: ipMasq,
+ HairpinMode: true,
+ IPAM: ipamConf,
}
if isGateWay {
hostLocalBridge.IsGW = true
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,
)
}