summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--API.md2
-rw-r--r--Makefile2
-rw-r--r--cmd/podman/common.go4
-rw-r--r--cmd/podman/create.go8
-rw-r--r--cmd/podman/run.go2
-rw-r--r--cmd/podman/shared/create.go13
-rw-r--r--cmd/podman/shared/intermediate.go1
-rw-r--r--cmd/podman/shared/intermediate_varlink.go2
-rw-r--r--cmd/podman/utils.go2
-rw-r--r--cmd/podman/varlink/io.podman.varlink1
-rw-r--r--docs/source/markdown/podman-create.1.md2
-rw-r--r--docs/source/markdown/podman-run.1.md2
-rw-r--r--pkg/api/server/server.go36
-rw-r--r--pkg/systemdgen/systemdgen.go4
-rw-r--r--pkg/systemdgen/systemdgen_test.go4
-rw-r--r--test/e2e/generate_systemd_test.go2
-rw-r--r--test/e2e/run_signal_test.go2
17 files changed, 39 insertions, 50 deletions
diff --git a/API.md b/API.md
index ca71fdf9e..cfbe394de 100644
--- a/API.md
+++ b/API.md
@@ -1587,8 +1587,6 @@ memorySwappiness [?int](#?int)
name [?string](#?string)
-net [?string](#?string)
-
network [?string](#?string)
noHosts [?bool](#?bool)
diff --git a/Makefile b/Makefile
index 62ed1e21f..dabfc65dd 100644
--- a/Makefile
+++ b/Makefile
@@ -322,7 +322,7 @@ system.test-binary: .install.ginkgo
vagrant-check:
BOX=$(BOX) sh ./vagrant.sh
-binaries: varlink_generate podman podman-remote ## Build podman
+binaries: varlink_generate podman podman-remote service ## Build podman
install.catatonit:
./hack/install_catatonit.sh
diff --git a/cmd/podman/common.go b/cmd/podman/common.go
index 9064ec219..8690be64f 100644
--- a/cmd/podman/common.go
+++ b/cmd/podman/common.go
@@ -376,10 +376,6 @@ func getCreateFlags(c *cliconfig.PodmanCommand) {
"Assign a name to the container",
)
createFlags.String(
- "net", getDefaultNetwork(),
- "Connect a container to a network",
- )
- createFlags.String(
"network", getDefaultNetwork(),
"Connect a container to a network",
)
diff --git a/cmd/podman/create.go b/cmd/podman/create.go
index 73fba5a8c..01cad9765 100644
--- a/cmd/podman/create.go
+++ b/cmd/podman/create.go
@@ -85,13 +85,7 @@ func createInit(c *cliconfig.PodmanCommand) error {
logrus.Warn("setting security options with --privileged has no effect")
}
- var setNet string
- if c.IsSet("network") {
- setNet = c.String("network")
- } else if c.IsSet("net") {
- setNet = c.String("net")
- }
- if (c.IsSet("dns") || c.IsSet("dns-opt") || c.IsSet("dns-search")) && (setNet == "none" || strings.HasPrefix(setNet, "container:")) {
+ if (c.IsSet("dns") || c.IsSet("dns-opt") || c.IsSet("dns-search")) && (c.String("network") == "none" || strings.HasPrefix(c.String("network"), "container:")) {
return errors.Errorf("conflicting options: dns and the network mode.")
}
diff --git a/cmd/podman/run.go b/cmd/podman/run.go
index a6468f225..caa594682 100644
--- a/cmd/podman/run.go
+++ b/cmd/podman/run.go
@@ -25,7 +25,7 @@ var (
return runCmd(&runCommand)
},
Example: `podman run imageID ls -alF /etc
- podman run --net=host imageID dnf -y install java
+ podman run --network=host imageID dnf -y install java
podman run --volume /var/hostdir:/var/ctrdir -i -t fedora /bin/bash`,
}
)
diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go
index 50a64b01c..15d6bddbb 100644
--- a/cmd/podman/shared/create.go
+++ b/cmd/podman/shared/create.go
@@ -355,14 +355,10 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
// Instead of integrating here, should be done in libpod
// However, that also involves setting up security opts
// when the pod's namespace is integrated
- namespaceNet := c.String("network")
- if c.Changed("net") {
- namespaceNet = c.String("net")
- }
namespaces = map[string]string{
"cgroup": c.String("cgroupns"),
"pid": c.String("pid"),
- "net": namespaceNet,
+ "net": c.String("network"),
"ipc": c.String("ipc"),
"user": c.String("userns"),
"uts": c.String("uts"),
@@ -636,11 +632,6 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
}
// This is done because cobra cannot have two aliased flags. So we have to check
// both
- network := c.String("network")
- if c.Changed("net") {
- network = c.String("net")
- }
-
memorySwappiness := c.Int64("memory-swappiness")
logDriver := libpod.KubernetesLogging
@@ -687,7 +678,7 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
DNSServers: c.StringSlice("dns"),
HTTPProxy: c.Bool("http-proxy"),
MacAddress: c.String("mac-address"),
- Network: network,
+ Network: c.String("network"),
NetMode: netMode,
IPAddress: c.String("ip"),
Publish: c.StringSlice("publish"),
diff --git a/cmd/podman/shared/intermediate.go b/cmd/podman/shared/intermediate.go
index d1f0e602e..cfb3f612c 100644
--- a/cmd/podman/shared/intermediate.go
+++ b/cmd/podman/shared/intermediate.go
@@ -423,7 +423,6 @@ func NewIntermediateLayer(c *cliconfig.PodmanCommand, remote bool) GenericCLIRes
m["memory-swap"] = newCRString(c, "memory-swap")
m["memory-swappiness"] = newCRInt64(c, "memory-swappiness")
m["name"] = newCRString(c, "name")
- m["net"] = newCRString(c, "net")
m["network"] = newCRString(c, "network")
m["no-hosts"] = newCRBool(c, "no-hosts")
m["oom-kill-disable"] = newCRBool(c, "oom-kill-disable")
diff --git a/cmd/podman/shared/intermediate_varlink.go b/cmd/podman/shared/intermediate_varlink.go
index 89bd52324..691c4f92d 100644
--- a/cmd/podman/shared/intermediate_varlink.go
+++ b/cmd/podman/shared/intermediate_varlink.go
@@ -127,7 +127,6 @@ func (g GenericCLIResults) MakeVarlink() iopodman.Create {
MemorySwap: StringToPtr(g.Find("memory-swap")),
MemorySwappiness: AnyIntToInt64Ptr(g.Find("memory-swappiness")),
Name: StringToPtr(g.Find("name")),
- Net: StringToPtr(g.Find("net")),
Network: StringToPtr(g.Find("network")),
OomKillDisable: BoolToPtr(g.Find("oom-kill-disable")),
OomScoreAdj: AnyIntToInt64Ptr(g.Find("oom-score-adj")),
@@ -386,7 +385,6 @@ func VarlinkCreateToGeneric(opts iopodman.Create) GenericCLIResults {
m["memory-swap"] = stringFromVarlink(opts.MemorySwap, "memory-swap", nil)
m["memory-swappiness"] = int64FromVarlink(opts.MemorySwappiness, "memory-swappiness", &memSwapDefault)
m["name"] = stringFromVarlink(opts.Name, "name", nil)
- m["net"] = stringFromVarlink(opts.Net, "net", &netModeDefault)
m["network"] = stringFromVarlink(opts.Network, "network", &netModeDefault)
m["no-hosts"] = boolFromVarlink(opts.NoHosts, "no-hosts", false)
m["oom-kill-disable"] = boolFromVarlink(opts.OomKillDisable, "oon-kill-disable", false)
diff --git a/cmd/podman/utils.go b/cmd/podman/utils.go
index 21389b43a..44e65b223 100644
--- a/cmd/podman/utils.go
+++ b/cmd/podman/utils.go
@@ -61,6 +61,8 @@ func aliasFlags(f *pflag.FlagSet, name string) pflag.NormalizedName {
name = "health-start-period"
case "healthcheck-timeout":
name = "health-timeout"
+ case "net":
+ name = "network"
}
return pflag.NormalizedName(name)
}
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index b993457ca..a0227c48c 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -350,7 +350,6 @@ type Create (
memorySwap: ?string,
memorySwappiness: ?int,
name: ?string,
- net: ?string,
network: ?string,
noHosts: ?bool,
oomKillDisable: ?bool,
diff --git a/docs/source/markdown/podman-create.1.md b/docs/source/markdown/podman-create.1.md
index 81fae0b25..0236e30ba 100644
--- a/docs/source/markdown/podman-create.1.md
+++ b/docs/source/markdown/podman-create.1.md
@@ -1014,7 +1014,7 @@ In order for users to run rootless, there must be an entry for their username in
Rootless Podman works better if the fuse-overlayfs and slirp4netns packages are installed.
The fuse-overlay package provides a userspace overlay storage driver, otherwise users need to use
the vfs storage driver, which is diskspace expensive and does not perform well. slirp4netns is
-required for VPN, without it containers need to be run with the --net=host flag.
+required for VPN, without it containers need to be run with the --network=host flag.
## ENVIRONMENT
diff --git a/docs/source/markdown/podman-run.1.md b/docs/source/markdown/podman-run.1.md
index af5bb814d..f613e6668 100644
--- a/docs/source/markdown/podman-run.1.md
+++ b/docs/source/markdown/podman-run.1.md
@@ -1310,7 +1310,7 @@ In order for users to run rootless, there must be an entry for their username in
Rootless Podman works better if the fuse-overlayfs and slirp4netns packages are installed.
The fuse-overlay package provides a userspace overlay storage driver, otherwise users need to use
the vfs storage driver, which is diskspace expensive and does not perform well. slirp4netns is
-required for VPN, without it containers need to be run with the --net=host flag.
+required for VPN, without it containers need to be run with the --network=host flag.
## ENVIRONMENT
diff --git a/pkg/api/server/server.go b/pkg/api/server/server.go
index 717c7a876..2bda5ad01 100644
--- a/pkg/api/server/server.go
+++ b/pkg/api/server/server.go
@@ -36,6 +36,7 @@ import (
"os"
"os/signal"
"strings"
+ "syscall"
"time"
"github.com/containers/libpod/libpod"
@@ -43,7 +44,7 @@ import (
"github.com/gorilla/mux"
"github.com/gorilla/schema"
"github.com/pkg/errors"
- log "github.com/sirupsen/logrus"
+ "github.com/sirupsen/logrus"
)
type APIServer struct {
@@ -67,9 +68,6 @@ func NewServer(runtime *libpod.Runtime) (*APIServer, error) {
return nil, errors.Errorf("Wrong number of file descriptors from systemd for socket activation (%d != 1)", len(listeners))
}
- quit := make(chan os.Signal, 1)
- signal.Notify(quit)
-
router := mux.NewRouter()
server := APIServer{
@@ -88,7 +86,7 @@ func NewServer(runtime *libpod.Runtime) (*APIServer, error) {
}
server.Timer = time.AfterFunc(server.Duration, func() {
if err := server.Shutdown(); err != nil {
- log.Errorf("unable to shutdown server: %q", err)
+ logrus.Errorf("unable to shutdown server: %q", err)
}
})
@@ -106,7 +104,7 @@ func NewServer(runtime *libpod.Runtime) (*APIServer, error) {
router.NotFoundHandler = http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
// We can track user errors...
- log.Infof("Failed Request: (%d:%s) for %s:'%s'", http.StatusNotFound, http.StatusText(http.StatusNotFound), r.Method, r.URL.String())
+ logrus.Infof("Failed Request: (%d:%s) for %s:'%s'", http.StatusNotFound, http.StatusText(http.StatusNotFound), r.Method, r.URL.String())
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
},
)
@@ -132,7 +130,7 @@ func NewServer(runtime *libpod.Runtime) (*APIServer, error) {
}
}
- if log.IsLevelEnabled(log.DebugLevel) {
+ if logrus.IsLevelEnabled(logrus.DebugLevel) {
router.Walk(func(route *mux.Route, r *mux.Router, ancestors []*mux.Route) error { // nolint
path, err := route.GetPathTemplate()
if err != nil {
@@ -142,7 +140,7 @@ func NewServer(runtime *libpod.Runtime) (*APIServer, error) {
if err != nil {
methods = []string{}
}
- log.Debugf("Methods: %s Path: %s", strings.Join(methods, ", "), path)
+ logrus.Debugf("Methods: %s Path: %s", strings.Join(methods, ", "), path)
return nil
})
}
@@ -154,9 +152,23 @@ func NewServer(runtime *libpod.Runtime) (*APIServer, error) {
func (s *APIServer) Serve() error {
defer s.CancelFunc()
- err := s.Server.Serve(s.Listener)
- if err != nil && err != http.ErrServerClosed {
- return errors.Wrap(err, "Failed to start APIServer")
+ sigChan := make(chan os.Signal, 1)
+ signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
+ errChan := make(chan error, 1)
+
+ go func() {
+ err := s.Server.Serve(s.Listener)
+ if err != nil && err != http.ErrServerClosed {
+ errChan <- errors.Wrap(err, "Failed to start APIServer")
+ }
+ errChan <- nil
+ }()
+
+ select {
+ case err := <-errChan:
+ return err
+ case sig := <-sigChan:
+ logrus.Infof("APIServer terminated by signal %v", sig)
}
return nil
@@ -174,7 +186,7 @@ func (s *APIServer) Shutdown() error {
go func() {
err := s.Server.Shutdown(s.Context)
if err != nil && err != context.Canceled {
- log.Errorf("Failed to cleanly shutdown APIServer: %s", err.Error())
+ logrus.Errorf("Failed to cleanly shutdown APIServer: %s", err.Error())
}
}()
diff --git a/pkg/systemdgen/systemdgen.go b/pkg/systemdgen/systemdgen.go
index b6167a23e..745b708e4 100644
--- a/pkg/systemdgen/systemdgen.go
+++ b/pkg/systemdgen/systemdgen.go
@@ -96,8 +96,8 @@ Restart={{.RestartPolicy}}
{{- if .New}}
ExecStartPre=/usr/bin/rm -f /%t/%n-pid /%t/%n-cid
ExecStart={{.RunCommand}}
-ExecStop={{.Executable}} stop --cidfile /%t/%n-cid {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}}
-ExecStopPost={{.Executable}} rm -f --cidfile /%t/%n-cid
+ExecStop={{.Executable}} stop --ignore --cidfile /%t/%n-cid {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}}
+ExecStopPost={{.Executable}} rm --ignore -f --cidfile /%t/%n-cid
PIDFile=/%t/%n-pid
{{- else}}
ExecStart={{.Executable}} start {{.ContainerName}}
diff --git a/pkg/systemdgen/systemdgen_test.go b/pkg/systemdgen/systemdgen_test.go
index 3894a0205..9c6933d17 100644
--- a/pkg/systemdgen/systemdgen_test.go
+++ b/pkg/systemdgen/systemdgen_test.go
@@ -123,8 +123,8 @@ Documentation=man:podman-generate-systemd(1)
Restart=always
ExecStartPre=/usr/bin/rm -f /%t/%n-pid /%t/%n-cid
ExecStart=/usr/bin/podman run --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN
-ExecStop=/usr/bin/podman stop --cidfile /%t/%n-cid -t 42
-ExecStopPost=/usr/bin/podman rm -f --cidfile /%t/%n-cid
+ExecStop=/usr/bin/podman stop --ignore --cidfile /%t/%n-cid -t 42
+ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile /%t/%n-cid
PIDFile=/%t/%n-pid
KillMode=none
Type=forking
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go
index f0fef41a4..d0dadd09d 100644
--- a/test/e2e/generate_systemd_test.go
+++ b/test/e2e/generate_systemd_test.go
@@ -191,7 +191,7 @@ var _ = Describe("Podman generate systemd", func() {
found, _ := session.GrepString("# container-foo.service")
Expect(found).To(BeTrue())
- found, _ = session.GrepString("stop --cidfile /%t/%n-cid -t 42")
+ found, _ = session.GrepString("stop --ignore --cidfile /%t/%n-cid -t 42")
Expect(found).To(BeTrue())
})
diff --git a/test/e2e/run_signal_test.go b/test/e2e/run_signal_test.go
index eee7c14fb..fbdd3acec 100644
--- a/test/e2e/run_signal_test.go
+++ b/test/e2e/run_signal_test.go
@@ -132,7 +132,7 @@ var _ = Describe("Podman run with --sig-proxy", func() {
Expect(killSession.ExitCode()).To(Equal(0))
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(137))
+ Expect(session.ExitCode()).ToNot(Equal(0))
ok, _ = session.GrepString("Received")
Expect(ok).To(BeFalse())
})