8000 (WIP) stage1: app exit code propagated to rkt exit code by alban · Pull Request #1783 · rkt/rkt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

(WIP) stage1: app exit code propagated to rkt exit code #1783

8000
Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 3 additions & 31 deletions stage1/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ import (
"github.com/coreos/rkt/Godeps/_workspace/src/github.com/appc/goaci/proj2aci"
"github.com/coreos/rkt/Godeps/_workspace/src/github.com/appc/spec/schema/types"
"github.com/coreos/rkt/Godeps/_workspace/src/github.com/coreos/go-systemd/util"
"github.com/coreos/rkt/Godeps/_workspace/src/github.com/godbus/dbus"
"github.com/coreos/rkt/Godeps/_workspace/src/github.com/godbus/dbus/introspect"

stage1common "github.com/coreos/rkt/stage1/common"
stage1commontypes "github.com/coreos/rkt/stage1/common/types"
Expand Down Expand Up @@ -123,35 +121,9 @@ func init() {

// machinedRegister checks if nspawn should register the pod to machined
func machinedRegister() bool {
// machined has a D-Bus interface following versioning guidelines, see:
// http://www.freedesktop.org/wiki/Software/systemd/machined/
// Therefore we can just check if the D-Bus method we need exists and we
// don't need to check the signature.
var found int

conn, err := dbus.SystemBus()
if err != nil {
return false
}
node, err := introspect.Call(conn.Object("org.freedesktop.machine1", "/org/freedesktop/machine1"))
if err != nil {
return false
}
for _, iface := range node.Interfaces {
if iface.Name != "org.freedesktop.machine1.Manager" {
continue
}
// machined v215 supports methods "RegisterMachine" and "CreateMachine" called by nspawn v215.
// machined v216+ (since commit 5aa4bb) additionally supports methods "CreateMachineWithNetwork"
// and "RegisterMachineWithNetwork", called by nspawn v216+.
for _, method := range iface.Methods {
if method.Name == "CreateMachineWithNetwork" || method.Name == "RegisterMachineWithNetwork" {
found++
}
}
break
}
return found == 2
// Disable registration. See:
// https://github.com/coreos/rkt/issues/1782
return false
}

func lookupPath(bin string, paths string) (string, error) {
Expand Down
3 changes: 3 additions & 0 deletions stage1/reaper/reaper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ if [ $# -eq 1 ]; then
app=$1
status=$(${SYSCTL} show --property ExecMainStatus "${app}.service")
echo "${status#*=}" > "/rkt/status/$app"
if [ "${status#*=}" != 0 ] ; then
${SYSCTL} exit ${status#*=}
fi
exit 0
fi
2 changes: 1 addition & 1 deletion stage1/units/units/shutdown.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ DefaultDependencies=false

[Service]
RemainAfterExit=yes
ExecStop=/usr/bin/systemctl halt --force
ExecStop=/usr/bin/systemctl exit --force
0