summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--cmd/podman/build.go2
-rw-r--r--cmd/podman/cliconfig/config.go14
-rw-r--r--cmd/podman/commands.go2
-rw-r--r--cmd/podman/common.go2
-rw-r--r--cmd/podman/container.go4
-rw-r--r--cmd/podman/errors_remote.go2
-rw-r--r--cmd/podman/generate.go1
-rw-r--r--cmd/podman/generate_systemd.go70
-rw-r--r--cmd/podman/init.go64
-rw-r--r--cmd/podman/main.go2
-rw-r--r--cmd/podman/port.go35
-rw-r--r--cmd/podman/search.go13
-rw-r--r--cmd/podman/shared/create.go5
-rw-r--r--cmd/podman/shared/workers.go5
-rw-r--r--cmd/podman/varlink/io.podman.varlink17
-rw-r--r--commands.md3
-rw-r--r--completions/bash/podman52
-rwxr-xr-xcontrib/cirrus/build_vm_images.sh20
-rwxr-xr-xcontrib/cirrus/integration_test.sh10
-rw-r--r--contrib/cirrus/lib.sh87
-rwxr-xr-xcontrib/cirrus/lib.sh.t81
-rw-r--r--contrib/cirrus/packer/centos_setup.sh7
-rw-r--r--contrib/cirrus/packer/fah_setup.sh4
-rw-r--r--contrib/cirrus/packer/fedora_setup.sh9
-rw-r--r--contrib/cirrus/packer/image-builder-image_base-setup.sh7
-rw-r--r--contrib/cirrus/packer/rhel_base-setup.sh4
-rw-r--r--contrib/cirrus/packer/rhel_setup.sh8
-rw-r--r--contrib/cirrus/packer/ubuntu_setup.sh8
-rwxr-xr-xcontrib/cirrus/rootless_test.sh6
-rwxr-xr-xcontrib/cirrus/setup_container_environment.sh6
-rwxr-xr-xcontrib/cirrus/setup_environment.sh7
-rwxr-xr-xcontrib/cirrus/success.sh5
-rwxr-xr-xcontrib/cirrus/system_test.sh6
-rwxr-xr-xcontrib/cirrus/unit_test.sh6
-rw-r--r--docs/podman-container.1.md1
-rw-r--r--docs/podman-create.1.md14
-rw-r--r--docs/podman-generate-systemd.1.md69
-rw-r--r--docs/podman-generate.1.md1
-rw-r--r--docs/podman-init.1.md41
-rw-r--r--docs/podman-run.1.md31
-rw-r--r--docs/podman.1.md1
-rw-r--r--install.md2
-rw-r--r--libpod/container_api.go2
-rw-r--r--libpod/container_internal.go16
-rw-r--r--pkg/adapter/containers.go82
-rw-r--r--pkg/adapter/containers_remote.go73
-rw-r--r--pkg/adapter/runtime_remote.go17
-rw-r--r--pkg/systemdgen/systemdgen.go43
-rw-r--r--pkg/varlinkapi/containers.go15
-rw-r--r--pkg/varlinkapi/generate.go22
-rw-r--r--test/e2e/generate_systemd_test.go74
-rw-r--r--test/e2e/init_test.go129
-rw-r--r--vendor.conf6
-rw-r--r--vendor/github.com/containers/buildah/buildah.go2
-rw-r--r--vendor/github.com/containers/buildah/imagebuildah/build.go9
-rw-r--r--vendor/github.com/containers/buildah/pkg/cli/common.go4
-rw-r--r--vendor/github.com/containers/buildah/pkg/parse/parse.go41
-rw-r--r--vendor/github.com/containers/buildah/run_linux.go2
-rw-r--r--vendor/github.com/containers/buildah/util/util.go2
-rw-r--r--vendor/github.com/containers/storage/drivers/driver.go1
-rw-r--r--vendor/github.com/containers/storage/drivers/overlay/overlay.go26
-rw-r--r--vendor/github.com/containers/storage/drivers/vfs/driver.go7
-rw-r--r--vendor/github.com/containers/storage/layers.go1
-rw-r--r--vendor/github.com/openshift/imagebuilder/vendor.conf5
65 files changed, 1051 insertions, 263 deletions
diff --git a/Makefile b/Makefile
index 9228ec711..0085537d0 100644
--- a/Makefile
+++ b/Makefile
@@ -188,6 +188,7 @@ localunit: test/goecho/goecho varlink_generate
--tags "$(BUILDTAGS)" \
--succinct
$(MAKE) -C contrib/cirrus/packer test
+ ./contrib/cirrus/lib.sh.t
ginkgo:
ginkgo -v -tags "$(BUILDTAGS)" $(GINKGOTIMEOUT) -cover -flakeAttempts 3 -progress -trace -noColor -nodes 3 test/e2e/.
diff --git a/cmd/podman/build.go b/cmd/podman/build.go
index 647ff1e86..24be9bb46 100644
--- a/cmd/podman/build.go
+++ b/cmd/podman/build.go
@@ -267,7 +267,7 @@ func buildCmd(c *cliconfig.BuildValues) error {
MemorySwap: memorySwap,
ShmSize: c.ShmSize,
Ulimit: c.Ulimit,
- Volumes: c.Volume,
+ Volumes: c.Volumes,
}
options := imagebuildah.BuildOptions{
diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go
index 77156f47a..b770aaca0 100644
--- a/cmd/podman/cliconfig/config.go
+++ b/cmd/podman/cliconfig/config.go
@@ -136,12 +136,18 @@ type ExportValues struct {
PodmanCommand
Output string
}
-
type GenerateKubeValues struct {
PodmanCommand
Service bool
}
+type GenerateSystemdValues struct {
+ PodmanCommand
+ Name bool
+ RestartPolicy string
+ StopTimeout int
+}
+
type HistoryValues struct {
PodmanCommand
Human bool
@@ -177,6 +183,12 @@ type InfoValues struct {
Format string
}
+type InitValues struct {
+ PodmanCommand
+ All bool
+ Latest bool
+}
+
type InspectValues struct {
PodmanCommand
TypeObject string
diff --git a/cmd/podman/commands.go b/cmd/podman/commands.go
index 4b0641d82..14451d944 100644
--- a/cmd/podman/commands.go
+++ b/cmd/podman/commands.go
@@ -17,7 +17,6 @@ func getMainCommands() []*cobra.Command {
_loginCommand,
_logoutCommand,
_mountCommand,
- _portCommand,
_refreshCommand,
_searchCommand,
_statsCommand,
@@ -45,7 +44,6 @@ func getContainerSubCommands() []*cobra.Command {
_commitCommand,
_execCommand,
_mountCommand,
- _portCommand,
_refreshCommand,
_restoreCommand,
_runlabelCommand,
diff --git a/cmd/podman/common.go b/cmd/podman/common.go
index b02aa5990..8aca08248 100644
--- a/cmd/podman/common.go
+++ b/cmd/podman/common.go
@@ -315,7 +315,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) {
)
createFlags.Bool(
"http-proxy", true,
- "Set proxy environment variables in container based on the host proxy vars",
+ "Set proxy environment variables in the container based on the host proxy vars",
)
createFlags.String(
"image-volume", cliconfig.DefaultImageVolume,
diff --git a/cmd/podman/container.go b/cmd/podman/container.go
index b3058bf12..bbf01d1f8 100644
--- a/cmd/podman/container.go
+++ b/cmd/podman/container.go
@@ -56,12 +56,14 @@ var (
_diffCommand,
_exportCommand,
_createCommand,
+ _initCommand,
_killCommand,
_listSubCommand,
_logsCommand,
_pauseCommand,
- _restartCommand,
+ _portCommand,
_pruneContainersCommand,
+ _restartCommand,
_runCommand,
_rmCommand,
_startCommand,
diff --git a/cmd/podman/errors_remote.go b/cmd/podman/errors_remote.go
index ab255ea56..1e276be10 100644
--- a/cmd/podman/errors_remote.go
+++ b/cmd/podman/errors_remote.go
@@ -33,6 +33,8 @@ func outputError(err error) {
ne = errors.New(e.Reason)
case *iopodman.VolumeNotFound:
ne = errors.New(e.Reason)
+ case *iopodman.InvalidState:
+ ne = errors.New(e.Reason)
case *iopodman.ErrorOccurred:
ne = errors.New(e.Reason)
default:
diff --git a/cmd/podman/generate.go b/cmd/podman/generate.go
index a0637ecb2..98bfb00a1 100644
--- a/cmd/podman/generate.go
+++ b/cmd/podman/generate.go
@@ -18,6 +18,7 @@ var (
// Commands that are universally implemented
generateCommands = []*cobra.Command{
_containerKubeCommand,
+ _containerSystemdCommand,
}
)
diff --git a/cmd/podman/generate_systemd.go b/cmd/podman/generate_systemd.go
new file mode 100644
index 000000000..b4779e512
--- /dev/null
+++ b/cmd/podman/generate_systemd.go
@@ -0,0 +1,70 @@
+package main
+
+import (
+ "fmt"
+
+ "github.com/containers/libpod/cmd/podman/cliconfig"
+ "github.com/containers/libpod/pkg/adapter"
+ "github.com/containers/libpod/pkg/systemdgen"
+ "github.com/pkg/errors"
+ "github.com/spf13/cobra"
+)
+
+var (
+ containerSystemdCommand cliconfig.GenerateSystemdValues
+ containerSystemdDescription = `Command generates a systemd unit file for a Podman container
+ `
+ _containerSystemdCommand = &cobra.Command{
+ Use: "systemd [flags] CONTAINER | POD",
+ Short: "Generate a systemd unit file for a Podman container",
+ Long: containerSystemdDescription,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ containerSystemdCommand.InputArgs = args
+ containerSystemdCommand.GlobalFlags = MainGlobalOpts
+ containerSystemdCommand.Remote = remoteclient
+ return generateSystemdCmd(&containerSystemdCommand)
+ },
+ Args: func(cmd *cobra.Command, args []string) error {
+ if len(args) > 1 || len(args) < 1 {
+ return errors.New("provide only one container name or ID")
+ }
+ return nil
+ },
+ Example: `podman generate kube ctrID
+`,
+ }
+)
+
+func init() {
+ containerSystemdCommand.Command = _containerSystemdCommand
+ containerSystemdCommand.SetHelpTemplate(HelpTemplate())
+ containerSystemdCommand.SetUsageTemplate(UsageTemplate())
+ flags := containerSystemdCommand.Flags()
+ flags.BoolVarP(&containerSystemdCommand.Name, "name", "n", false, "use the container name instead of ID")
+ flags.IntVarP(&containerSystemdCommand.StopTimeout, "timeout", "t", -1, "stop timeout override")
+ flags.StringVar(&containerSystemdCommand.RestartPolicy, "restart-policy", "on-failure", "applicable systemd restart-policy")
+}
+
+func generateSystemdCmd(c *cliconfig.GenerateSystemdValues) error {
+ runtime, err := adapter.GetRuntime(getContext(), &c.PodmanCommand)
+ if err != nil {
+ return errors.Wrapf(err, "could not get runtime")
+ }
+ defer runtime.Shutdown(false)
+
+ // User input stop timeout must be 0 or greater
+ if c.Flag("timeout").Changed && c.StopTimeout < 0 {
+ return errors.New("timeout value must be 0 or greater")
+ }
+ // Make sure the input restart policy is valid
+ if err := systemdgen.ValidateRestartPolicy(c.RestartPolicy); err != nil {
+ return err
+ }
+
+ unit, err := runtime.GenerateSystemd(c)
+ if err != nil {
+ return err
+ }
+ fmt.Println(unit)
+ return nil
+}
diff --git a/cmd/podman/init.go b/cmd/podman/init.go
new file mode 100644
index 000000000..68c80631d
--- /dev/null
+++ b/cmd/podman/init.go
@@ -0,0 +1,64 @@
+package main
+
+import (
+ "github.com/containers/libpod/cmd/podman/cliconfig"
+ "github.com/containers/libpod/pkg/adapter"
+ "github.com/opentracing/opentracing-go"
+ "github.com/pkg/errors"
+ "github.com/spf13/cobra"
+)
+
+var (
+ initCommand cliconfig.InitValues
+ initDescription = `Initialize one or more containers, creating the OCI spec and mounts for inspection. Container names or IDs can be used.`
+
+ _initCommand = &cobra.Command{
+ Use: "init [flags] CONTAINER [CONTAINER...]",
+ Short: "Initialize one or more containers",
+ Long: initDescription,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ initCommand.InputArgs = args
+ initCommand.GlobalFlags = MainGlobalOpts
+ initCommand.Remote = remoteclient
+ return initCmd(&initCommand)
+ },
+ Args: func(cmd *cobra.Command, args []string) error {
+ return checkAllAndLatest(cmd, args, false)
+ },
+ Example: `podman init --latest
+ podman init 3c45ef19d893
+ podman init test1`,
+ }
+)
+
+func init() {
+ initCommand.Command = _initCommand
+ initCommand.SetHelpTemplate(HelpTemplate())
+ initCommand.SetUsageTemplate(UsageTemplate())
+ flags := initCommand.Flags()
+ flags.BoolVarP(&initCommand.All, "all", "a", false, "Initialize all containers")
+ flags.BoolVarP(&initCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
+ markFlagHiddenForRemoteClient("latest", flags)
+}
+
+// initCmd initializes a container
+func initCmd(c *cliconfig.InitValues) error {
+ if c.Bool("trace") {
+ span, _ := opentracing.StartSpanFromContext(Ctx, "initCmd")
+ defer span.Finish()
+ }
+
+ ctx := getContext()
+
+ runtime, err := adapter.GetRuntime(ctx, &c.PodmanCommand)
+ if err != nil {
+ return errors.Wrapf(err, "could not get runtime")
+ }
+ defer runtime.Shutdown(false)
+
+ ok, failures, err := runtime.InitContainers(ctx, c)
+ if err != nil {
+ return err
+ }
+ return printCmdResults(ok, failures)
+}
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index f501ee674..787dd55c0 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -39,12 +39,14 @@ var mainCommands = []*cobra.Command{
&_imagesCommand,
_importCommand,
_infoCommand,
+ _initCommand,
&_inspectCommand,
_killCommand,
_loadCommand,
_logsCommand,
_pauseCommand,
podCommand.Command,
+ _portCommand,
&_psCommand,
_pullCommand,
_pushCommand,
diff --git a/cmd/podman/port.go b/cmd/podman/port.go
index 7a9f01fe6..1bd2d623e 100644
--- a/cmd/podman/port.go
+++ b/cmd/podman/port.go
@@ -6,8 +6,7 @@ import (
"strings"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/cmd/podman/libpodruntime"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -51,10 +50,7 @@ func portCmd(c *cliconfig.PortValues) error {
var (
userProto, containerName string
userPort int
- container *libpod.Container
- containers []*libpod.Container
)
-
args := c.InputArgs
if c.Latest && c.All {
@@ -66,9 +62,6 @@ func portCmd(c *cliconfig.PortValues) error {
if len(args) == 0 && !c.Latest && !c.All {
return errors.Errorf("you must supply a running container name or id")
}
- if !c.Latest && !c.All {
- containerName = args[0]
- }
port := ""
if len(args) > 1 && !c.Latest {
@@ -98,36 +91,14 @@ func portCmd(c *cliconfig.PortValues) error {
}
}
- runtime, err := libpodruntime.GetRuntime(getContext(), &c.PodmanCommand)
+ runtime, err := adapter.GetRuntime(getContext(), &c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "could not get runtime")
}
defer runtime.Shutdown(false)
- if !c.Latest && !c.All {
- container, err = runtime.LookupContainer(containerName)
- if err != nil {
- return errors.Wrapf(err, "unable to find container %s", containerName)
- }
- containers = append(containers, container)
- } else if c.Latest {
- container, err = runtime.GetLatestContainer()
- if err != nil {
- return errors.Wrapf(err, "unable to get last created container")
- }
- containers = append(containers, container)
- } else {
- containers, err = runtime.GetRunningContainers()
- if err != nil {
- return errors.Wrapf(err, "unable to get all containers")
- }
- }
-
+ containers, err := runtime.Port(c)
for _, con := range containers {
- if state, _ := con.State(); state != libpod.ContainerStateRunning {
- continue
- }
-
portmappings, err := con.PortMappings()
if err != nil {
return err
diff --git a/cmd/podman/search.go b/cmd/podman/search.go
index 13948aef0..b236f3055 100644
--- a/cmd/podman/search.go
+++ b/cmd/podman/search.go
@@ -118,16 +118,3 @@ func searchToGeneric(params []image.SearchResult) (genericParams []interface{})
}
return genericParams
}
-
-func genSearchOutputMap() map[string]string {
- io := image.SearchResult{}
- v := reflect.Indirect(reflect.ValueOf(io))
- values := make(map[string]string)
-
- for i := 0; i < v.NumField(); i++ {
- key := v.Type().Field(i).Name
- value := key
- values[key] = strings.ToUpper(splitCamelCase(value))
- }
- return values
-}
diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go
index 48476e177..eac2d044d 100644
--- a/cmd/podman/shared/create.go
+++ b/cmd/podman/shared/create.go
@@ -726,11 +726,6 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
return config, nil
}
-type namespace interface {
- IsContainer() bool
- Container() string
-}
-
func CreateContainerFromCreateConfig(r *libpod.Runtime, createConfig *cc.CreateConfig, ctx context.Context, pod *libpod.Pod) (*libpod.Container, error) {
runtimeSpec, err := cc.CreateConfigToOCISpec(createConfig)
if err != nil {
diff --git a/cmd/podman/shared/workers.go b/cmd/podman/shared/workers.go
index 112af89cc..b6e3f10e7 100644
--- a/cmd/podman/shared/workers.go
+++ b/cmd/podman/shared/workers.go
@@ -110,9 +110,14 @@ func (p *Pool) newWorker(slot int) {
func DefaultPoolSize(name string) int {
numCpus := runtime.NumCPU()
switch name {
+ case "init":
+ fallthrough
case "kill":
+ fallthrough
case "pause":
+ fallthrough
case "rm":
+ fallthrough
case "unpause":
if numCpus <= 3 {
return numCpus * 3
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index 309f9765a..ace81646c 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -641,6 +641,14 @@ method StartContainer(name: string) -> (container: string)
# ~~~
method StopContainer(name: string, timeout: int) -> (container: string)
+# InitContainer initializes the given container. It accepts a container name or
+# ID, and will initialize the container matching that ID if possible, and error
+# if not. Containers can only be initialized when they are in the Created or
+# Exited states. Initialization prepares a container to be started, but does not
+# start the container. It is intended to be used to debug a container's state
+# prior to starting it.
+method InitContainer(name: string) -> (container: string)
+
# RestartContainer will restart a running container given a container name or ID and timeout value. The timeout
# value is the time before a forcible stop is used to stop the container. If the container cannot be found by
# name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise, the ID of the
@@ -1210,6 +1218,8 @@ method GetLayersMapWithImageInfo() -> (layerMap: string)
# BuildImageHierarchyMap is for the development of Podman and should not be used.
method BuildImageHierarchyMap(name: string) -> (imageInfo: string)
+method GenerateSystemd(name: string, restart: string, timeout: int, useName: bool) -> (unit: string)
+
# ImageNotFound means the image could not be found by the provided name or ID in local storage.
error ImageNotFound (id: string, reason: string)
@@ -1225,7 +1235,7 @@ error PodNotFound (name: string, reason: string)
# VolumeNotFound means the volume could not be found by the name or ID in local storage.
error VolumeNotFound (id: string, reason: string)
-# PodContainerError means a container associated with a pod failed to preform an operation. It contains
+# PodContainerError means a container associated with a pod failed to perform an operation. It contains
# a container ID of the container that failed.
error PodContainerError (podname: string, errors: []PodContainerErrorData)
@@ -1233,6 +1243,9 @@ error PodContainerError (podname: string, errors: []PodContainerErrorData)
# the pod ID.
error NoContainersInPod (name: string)
+# InvalidState indicates that a container or pod was in an improper state for the requested operation
+error InvalidState (id: string, reason: string)
+
# ErrorOccurred is a generic error for an error that occurs during the execution. The actual error message
# is includes as part of the error's text.
error ErrorOccurred (reason: string)
@@ -1241,4 +1254,4 @@ error ErrorOccurred (reason: string)
error RuntimeError (reason: string)
# The Podman endpoint requires that you use a streaming connection.
-error WantsMoreRequired (reason: string)
+error WantsMoreRequired (reason: string) \ No newline at end of file
diff --git a/commands.md b/commands.md
index 1c05640f2..e6c211254 100644
--- a/commands.md
+++ b/commands.md
@@ -25,6 +25,8 @@ Command | Descr
[podman-exec(1)](/docs/podman-exec.1.md) | Execute a command in a running container |
[podman-export(1)](/docs/podman-export.1.md) | Export container's filesystem contents as a tar archive |
[podman-generate(1)](/docs/podman-generate.1.md) | Generate structured output based on Podman containers and pods |
+[podman-generate-kube(1)](/docs/podman-generate-kube.1.md) | Generate Kubernetes YAML based on a container or Pod |
+[podman-generate-systemd(1)](/docs/podman-generate-systemd.1.md) | Generate a Systemd unit file for a container |
[podman-history(1)](/docs/podman-history.1.md) | Shows the history of an image |
[podman-image(1)](/docs/podman-image.1.md) | Manage Images |
[podman-image-exists(1)](/docs/podman-image-exists.1.md) | Check if an image exists in local storage |
@@ -34,6 +36,7 @@ Command | Descr
[podman-images(1)](/docs/podman-images.1.md) | List images in local storage | [![...](/docs/play.png)](https://podman.io/asciinema/podman/images/) | [Here](https://github.com/containers/Demos/blob/master/podman_cli/podman_images.sh)
[podman-import(1)](/docs/podman-import.1.md) | Import a tarball and save it as a filesystem image |
[podman-info(1)](/docs/podman-info.1.md) | Display system information |
+[podman-init(1)](/docs/podman-init.1.md) | Initialize a container |
[podman-inspect(1)](/docs/podman-inspect.1.md) | Display the configuration of a container or image | [![...](/docs/play.png)](https://asciinema.org/a/133418)
[podman-kill(1)](/docs/podman-kill.1.md) | Kill the main process in one or more running containers |
[podman-load(1)](/docs/podman-load.1.md) | Load an image from a container image archive |
diff --git a/completions/bash/podman b/completions/bash/podman
index b5963f8b9..e3c0c1dbf 100644
--- a/completions/bash/podman
+++ b/completions/bash/podman
@@ -780,6 +780,10 @@ _podman_container_export() {
_podman_export
}
+_podman_container_init() {
+ _podman_init
+}
+
_podman_container_inspect() {
_podman_inspect
}
@@ -915,6 +919,7 @@ _podman_generate() {
"
subcommands="
kube
+ systemd
"
__podman_subcommands "$subcommands $aliases" && return
@@ -2223,6 +2228,27 @@ _podman_ps() {
_complete_ "$options_with_args" "$boolean_options"
}
+_podman_init() {
+ local boolean_options="
+ --all
+ -a
+ --help
+ -h
+ --latest
+ -l
+ "
+ local options_with_args="
+ "
+ case "$cur" in
+ -*)
+ COMPREPLY=($(compgen -W "$boolean_options $options_with_args" -- "$cur"))
+ ;;
+ *)
+ __podman_complete_containers_unpauseable
+ ;;
+ esac
+}
+
_podman_start() {
local options_with_args="
--detach-keys
@@ -2435,6 +2461,32 @@ _podman_generate_kube() {
esac
}
+_podman_generate_systemd() {
+ local options_with_args="
+ --restart-policy
+ -t
+ --timeout"
+
+ local boolean_options="
+ -h
+ --help
+ -n
+ --name
+ "
+
+ case "$cur" in
+ -*)
+ COMPREPLY=($(compgen -W "$boolean_options $options_with_args" -- "$cur"))
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W "
+ $(__podman_containers --all)
+ " -- "$cur" ) )
+ __ltrim_colon_completions "$cur"
+ ;;
+ esac
+}
+
_podman_play_kube() {
local options_with_args="
--authfile
diff --git a/contrib/cirrus/build_vm_images.sh b/contrib/cirrus/build_vm_images.sh
index 6b86aa4d4..fc8cbb404 100755
--- a/contrib/cirrus/build_vm_images.sh
+++ b/contrib/cirrus/build_vm_images.sh
@@ -3,25 +3,7 @@
set -e
source $(dirname $0)/lib.sh
-req_env_var "
-CNI_COMMIT $CNI_COMMIT
-CRIO_COMMIT $CRIO_COMMIT
-RUNC_COMMIT $RUNC_COMMIT
-PACKER_BUILDS $PACKER_BUILDS
-BUILT_IMAGE_SUFFIX $BUILT_IMAGE_SUFFIX
-CENTOS_BASE_IMAGE $CENTOS_BASE_IMAGE
-UBUNTU_BASE_IMAGE $UBUNTU_BASE_IMAGE
-FEDORA_BASE_IMAGE $FEDORA_BASE_IMAGE
-FAH_BASE_IMAGE $FAH_BASE_IMAGE
-RHEL_BASE_IMAGE $RHEL_BASE_IMAGE
-RHSM_COMMAND $RHSM_COMMAND
-SERVICE_ACCOUNT $SERVICE_ACCOUNT
-GCE_SSH_USERNAME $GCE_SSH_USERNAME
-GCP_PROJECT_ID $GCP_PROJECT_ID
-PACKER_VER $PACKER_VER
-SCRIPT_BASE $SCRIPT_BASE
-PACKER_BASE $PACKER_BASE
-"
+req_env_var CNI_COMMIT CRIO_COMMIT RUNC_COMMIT PACKER_BUILDS BUILT_IMAGE_SUFFIX CENTOS_BASE_IMAGE UBUNTU_BASE_IMAGE FEDORA_BASE_IMAGE FAH_BASE_IMAGE RHEL_BASE_IMAGE RHSM_COMMAND SERVICE_ACCOUNT GCE_SSH_USERNAME GCP_PROJECT_ID PACKER_VER SCRIPT_BASE PACKER_BASE
record_timestamp "cache-image build start"
diff --git a/contrib/cirrus/integration_test.sh b/contrib/cirrus/integration_test.sh
index 95387ff49..71223803c 100755
--- a/contrib/cirrus/integration_test.sh
+++ b/contrib/cirrus/integration_test.sh
@@ -3,13 +3,7 @@
set -e
source $(dirname $0)/lib.sh
-req_env_var "
-GOSRC $GOSRC
-SCRIPT_BASE $SCRIPT_BASE
-OS_RELEASE_ID $OS_RELEASE_ID
-OS_RELEASE_VER $OS_RELEASE_VER
-CONTAINER_RUNTIME $CONTAINER_RUNTIME
-"
+req_env_var GOSRC SCRIPT_BASE OS_RELEASE_ID OS_RELEASE_VER CONTAINER_RUNTIME
exit_handler() {
set +ex
@@ -39,7 +33,7 @@ then
exit $?
elif [[ "$SPECIALMODE" == "rootless" ]]
then
- req_env_var "ROOTLESS_USER $ROOTLESS_USER"
+ req_env_var ROOTLESS_USER
set -x
ssh $ROOTLESS_USER@localhost \
-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no \
diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh
index d663616b2..1c459ebc7 100644
--- a/contrib/cirrus/lib.sh
+++ b/contrib/cirrus/lib.sh
@@ -33,15 +33,27 @@ then
source "$HOME/$ENVLIB"
fi
-# Pass in a line delimited list of, space delimited name/value pairs
-# exit non-zero with helpful error message if any value is empty
+# Pass in a list of one or more envariable names; exit non-zero with
+# helpful error message if any value is empty
req_env_var() {
- echo "$1" | while read NAME VALUE
- do
- if [[ -n "$NAME" ]] && [[ -z "$VALUE" ]]
- then
- echo "Required env. var. \$$NAME is not set"
- exit 9
+ # Provide context. If invoked from function use its name; else script name
+ local caller=${FUNCNAME[1]}
+ if [[ -n "$caller" ]]; then
+ # Indicate that it's a function name
+ caller="$caller()"
+ else
+ # Not called from a function: use script name
+ caller=$(basename $0)
+ fi
+
+ # Usage check
+ [[ -n "$1" ]] || die 1 "FATAL: req_env_var: invoked without arguments"
+
+ # Each input arg is an envariable name, e.g. HOME PATH etc. Expand each.
+ # If any is empty, bail out and explain why.
+ for i; do
+ if [[ -z "${!i}" ]]; then
+ die 9 "FATAL: $caller requires \$$i to be non-empty"
fi
done
}
@@ -97,20 +109,14 @@ PACKER_BUILDS $PACKER_BUILDS
# Unset environment variables not needed for testing purposes
clean_env() {
- req_env_var "
- UNSET_ENV_VARS $UNSET_ENV_VARS
- "
+ req_env_var UNSET_ENV_VARS
echo "Unsetting $(echo $UNSET_ENV_VARS | wc -w) environment variables"
unset -v UNSET_ENV_VARS $UNSET_ENV_VARS || true # don't fail on read-only
}
die() {
- req_env_var "
- 1 $1
- 2 $2
- "
- echo "$2"
- exit $1
+ echo "${2:-FATAL ERROR (but no message given!) in ${FUNCNAME[1]}()}"
+ exit ${1:-1}
}
# Return a GCE image-name compatible string representation of distribution name
@@ -135,10 +141,8 @@ stub() {
}
ircmsg() {
- req_env_var "
- CIRRUS_TASK_ID $CIRRUS_TASK_ID
- @ $@
- "
+ req_env_var CIRRUS_TASK_ID
+ [[ -n "$*" ]] || die 9 "ircmsg() invoked without args"
# Sometimes setup_environment.sh didn't run
SCRIPT="$(dirname $0)/podbot.py"
NICK="podbot_$CIRRUS_TASK_ID"
@@ -151,7 +155,7 @@ ircmsg() {
record_timestamp() {
set +x # sometimes it's turned on
- req_env_var "TIMESTAMPS_FILEPATH $TIMESTAMPS_FILEPATH"
+ req_env_var TIMESTAMPS_FILEPATH
echo "." # cirrus webui strips blank-lines
STAMPMSG="The $1 time at the tone will be:"
echo -e "$STAMPMSG\t$(date --iso-8601=seconds)" | \
@@ -160,11 +164,7 @@ record_timestamp() {
}
setup_rootless() {
- req_env_var "
- ROOTLESS_USER $ROOTLESS_USER
- GOSRC $GOSRC
- ENVLIB $ENVLIB
- "
+ req_env_var ROOTLESS_USER GOSRC ENVLIB
if passwd --status $ROOTLESS_USER
then
@@ -220,7 +220,7 @@ setup_rootless() {
# Helper/wrapper script to only show stderr/stdout on non-zero exit
install_ooe() {
- req_env_var "SCRIPT_BASE $SCRIPT_BASE"
+ req_env_var SCRIPT_BASE
echo "Installing script to mask stdout/stderr unless non-zero exit."
sudo install -D -m 755 "/tmp/libpod/$SCRIPT_BASE/ooe.sh" /usr/local/bin/ooe.sh
}
@@ -241,10 +241,7 @@ EOF
install_cni_plugins() {
echo "Installing CNI Plugins from commit $CNI_COMMIT"
- req_env_var "
- GOPATH $GOPATH
- CNI_COMMIT $CNI_COMMIT
- "
+ req_env_var GOPATH CNI_COMMIT
DEST="$GOPATH/src/github.com/containernetworking/plugins"
rm -rf "$DEST"
ooe.sh git clone "https://github.com/containernetworking/plugins.git" "$DEST"
@@ -272,11 +269,7 @@ install_runc(){
OS_RELEASE_ID=$(os_release_id)
echo "Installing RunC from commit $RUNC_COMMIT"
echo "Platform is $OS_RELEASE_ID"
- req_env_var "
- GOPATH $GOPATH
- RUNC_COMMIT $RUNC_COMMIT
- OS_RELEASE_ID $OS_RELEASE_ID
- "
+ req_env_var GOPATH RUNC_COMMIT OS_RELEASE_ID
if [[ "$OS_RELEASE_ID" =~ "ubuntu" ]]; then
echo "Running make install.libseccomp.sudo for ubuntu"
if ! [[ -d "/tmp/libpod" ]]
@@ -295,7 +288,7 @@ install_runc(){
install_buildah() {
echo "Installing buildah from latest upstream master"
- req_env_var "GOPATH $GOPATH"
+ req_env_var GOPATH
DEST="$GOPATH/src/github.com/containers/buildah"
rm -rf "$DEST"
ooe.sh git clone https://github.com/containers/buildah "$DEST"
@@ -307,10 +300,7 @@ install_buildah() {
# Requires $GOPATH and $CRIO_COMMIT to be set
install_conmon(){
echo "Installing conmon from commit $CRIO_COMMIT"
- req_env_var "
- GOPATH $GOPATH
- CRIO_COMMIT $CRIO_COMMIT
- "
+ req_env_var GOPATH CRIO_COMMIT
DEST="$GOPATH/src/github.com/kubernetes-sigs/cri-o.git"
rm -rf "$DEST"
ooe.sh git clone https://github.com/kubernetes-sigs/cri-o.git "$DEST"
@@ -327,9 +317,7 @@ install_criu(){
echo "Installing CRIU"
echo "Installing CRIU from commit $CRIU_COMMIT"
echo "Platform is $OS_RELEASE_ID"
- req_env_var "
- CRIU_COMMIT $CRIU_COMMIT
- "
+ req_env_var CRIU_COMMIT
if [[ "$OS_RELEASE_ID" =~ "ubuntu" ]]; then
ooe.sh sudo -E add-apt-repository -y ppa:criu/ppa
@@ -418,10 +406,7 @@ ubuntu_finalize(){
rhel_exit_handler() {
set +ex
- req_env_var "
- GOPATH $GOPATH
- RHSMCMD $RHSMCMD
- "
+ req_env_var GOPATH RHSMCMD
cd /
sudo rm -rf "$RHSMCMD"
sudo rm -rf "$GOPATH"
@@ -431,9 +416,7 @@ rhel_exit_handler() {
}
rhsm_enable() {
- req_env_var "
- RHSM_COMMAND $RHSM_COMMAND
- "
+ req_env_var RHSM_COMMAND
export GOPATH="$(mktemp -d)"
export RHSMCMD="$(mktemp)"
trap "rhel_exit_handler" EXIT
diff --git a/contrib/cirrus/lib.sh.t b/contrib/cirrus/lib.sh.t
new file mode 100755
index 000000000..ce51f8ad2
--- /dev/null
+++ b/contrib/cirrus/lib.sh.t
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+# Unit tests for some functions in lib.sh
+#
+source $(dirname $0)/lib.sh
+
+# Iterator and return code; updated in test functions
+testnum=0
+rc=0
+
+function check_result {
+ testnum=$(expr $testnum + 1)
+ if [ "$1" = "$2" ]; then
+ echo "ok $testnum $3 = $1"
+ else
+ echo "not ok $testnum $3"
+ echo "# expected: $2"
+ echo "# actual: $1"
+ rc=1
+ fi
+}
+
+###############################################################################
+# tests for die()
+
+function test_die() {
+ local input_status=$1
+ local input_msg=$2
+ local expected_status=$3
+ local expected_msg=$4
+
+ local msg
+ msg=$(die $input_status "$input_msg")
+ local status=$?
+
+ check_result "$msg" "$expected_msg" "die $input_status $input_msg"
+}
+
+test_die 1 "a message" 1 "a message"
+test_die 2 "" 2 "FATAL ERROR (but no message given!) in test_die()"
+test_die '' '' 1 "FATAL ERROR (but no message given!) in test_die()"
+
+###############################################################################
+# tests for req_env_var()
+
+function test_rev() {
+ local input_args=$1
+ local expected_status=$2
+ local expected_msg=$3
+
+ # bash gotcha: doing 'local msg=...' on one line loses exit status
+ local msg
+ msg=$(req_env_var $input_args)
+ local status=$?
+
+ check_result "$msg" "$expected_msg" "req_env_var $input_args"
+ check_result "$status" "$expected_status" "req_env_var $input_args (rc)"
+}
+
+# error if called with no args
+test_rev '' 1 'FATAL: req_env_var: invoked without arguments'
+
+# error if desired envariable is unset
+unset FOO BAR
+test_rev FOO 9 'FATAL: test_rev() requires $FOO to be non-empty'
+test_rev BAR 9 'FATAL: test_rev() requires $BAR to be non-empty'
+
+# OK if desired envariable is unset
+FOO=1
+test_rev FOO 0 ''
+
+# ...but error if any single desired one is unset
+test_rev "FOO BAR" 9 'FATAL: test_rev() requires $BAR to be non-empty'
+
+# ...and OK if all args are set
+BAR=1
+test_rev "FOO BAR" 0 ''
+
+###############################################################################
+
+exit $rc
diff --git a/contrib/cirrus/packer/centos_setup.sh b/contrib/cirrus/packer/centos_setup.sh
index d947a1d7f..91b1963c2 100644
--- a/contrib/cirrus/packer/centos_setup.sh
+++ b/contrib/cirrus/packer/centos_setup.sh
@@ -8,12 +8,7 @@ set -e
# Load in library (copied by packer, before this script was run)
source /tmp/libpod/$SCRIPT_BASE/lib.sh
-req_env_var "
-SCRIPT_BASE $SCRIPT_BASE
-CNI_COMMIT $CNI_COMMIT
-CRIO_COMMIT $CRIO_COMMIT
-CRIU_COMMIT $CRIU_COMMIT
-"
+req_env_var SCRIPT_BASE CNI_COMMIT CRIO_COMMIT CRIU_COMMIT
install_ooe
diff --git a/contrib/cirrus/packer/fah_setup.sh b/contrib/cirrus/packer/fah_setup.sh
index 2e053b396..18c4db0af 100644
--- a/contrib/cirrus/packer/fah_setup.sh
+++ b/contrib/cirrus/packer/fah_setup.sh
@@ -8,9 +8,7 @@ set -e
# Load in library (copied by packer, before this script was run)
source /tmp/libpod/$SCRIPT_BASE/lib.sh
-req_env_var "
-SCRIPT_BASE $SCRIPT_BASE
-"
+req_env_var SCRIPT_BASE
install_ooe
diff --git a/contrib/cirrus/packer/fedora_setup.sh b/contrib/cirrus/packer/fedora_setup.sh
index 84aee7667..36a65eb71 100644
--- a/contrib/cirrus/packer/fedora_setup.sh
+++ b/contrib/cirrus/packer/fedora_setup.sh
@@ -8,14 +8,7 @@ set -e
# Load in library (copied by packer, before this script was run)
source /tmp/libpod/$SCRIPT_BASE/lib.sh
-req_env_var "
-SCRIPT_BASE $SCRIPT_BASE
-FEDORA_CNI_COMMIT $FEDORA_CNI_COMMIT
-CNI_COMMIT $CNI_COMMIT
-CRIO_COMMIT $CRIO_COMMIT
-CRIU_COMMIT $CRIU_COMMIT
-RUNC_COMMIT $RUNC_COMMIT
-"
+req_env_var SCRIPT_BASE FEDORA_CNI_COMMIT CNI_COMMIT CRIO_COMMIT CRIU_COMMIT RUNC_COMMIT
install_ooe
diff --git a/contrib/cirrus/packer/image-builder-image_base-setup.sh b/contrib/cirrus/packer/image-builder-image_base-setup.sh
index 8cf9fd8ab..43cfa7180 100644
--- a/contrib/cirrus/packer/image-builder-image_base-setup.sh
+++ b/contrib/cirrus/packer/image-builder-image_base-setup.sh
@@ -11,12 +11,7 @@ set -e
# Load in library (copied by packer, before this script was run)
source $GOSRC/$SCRIPT_BASE/lib.sh
-req_env_var "
- TIMESTAMP $TIMESTAMP
- GOSRC $GOSRC
- SCRIPT_BASE $SCRIPT_BASE
- PACKER_BASE $PACKER_BASE
-"
+req_env_var TIMESTAMP GOSRC SCRIPT_BASE PACKER_BASE
install_ooe
diff --git a/contrib/cirrus/packer/rhel_base-setup.sh b/contrib/cirrus/packer/rhel_base-setup.sh
index fbf9f61af..8d5892d7d 100644
--- a/contrib/cirrus/packer/rhel_base-setup.sh
+++ b/contrib/cirrus/packer/rhel_base-setup.sh
@@ -10,9 +10,7 @@ set -e
# Load in library (copied by packer, before this script was run)
source $GOSRC/$SCRIPT_BASE/lib.sh
-req_env_var "
- RHSM_COMMAND $RHSM_COMMAND
-"
+req_env_var RHSM_COMMAND
install_ooe
diff --git a/contrib/cirrus/packer/rhel_setup.sh b/contrib/cirrus/packer/rhel_setup.sh
index 20be97f9b..45f5c3e9b 100644
--- a/contrib/cirrus/packer/rhel_setup.sh
+++ b/contrib/cirrus/packer/rhel_setup.sh
@@ -8,13 +8,7 @@ set -e
# Load in library (copied by packer, before this script was run)
source /tmp/libpod/$SCRIPT_BASE/lib.sh
-req_env_var "
-SCRIPT_BASE $SCRIPT_BASE
-CNI_COMMIT $CNI_COMMIT
-CRIO_COMMIT $CRIO_COMMIT
-CRIU_COMMIT $CRIU_COMMIT
-RHSM_COMMAND $RHSM_COMMAND
-"
+req_env_var SCRIPT_BASE CNI_COMMIT CRIO_COMMIT CRIU_COMMIT RHSM_COMMAND
install_ooe
diff --git a/contrib/cirrus/packer/ubuntu_setup.sh b/contrib/cirrus/packer/ubuntu_setup.sh
index e84566ce3..d3ac8bddb 100644
--- a/contrib/cirrus/packer/ubuntu_setup.sh
+++ b/contrib/cirrus/packer/ubuntu_setup.sh
@@ -8,13 +8,7 @@ set -e
# Load in library (copied by packer, before this script was run)
source /tmp/libpod/$SCRIPT_BASE/lib.sh
-req_env_var "
-SCRIPT_BASE $SCRIPT_BASE
-CNI_COMMIT $CNI_COMMIT
-CRIO_COMMIT $CRIO_COMMIT
-CRIU_COMMIT $CRIU_COMMIT
-RUNC_COMMIT $RUNC_COMMIT
-"
+req_env_var SCRIPT_BASE CNI_COMMIT CRIO_COMMIT CRIU_COMMIT RUNC_COMMIT
install_ooe
diff --git a/contrib/cirrus/rootless_test.sh b/contrib/cirrus/rootless_test.sh
index 09c57f993..2803d4318 100755
--- a/contrib/cirrus/rootless_test.sh
+++ b/contrib/cirrus/rootless_test.sh
@@ -6,11 +6,7 @@ source $HOME/.bash_profile
cd $GOSRC
source $(dirname $0)/lib.sh
-req_env_var "
-GOSRC $GOSRC
-OS_RELEASE_ID $OS_RELEASE_ID
-OS_RELEASE_VER $OS_RELEASE_VER
-"
+req_env_var GOSRC OS_RELEASE_ID OS_RELEASE_VER
if [[ "$UID" == "0" ]]
then
diff --git a/contrib/cirrus/setup_container_environment.sh b/contrib/cirrus/setup_container_environment.sh
index 23df4fe8b..eda6f6167 100755
--- a/contrib/cirrus/setup_container_environment.sh
+++ b/contrib/cirrus/setup_container_environment.sh
@@ -3,11 +3,7 @@ set -e
source $(dirname $0)/lib.sh
-req_env_var "
-GOSRC $GOSRC
-OS_RELEASE_ID $OS_RELEASE_ID
-CONTAINER_RUNTIME $CONTAINER_RUNTIME
-"
+req_env_var GOSRC OS_RELEASE_ID CONTAINER_RUNTIME
DIST=$OS_RELEASE_ID
IMAGE=${DIST}podmanbuild
diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh
index 3818abbc7..3bc6c2290 100755
--- a/contrib/cirrus/setup_environment.sh
+++ b/contrib/cirrus/setup_environment.sh
@@ -6,12 +6,7 @@ source $(dirname $0)/lib.sh
record_timestamp "env. setup start"
-req_env_var "
-USER $USER
-HOME $HOME
-ENVLIB $ENVLIB
-SCRIPT_BASE $SCRIPT_BASE
-CIRRUS_BUILD_ID $CIRRUS_BUILD_ID"
+req_env_var USER HOME ENVLIB SCRIPT_BASE CIRRUS_BUILD_ID
[[ "$SHELL" =~ "bash" ]] || chsh -s /bin/bash
diff --git a/contrib/cirrus/success.sh b/contrib/cirrus/success.sh
index 2b0cf4655..c4e150514 100755
--- a/contrib/cirrus/success.sh
+++ b/contrib/cirrus/success.sh
@@ -4,10 +4,7 @@ set -e
source $(dirname $0)/lib.sh
-req_env_var "
- CIRRUS_BRANCH $CIRRUS_BRANCH
- CIRRUS_BUILD_ID $CIRRUS_BUILD_ID
-"
+req_env_var CIRRUS_BRANCH CIRRUS_BUILD_ID
REF=$(basename $CIRRUS_BRANCH) # PR number or branch named
URL="https://cirrus-ci.com/build/$CIRRUS_BUILD_ID"
diff --git a/contrib/cirrus/system_test.sh b/contrib/cirrus/system_test.sh
index cb179407a..dd5ef511d 100755
--- a/contrib/cirrus/system_test.sh
+++ b/contrib/cirrus/system_test.sh
@@ -3,11 +3,7 @@
set -e
source $(dirname $0)/lib.sh
-req_env_var "
-GOSRC $GOSRC
-OS_RELEASE_ID $OS_RELEASE_ID
-OS_RELEASE_VER $OS_RELEASE_VER
-"
+req_env_var GOSRC OS_RELEASE_ID OS_RELEASE_VER
clean_env
diff --git a/contrib/cirrus/unit_test.sh b/contrib/cirrus/unit_test.sh
index 4ace19d10..a0964061f 100755
--- a/contrib/cirrus/unit_test.sh
+++ b/contrib/cirrus/unit_test.sh
@@ -3,11 +3,7 @@
set -e
source $(dirname $0)/lib.sh
-req_env_var "
-GOSRC $GOSRC
-OS_RELEASE_ID $OS_RELEASE_ID
-OS_RELEASE_VER $OS_RELEASE_VER
-"
+req_env_var GOSRC OS_RELEASE_ID OS_RELEASE_VER
record_timestamp "unit test start"
diff --git a/docs/podman-container.1.md b/docs/podman-container.1.md
index 1ba957480..564d791fa 100644
--- a/docs/podman-container.1.md
+++ b/docs/podman-container.1.md
@@ -22,6 +22,7 @@ The container command allows you to manage containers
| exec | [podman-exec(1)](podman-exec.1.md) | Execute a command in a running container. |
| exists | [podman-container-exists(1)](podman-container-exists.1.md) | Check if a container exists in local storage |
| export | [podman-export(1)](podman-export.1.md) | Export a container's filesystem contents as a tar archive. |
+| init | [podman-init(1)](podman-init.1.md) | Initialize a container |
| inspect | [podman-inspect(1)](podman-inspect.1.md) | Display a container or image's configuration. |
| kill | [podman-kill(1)](podman-kill.1.md) | Kill the main process in one or more containers. |
| list | [podman-ps(1)](podman-ps.1.md) | List the containers on the system.(alias ls) |
diff --git a/docs/podman-create.1.md b/docs/podman-create.1.md
index 884a8adcc..6d7d983b6 100644
--- a/docs/podman-create.1.md
+++ b/docs/podman-create.1.md
@@ -250,7 +250,17 @@ By default proxy environment variables are passed into the container if set
for the podman process. This can be disabled by setting the `--http-proxy`
option to `false`. The environment variables passed in include `http_proxy`,
`https_proxy`, `ftp_proxy`, `no_proxy`, and also the upper case versions of
-those.
+those. This option is only needed when the host system must use a proxy but
+the container should not use any proxy. Proxy environment variables specified
+for the container in any other way will override the values that would have
+been passed thru from the host. (Other ways to specify the proxy for the
+container include passing the values with the `--env` flag, or hardcoding the
+proxy environment at container build time.)
+
+For example, to disable passing these environment variables from host to
+container:
+
+`--http-proxy=false`
Defaults to `true`
@@ -269,7 +279,7 @@ The following example maps uids 0-2000 in the container to the uids 30000-31999
Add additional groups to run as
-**--healthchech**=""
+**--healthcheck**=""
Set or alter a healthcheck for a container. The value must be of the format of:
diff --git a/docs/podman-generate-systemd.1.md b/docs/podman-generate-systemd.1.md
new file mode 100644
index 000000000..cc3f098a6
--- /dev/null
+++ b/docs/podman-generate-systemd.1.md
@@ -0,0 +1,69 @@
+% podman-generate Podman Man Pages
+% Brent Baude
+% April 2019
+# NAME
+podman-generate-systemd- Generate Systemd Unit file
+
+# SYNOPSIS
+**podman generate systemd** [*-n*|*--name*] [*-t*|*--timeout*] [*--restart-policy*] *container*
+
+# DESCRIPTION
+**podman generate systemd** will create a Systemd unit file that can be used to control a container. The
+command will dynamically create the unit file and output it to stdout where it can be piped by the user
+to a file. The options can be used to influence the results of the output as well.
+
+
+# OPTIONS:
+
+**--name** **-n**
+
+Use the name of the container for the start, stop, and description in the unit file
+
+**--timeout** **-t**
+
+Override the default stop timeout for the container with the given value.
+
+**--restart-policy**
+Set the SystemD restart policy. The restart-policy must be one of: "no", "on-success", "on-failure", "on-abnormal",
+"on-watchdog", "on-abort", or "always". The default policy is *on-failure*.
+
+## Examples ##
+
+Create a systemd unit file for a container running nginx:
+
+```
+$ sudo podman generate systemd nginx
+[Unit]
+Description=c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc Podman Container
+[Service]
+Restart=on-failure
+ExecStart=/usr/bin/podman start c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc
+ExecStop=/usr/bin/podman stop -t 10 c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc
+KillMode=none
+Type=forking
+PIDFile=/var/lib/containers/storage/overlay-containers/c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc/userdata/c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc.pid
+[Install]
+WantedBy=multi-user.target
+```
+
+Create a systemd unit file for a container running nginx with an *always* restart policy and 1-second timeout.
+```
+$ sudo podman generate systemd --restart-policy=always -t 1 nginx
+[Unit]
+Description=c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc Podman Container
+[Service]
+Restart=always
+ExecStart=/usr/bin/podman start c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc
+ExecStop=/usr/bin/podman stop -t 1 c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc
+KillMode=none
+Type=forking
+PIDFile=/var/lib/containers/storage/overlay-containers/c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc/userdata/c21da63c4783be2ac2cd3487ef8d2ec15ee2a28f63dd8f145e3b05607f31cffc.pid
+[Install]
+WantedBy=multi-user.target
+```
+
+## SEE ALSO
+podman(1), podman-container(1)
+
+# HISTORY
+April 2019, Originally compiled by Brent Baude (bbaude at redhat dot com)
diff --git a/docs/podman-generate.1.md b/docs/podman-generate.1.md
index d1736f38e..5a2386778 100644
--- a/docs/podman-generate.1.md
+++ b/docs/podman-generate.1.md
@@ -14,6 +14,7 @@ The generate command will create structured output (like YAML) based on a contai
| Command | Man Page | Description |
| ------- | --------------------------------------------------- | ---------------------------------------------------------------------------- |
| kube | [podman-generate-kube(1)](podman-generate-kube.1.md)| Generate Kubernetes YAML based on a pod or container. |
+| systemd | [podman-generate-systemd(1)](podman-generate-systemd.1.md)| Generate a systemd unit file for a container. |
## SEE ALSO
podman, podman-pod, podman-container
diff --git a/docs/podman-init.1.md b/docs/podman-init.1.md
new file mode 100644
index 000000000..f43757f62
--- /dev/null
+++ b/docs/podman-init.1.md
@@ -0,0 +1,41 @@
+% podman-init(1)
+
+## NAME
+podman\-init - Initialize one or more containers
+
+## SYNOPSIS
+**podman init** [*options*] *container* ...
+
+## DESCRIPTION
+Initialize one or more containers.
+You may use container IDs or names as input.
+Initializing a container performs all tasks necessary for starting the container (mounting filesystems, creating an OCI spec, initializing the container network) but does not start the container.
+If a container is not initialized, the `podman start` and `podman run` commands will do so automatically prior to starting it.
+This command is intended to be used for inspecting or modifying the container's filesystem or OCI spec prior to starting it.
+This can be used to inspect the container before it runs, or debug why a container is failing to run.
+
+## OPTIONS
+
+**--all, -a**
+
+Initialize all containers. Containers that have already initialized (including containers that have been started and are running) are ignored.
+
+**--latest, -l**
+Instead of providing the container name or ID, use the last created container. If you use methods other than Podman
+to run containers such as CRI-O, the last started container could be from either of those methods.
+
+The latest option is not supported on the remote client.
+
+## EXAMPLE
+
+podman init 35480fc9d568
+
+podman init test1
+
+podman init --latest
+
+## SEE ALSO
+podman(1), podman-start(1)
+
+## HISTORY
+April 2019, Originally compiled by Matthew Heon <mheon@redhat.com>
diff --git a/docs/podman-run.1.md b/docs/podman-run.1.md
index a0c17652a..9efb7f51c 100644
--- a/docs/podman-run.1.md
+++ b/docs/podman-run.1.md
@@ -257,7 +257,17 @@ By default proxy environment variables are passed into the container if set
for the podman process. This can be disabled by setting the `--http-proxy`
option to `false`. The environment variables passed in include `http_proxy`,
`https_proxy`, `ftp_proxy`, `no_proxy`, and also the upper case versions of
-those.
+those. This option is only needed when the host system must use a proxy but
+the container should not use any proxy. Proxy environment variables specified
+for the container in any other way will override the values that would have
+been passed thru from the host. (Other ways to specify the proxy for the
+container include passing the values with the `--env` flag, or hardcoding the
+proxy environment at container build time.)
+
+For example, to disable passing these environment variables from host to
+container:
+
+`--http-proxy=false`
Defaults to `true`
@@ -277,7 +287,7 @@ The example maps gids 0-2000 in the container to the gids 30000-31999 on the hos
Add additional groups to run as
-**--healthchech**=""
+**--healthcheck**=""
Set or alter a healthcheck for a container. The value must be of the format of:
@@ -583,7 +593,7 @@ Not implemented.
Restart should be handled via a systemd unit files. Please add your podman
commands to a unit file and allow systemd or your init system to handle the
-restarting of the container processes. See example below.
+restarting of the container processes. See *podman generate systemd*.
**--rm**=*true*|*false*
@@ -1141,21 +1151,6 @@ the uids and gids from the host.
$ podman run --uidmap 0:30000:7000 --gidmap 0:30000:7000 fedora echo hello
```
-### Running a podman container to restart inside of a systemd unit file
-
-
-```
-[Unit]
-Description=My App
-[Service]
-Restart=always
-ExecStart=/usr/bin/podman start -a my_app
-ExecStop=/usr/bin/podman stop -t 10 my_app
-KillMode=process
-[Install]
-WantedBy=multi-user.target
-```
-
### Configuring Storage Options from the command line
Podman allows for the configuration of storage by changing the values
diff --git a/docs/podman.1.md b/docs/podman.1.md
index 9c0ca8a7a..ef12cf1cc 100644
--- a/docs/podman.1.md
+++ b/docs/podman.1.md
@@ -147,6 +147,7 @@ the exit codes follow the `chroot` standard, see below:
| [podman-images(1)](podman-images.1.md) | List images in local storage. |
| [podman-import(1)](podman-import.1.md) | Import a tarball and save it as a filesystem image. |
| [podman-info(1)](podman-info.1.md) | Displays Podman related system information. |
+| [podman-init(1)](podman-init.1.md) | Initialize a container |
| [podman-inspect(1)](podman-inspect.1.md) | Display a container or image's configuration. |
| [podman-kill(1)](podman-kill.1.md) | Kill the main process in one or more containers. |
| [podman-load(1)](podman-load.1.md) | Load an image from a container image archive into container storage. |
diff --git a/install.md b/install.md
index 548b38c1b..bd7f326c3 100644
--- a/install.md
+++ b/install.md
@@ -8,6 +8,8 @@
sudo pacman -S podman
```
+If you have problems when running podman in [rootless](README.md#rootless) mode follow [these instructions](https://wiki.archlinux.org/index.php/Linux_Containers#Enable_support_to_run_unprivileged_containers_(optional))
+
#### [Fedora](https://www.fedoraproject.org), [CentOS](https://www.centos.org)
```bash
diff --git a/libpod/container_api.go b/libpod/container_api.go
index 465b23831..5bfd869b3 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -40,7 +40,7 @@ func (c *Container) Init(ctx context.Context) (err error) {
if !(c.state.State == ContainerStateConfigured ||
c.state.State == ContainerStateStopped ||
c.state.State == ContainerStateExited) {
- return errors.Wrapf(ErrCtrExists, "container %s has already been created in runtime", c.ID())
+ return errors.Wrapf(ErrCtrStateInvalid, "container %s has already been created in runtime", c.ID())
}
// don't recursively start
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 7febf6966..a791df491 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -811,8 +811,9 @@ func (c *Container) cleanupRuntime(ctx context.Context) error {
span.SetTag("struct", "container")
defer span.Finish()
- // If the container is not ContainerStateStopped, do nothing
- if c.state.State != ContainerStateStopped {
+ // If the container is not ContainerStateStopped or
+ // ContainerStateCreated, do nothing.
+ if c.state.State != ContainerStateStopped && c.state.State != ContainerStateCreated {
return nil
}
@@ -825,9 +826,14 @@ func (c *Container) cleanupRuntime(ctx context.Context) error {
return err
}
- // Our state is now Exited, as we've removed ourself from
- // the runtime.
- c.state.State = ContainerStateExited
+ // If we were Stopped, we are now Exited, as we've removed ourself
+ // from the runtime.
+ // If we were Created, we are now Configured.
+ if c.state.State == ContainerStateStopped {
+ c.state.State = ContainerStateExited
+ } else if c.state.State == ContainerStateCreated {
+ c.state.State = ContainerStateConfigured
+ }
if c.valid {
if err := c.save(); err != nil {
diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go
index 9ec897a60..d575bc9b0 100644
--- a/pkg/adapter/containers.go
+++ b/pkg/adapter/containers.go
@@ -18,6 +18,7 @@ import (
"github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/adapter/shortcuts"
+ "github.com/containers/libpod/pkg/systemdgen"
"github.com/containers/storage"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -133,6 +134,43 @@ func (r *LocalRuntime) KillContainers(ctx context.Context, cli *cliconfig.KillVa
return pool.Run()
}
+// InitContainers initializes container(s) based on CLI inputs.
+// Returns list of successful id(s), map of failed id(s) to errors, or a general
+// error not from the container.
+func (r *LocalRuntime) InitContainers(ctx context.Context, cli *cliconfig.InitValues) ([]string, map[string]error, error) {
+ maxWorkers := shared.DefaultPoolSize("init")
+ if cli.GlobalIsSet("max-workers") {
+ maxWorkers = cli.GlobalFlags.MaxWorks
+ }
+ logrus.Debugf("Setting maximum init workers to %d", maxWorkers)
+
+ ctrs, err := shortcuts.GetContainersByContext(cli.All, cli.Latest, cli.InputArgs, r.Runtime)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ pool := shared.NewPool("init", maxWorkers, len(ctrs))
+ for _, c := range ctrs {
+ ctr := c
+
+ pool.Add(shared.Job{
+ ctr.ID(),
+ func() error {
+ err := ctr.Init(ctx)
+ if err != nil {
+ // If we're initializing all containers, ignore invalid state errors
+ if cli.All && errors.Cause(err) == libpod.ErrCtrStateInvalid {
+ return nil
+ }
+ return err
+ }
+ return nil
+ },
+ })
+ }
+ return pool.Run()
+}
+
// RemoveContainers removes container(s) based on CLI inputs.
func (r *LocalRuntime) RemoveContainers(ctx context.Context, cli *cliconfig.RmValues) ([]string, map[string]error, error) {
var (
@@ -876,3 +914,47 @@ func cleanupContainer(ctx context.Context, ctr *libpod.Container, runtime *Local
}
return nil
}
+
+// Port displays port information about existing containers
+func (r *LocalRuntime) Port(c *cliconfig.PortValues) ([]*Container, error) {
+ var (
+ portContainers []*Container
+ containers []*libpod.Container
+ err error
+ )
+
+ if !c.All {
+ containers, err = shortcuts.GetContainersByContext(false, c.Latest, c.InputArgs, r.Runtime)
+ } else {
+ containers, err = r.Runtime.GetRunningContainers()
+ }
+ if err != nil {
+ return nil, err
+ }
+
+ //Convert libpod containers to adapter Containers
+ for _, con := range containers {
+ if state, _ := con.State(); state != libpod.ContainerStateRunning {
+ continue
+ }
+ portContainers = append(portContainers, &Container{con})
+ }
+ return portContainers, nil
+}
+
+// GenerateSystemd creates a unit file for a container
+func (r *LocalRuntime) GenerateSystemd(c *cliconfig.GenerateSystemdValues) (string, error) {
+ ctr, err := r.Runtime.LookupContainer(c.InputArgs[0])
+ if err != nil {
+ return "", err
+ }
+ timeout := int(ctr.StopTimeout())
+ if c.StopTimeout >= 0 {
+ timeout = int(c.StopTimeout)
+ }
+ name := ctr.ID()
+ if c.Name {
+ name = ctr.Name()
+ }
+ return systemdgen.CreateSystemdUnitAsString(name, ctr.ID(), c.RestartPolicy, ctr.Config().StaticDir, timeout)
+}
diff --git a/pkg/adapter/containers_remote.go b/pkg/adapter/containers_remote.go
index a3a48a564..201249fc3 100644
--- a/pkg/adapter/containers_remote.go
+++ b/pkg/adapter/containers_remote.go
@@ -18,6 +18,7 @@ import (
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/inspect"
"github.com/containers/libpod/pkg/varlinkapi/virtwriter"
+ "github.com/cri-o/ocicni/pkg/ocicni"
"github.com/docker/docker/pkg/term"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
@@ -63,6 +64,19 @@ func (c *Container) Unpause() error {
return err
}
+func (c *Container) PortMappings() ([]ocicni.PortMapping, error) {
+ // First check if the container belongs to a network namespace (like a pod)
+ // Taken from libpod portmappings()
+ if len(c.config.NetNsCtr) > 0 {
+ netNsCtr, err := c.Runtime.LookupContainer(c.config.NetNsCtr)
+ if err != nil {
+ return nil, errors.Wrapf(err, "unable to lookup network namespace for container %s", c.ID())
+ }
+ return netNsCtr.PortMappings()
+ }
+ return c.config.PortMappings, nil
+}
+
// Config returns a container config
func (r *LocalRuntime) Config(name string) *libpod.ContainerConfig {
// TODO the Spec being returned is not populated. Matt and I could not figure out why. Will defer
@@ -234,6 +248,40 @@ func (r *LocalRuntime) StopContainers(ctx context.Context, cli *cliconfig.StopVa
return ok, failures, nil
}
+// InitContainers initializes container(s) based on Varlink.
+// It returns a list of successful ID(s), a map of failed container ID to error,
+// or an error if a more general error occurred.
+func (r *LocalRuntime) InitContainers(ctx context.Context, cli *cliconfig.InitValues) ([]string, map[string]error, error) {
+ var (
+ ok = []string{}
+ failures = map[string]error{}
+ )
+
+ ids, err := iopodman.GetContainersByContext().Call(r.Conn, cli.All, cli.Latest, cli.InputArgs)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ for _, id := range ids {
+ initialized, err := iopodman.InitContainer().Call(r.Conn, id)
+ if err != nil {
+ if cli.All {
+ switch err.(type) {
+ case *iopodman.InvalidState:
+ ok = append(ok, initialized)
+ default:
+ failures[id] = err
+ }
+ } else {
+ failures[id] = err
+ }
+ } else {
+ ok = append(ok, initialized)
+ }
+ }
+ return ok, failures, nil
+}
+
// KillContainers sends signal to container(s) based on varlink.
// Returns list of successful id(s), map of failed id(s) + error, or error not from container
func (r *LocalRuntime) KillContainers(ctx context.Context, cli *cliconfig.KillValues, signal syscall.Signal) ([]string, map[string]error, error) {
@@ -888,3 +936,28 @@ func (r *LocalRuntime) Prune(ctx context.Context, maxWorkers int, force bool) ([
func (r *LocalRuntime) CleanupContainers(ctx context.Context, cli *cliconfig.CleanupValues) ([]string, map[string]error, error) {
return nil, nil, errors.New("container cleanup not supported for remote clients")
}
+
+// Port displays port information about existing containers
+func (r *LocalRuntime) Port(c *cliconfig.PortValues) ([]*Container, error) {
+ var (
+ containers []*Container
+ err error
+ )
+ // This one is a bit odd because when all is used, we only use running containers.
+ if !c.All {
+ containers, err = r.GetContainersByContext(false, c.Latest, c.InputArgs)
+ } else {
+ // we need to only use running containers if all
+ filters := []string{libpod.ContainerStateRunning.String()}
+ containers, err = r.LookupContainersWithStatus(filters)
+ }
+ if err != nil {
+ return nil, err
+ }
+ return containers, nil
+}
+
+// GenerateSystemd creates a systemd until for a container
+func (r *LocalRuntime) GenerateSystemd(c *cliconfig.GenerateSystemdValues) (string, error) {
+ return iopodman.GenerateSystemd().Call(r.Conn, c.InputArgs[0], c.RestartPolicy, int64(c.StopTimeout), c.Name)
+}
diff --git a/pkg/adapter/runtime_remote.go b/pkg/adapter/runtime_remote.go
index 6102daccf..4986d16f7 100644
--- a/pkg/adapter/runtime_remote.go
+++ b/pkg/adapter/runtime_remote.go
@@ -889,3 +889,20 @@ func (r *LocalRuntime) GenerateKube(c *cliconfig.GenerateKubeValues) (*v1.Pod, *
err = json.Unmarshal([]byte(reply.Service), &service)
return &pod, &service, err
}
+
+// GetContainersByContext looks up containers based on the cli input of all, latest, or a list
+func (r *LocalRuntime) GetContainersByContext(all bool, latest bool, namesOrIDs []string) ([]*Container, error) {
+ var containers []*Container
+ cids, err := iopodman.GetContainersByContext().Call(r.Conn, all, latest, namesOrIDs)
+ if err != nil {
+ return nil, err
+ }
+ for _, cid := range cids {
+ ctr, err := r.LookupContainer(cid)
+ if err != nil {
+ return nil, err
+ }
+ containers = append(containers, ctr)
+ }
+ return containers, nil
+}
diff --git a/pkg/systemdgen/systemdgen.go b/pkg/systemdgen/systemdgen.go
new file mode 100644
index 000000000..3d1c31b5d
--- /dev/null
+++ b/pkg/systemdgen/systemdgen.go
@@ -0,0 +1,43 @@
+package systemdgen
+
+import (
+ "fmt"
+ "path/filepath"
+
+ "github.com/pkg/errors"
+)
+
+var template = `[Unit]
+Description=%s Podman Container
+[Service]
+Restart=%s
+ExecStart=/usr/bin/podman start %s
+ExecStop=/usr/bin/podman stop -t %d %s
+KillMode=none
+Type=forking
+PIDFile=%s
+[Install]
+WantedBy=multi-user.target`
+
+var restartPolicies = []string{"no", "on-success", "on-failure", "on-abnormal", "on-watchdog", "on-abort", "always"}
+
+// ValidateRestartPolicy checks that the user-provided policy is valid
+func ValidateRestartPolicy(restart string) error {
+ for _, i := range restartPolicies {
+ if i == restart {
+ return nil
+ }
+ }
+ return errors.Errorf("%s is not a valid restart policy", restart)
+}
+
+// CreateSystemdUnitAsString takes variables to create a systemd unit file used to control
+// a libpod container
+func CreateSystemdUnitAsString(name, cid, restart, pidPath string, stopTimeout int) (string, error) {
+ if err := ValidateRestartPolicy(restart); err != nil {
+ return "", err
+ }
+ pidFile := filepath.Join(pidPath, fmt.Sprintf("%s.pid", cid))
+ unit := fmt.Sprintf(template, name, restart, name, stopTimeout, name, pidFile)
+ return unit, nil
+}
diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go
index 872c7bc26..c8be41636 100644
--- a/pkg/varlinkapi/containers.go
+++ b/pkg/varlinkapi/containers.go
@@ -365,6 +365,21 @@ func (i *LibpodAPI) StartContainer(call iopodman.VarlinkCall, name string) error
return call.ReplyStartContainer(ctr.ID())
}
+// InitContainer initializes the container given by Varlink.
+func (i *LibpodAPI) InitContainer(call iopodman.VarlinkCall, name string) error {
+ ctr, err := i.Runtime.LookupContainer(name)
+ if err != nil {
+ return call.ReplyContainerNotFound(name, err.Error())
+ }
+ if err := ctr.Init(getContext()); err != nil {
+ if errors.Cause(err) == libpod.ErrCtrStateInvalid {
+ return call.ReplyInvalidState(ctr.ID(), err.Error())
+ }
+ return call.ReplyErrorOccurred(err.Error())
+ }
+ return call.ReplyInitContainer(ctr.ID())
+}
+
// StopContainer ...
func (i *LibpodAPI) StopContainer(call iopodman.VarlinkCall, name string, timeout int64) error {
ctr, err := i.Runtime.LookupContainer(name)
diff --git a/pkg/varlinkapi/generate.go b/pkg/varlinkapi/generate.go
index bc600c397..9dc20d582 100644
--- a/pkg/varlinkapi/generate.go
+++ b/pkg/varlinkapi/generate.go
@@ -6,6 +6,7 @@ import (
"encoding/json"
"github.com/containers/libpod/cmd/podman/shared"
iopodman "github.com/containers/libpod/cmd/podman/varlink"
+ "github.com/containers/libpod/pkg/systemdgen"
)
// GenerateKube ...
@@ -28,3 +29,24 @@ func (i *LibpodAPI) GenerateKube(call iopodman.VarlinkCall, name string, service
Service: string(servB),
})
}
+
+// GenerateSystemd ...
+func (i *LibpodAPI) GenerateSystemd(call iopodman.VarlinkCall, nameOrID, restart string, stopTimeout int64, useName bool) error {
+ ctr, err := i.Runtime.LookupContainer(nameOrID)
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+ timeout := int(ctr.StopTimeout())
+ if stopTimeout >= 0 {
+ timeout = int(stopTimeout)
+ }
+ name := ctr.ID()
+ if useName {
+ name = ctr.Name()
+ }
+ unit, err := systemdgen.CreateSystemdUnitAsString(name, ctr.ID(), restart, ctr.Config().StaticDir, timeout)
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+ return call.ReplyGenerateSystemd(unit)
+}
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go
new file mode 100644
index 000000000..940e894bc
--- /dev/null
+++ b/test/e2e/generate_systemd_test.go
@@ -0,0 +1,74 @@
+// +build !remoteclient
+
+package integration
+
+import (
+ . "github.com/containers/libpod/test/utils"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+ "os"
+)
+
+var _ = Describe("Podman generate systemd", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest *PodmanTestIntegration
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
+ podmanTest.RestoreAllArtifacts()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ f := CurrentGinkgoTestDescription()
+ processTestResult(f)
+
+ })
+
+ It("podman generate systemd on bogus container", func() {
+ session := podmanTest.Podman([]string{"generate", "systemd", "foobar"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Not(Equal(0)))
+ })
+
+ It("podman generate systemd bad restart policy", func() {
+ session := podmanTest.Podman([]string{"generate", "systemd", "--restart-policy", "never", "foobar"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Not(Equal(0)))
+ })
+
+ It("podman generate systemd bad timeout value", func() {
+ session := podmanTest.Podman([]string{"generate", "systemd", "--timeout", "-1", "foobar"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Not(Equal(0)))
+ })
+
+ It("podman generate systemd", func() {
+ n := podmanTest.Podman([]string{"run", "--name", "nginx", "-dt", nginx})
+ n.WaitWithDefaultTimeout()
+ Expect(n.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"generate", "systemd", "nginx"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
+ It("podman generate systemd with timeout", func() {
+ n := podmanTest.Podman([]string{"run", "--name", "nginx", "-dt", nginx})
+ n.WaitWithDefaultTimeout()
+ Expect(n.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"generate", "systemd", "--timeout", "5", "nginx"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
+})
diff --git a/test/e2e/init_test.go b/test/e2e/init_test.go
new file mode 100644
index 000000000..5865930a5
--- /dev/null
+++ b/test/e2e/init_test.go
@@ -0,0 +1,129 @@
+package integration
+
+import (
+ "os"
+
+ . "github.com/containers/libpod/test/utils"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("Podman init", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest *PodmanTestIntegration
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
+ podmanTest.RestoreAllArtifacts()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ f := CurrentGinkgoTestDescription()
+ processTestResult(f)
+
+ })
+
+ It("podman init bogus container", func() {
+ session := podmanTest.Podman([]string{"start", "123456"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ })
+
+ It("podman init with no arguments", func() {
+ session := podmanTest.Podman([]string{"start"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ })
+
+ It("podman init single container by ID", func() {
+ session := podmanTest.Podman([]string{"create", "-d", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid := session.OutputToString()
+ init := podmanTest.Podman([]string{"init", cid})
+ init.WaitWithDefaultTimeout()
+ Expect(init.ExitCode()).To(Equal(0))
+ result := podmanTest.Podman([]string{"inspect", cid})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ conData := result.InspectContainerToJSON()
+ Expect(conData[0].State.Status).To(Equal("created"))
+ })
+
+ It("podman init single container by name", func() {
+ name := "test1"
+ session := podmanTest.Podman([]string{"create", "--name", name, "-d", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ init := podmanTest.Podman([]string{"init", name})
+ init.WaitWithDefaultTimeout()
+ Expect(init.ExitCode()).To(Equal(0))
+ result := podmanTest.Podman([]string{"inspect", name})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ conData := result.InspectContainerToJSON()
+ Expect(conData[0].State.Status).To(Equal("created"))
+ })
+
+ It("podman init latest container", func() {
+ session := podmanTest.Podman([]string{"create", "-d", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ init := podmanTest.Podman([]string{"init", "--latest"})
+ init.WaitWithDefaultTimeout()
+ Expect(init.ExitCode()).To(Equal(0))
+ result := podmanTest.Podman([]string{"inspect", "--latest"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ conData := result.InspectContainerToJSON()
+ Expect(conData[0].State.Status).To(Equal("created"))
+ })
+
+ It("podman init all three containers, one running", func() {
+ session := podmanTest.Podman([]string{"create", "--name", "test1", "-d", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session2 := podmanTest.Podman([]string{"create", "--name", "test2", "-d", ALPINE, "ls"})
+ session2.WaitWithDefaultTimeout()
+ Expect(session2.ExitCode()).To(Equal(0))
+ session3 := podmanTest.Podman([]string{"run", "--name", "test3", "-d", ALPINE, "top"})
+ session3.WaitWithDefaultTimeout()
+ Expect(session3.ExitCode()).To(Equal(0))
+ init := podmanTest.Podman([]string{"init", "--all"})
+ init.WaitWithDefaultTimeout()
+ Expect(init.ExitCode()).To(Equal(0))
+ result := podmanTest.Podman([]string{"inspect", "test1"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ conData := result.InspectContainerToJSON()
+ Expect(conData[0].State.Status).To(Equal("created"))
+ result2 := podmanTest.Podman([]string{"inspect", "test2"})
+ result2.WaitWithDefaultTimeout()
+ Expect(result2.ExitCode()).To(Equal(0))
+ conData2 := result2.InspectContainerToJSON()
+ Expect(conData2[0].State.Status).To(Equal("created"))
+ result3 := podmanTest.Podman([]string{"inspect", "test3"})
+ result3.WaitWithDefaultTimeout()
+ Expect(result3.ExitCode()).To(Equal(0))
+ conData3 := result3.InspectContainerToJSON()
+ Expect(conData3[0].State.Status).To(Equal("running"))
+ })
+
+ It("podman init running container errors", func() {
+ session := podmanTest.Podman([]string{"run", "-d", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ init := podmanTest.Podman([]string{"init", "--latest"})
+ init.WaitWithDefaultTimeout()
+ Expect(init.ExitCode()).To(Equal(125))
+ })
+})
diff --git a/vendor.conf b/vendor.conf
index ace2298aa..c99b2c1d7 100644
--- a/vendor.conf
+++ b/vendor.conf
@@ -19,7 +19,7 @@ github.com/containers/image v1.5.1
github.com/vbauerster/mpb v3.3.4
github.com/mattn/go-isatty v0.0.4
github.com/VividCortex/ewma v1.1.1
-github.com/containers/storage v1.12.5
+github.com/containers/storage v1.12.6
github.com/containers/psgo v1.2.1
github.com/coreos/go-systemd v14
github.com/coreos/pkg v4
@@ -94,11 +94,11 @@ k8s.io/apimachinery kubernetes-1.10.13-beta.0 https://github.com/kubernetes/apim
k8s.io/client-go kubernetes-1.10.13-beta.0 https://github.com/kubernetes/client-go
github.com/mrunalp/fileutils 7d4729fb36185a7c1719923406c9d40e54fb93c7
github.com/varlink/go 64e07fabffa33e385817b41971cf2674f692f391
-github.com/containers/buildah 34e7eba408282e890e61395b6d97e58b88e14d25
+github.com/containers/buildah v1.8.1
# TODO: Gotty has not been updated since 2012. Can we find replacement?
github.com/Nvveen/Gotty cd527374f1e5bff4938207604a14f2e38a9cf512
github.com/fsouza/go-dockerclient v1.3.0
-github.com/openshift/imagebuilder 705fe9255c57f8505efb9723a9ac4082b67973bc
+github.com/openshift/imagebuilder v1.1.0
github.com/ulikunitz/xz v0.5.5
github.com/coreos/go-iptables v0.4.0
github.com/google/shlex c34317bd91bf98fab745d77b03933cf8769299fe
diff --git a/vendor/github.com/containers/buildah/buildah.go b/vendor/github.com/containers/buildah/buildah.go
index e29e69383..13526057c 100644
--- a/vendor/github.com/containers/buildah/buildah.go
+++ b/vendor/github.com/containers/buildah/buildah.go
@@ -26,7 +26,7 @@ const (
Package = "buildah"
// Version for the Package. Bump version in contrib/rpm/buildah.spec
// too.
- Version = "1.9.0-dev"
+ Version = "1.8.1"
// The value we use to identify what type of information, currently a
// serialized Builder structure, we are using as per-container state.
// This should only be changed when we make incompatible changes to
diff --git a/vendor/github.com/containers/buildah/imagebuildah/build.go b/vendor/github.com/containers/buildah/imagebuildah/build.go
index d9909cdc8..85848e297 100644
--- a/vendor/github.com/containers/buildah/imagebuildah/build.go
+++ b/vendor/github.com/containers/buildah/imagebuildah/build.go
@@ -1558,6 +1558,9 @@ func (b *Executor) Build(ctx context.Context, stages imagebuilder.Stages) (image
// stages.
for i := range cleanupImages {
removeID := cleanupImages[len(cleanupImages)-i-1]
+ if removeID == imageID {
+ continue
+ }
if _, err := b.store.DeleteImage(removeID, true); err != nil {
logrus.Debugf("failed to remove intermediate image %q: %v", removeID, err)
if b.forceRmIntermediateCtrs || errors.Cause(err) != storage.ErrImageUsedByContainer {
@@ -1663,6 +1666,7 @@ func (b *Executor) Build(ctx context.Context, stages imagebuilder.Stages) (image
if !b.layers {
cleanupImages = append(cleanupImages, imageID)
}
+ imageID = ""
}
}
@@ -1812,9 +1816,10 @@ func (b *Executor) deleteSuccessfulIntermediateCtrs() error {
}
func (s *StageExecutor) EnsureContainerPath(path string) error {
- _, err := os.Stat(filepath.Join(s.mountPoint, path))
+ targetPath := filepath.Join(s.mountPoint, path)
+ _, err := os.Lstat(targetPath)
if err != nil && os.IsNotExist(err) {
- err = os.MkdirAll(filepath.Join(s.mountPoint, path), 0755)
+ err = os.MkdirAll(targetPath, 0755)
}
if err != nil {
return errors.Wrapf(err, "error ensuring container path %q", path)
diff --git a/vendor/github.com/containers/buildah/pkg/cli/common.go b/vendor/github.com/containers/buildah/pkg/cli/common.go
index 7fa0a7777..e7a571db6 100644
--- a/vendor/github.com/containers/buildah/pkg/cli/common.go
+++ b/vendor/github.com/containers/buildah/pkg/cli/common.go
@@ -96,7 +96,7 @@ type FromAndBudResults struct {
SecurityOpt []string
ShmSize string
Ulimit []string
- Volume []string
+ Volumes []string
}
// GetUserNSFlags returns the common flags for usernamespace
@@ -190,7 +190,7 @@ func GetFromAndBudFlags(flags *FromAndBudResults, usernsResults *UserNSResults,
fs.StringArrayVar(&flags.SecurityOpt, "security-opt", []string{}, "security options (default [])")
fs.StringVar(&flags.ShmSize, "shm-size", "65536k", "size of '/dev/shm'. The format is `<number><unit>`.")
fs.StringSliceVar(&flags.Ulimit, "ulimit", []string{}, "ulimit options (default [])")
- fs.StringSliceVarP(&flags.Volume, "volume", "v", []string{}, "bind mount a volume into the container (default [])")
+ fs.StringSliceVarP(&flags.Volumes, "volume", "v", []string{}, "bind mount a volume into the container (default [])")
// Add in the usernamespace and namespaceflags
usernsFlags := GetUserNSFlags(usernsResults)
diff --git a/vendor/github.com/containers/buildah/pkg/parse/parse.go b/vendor/github.com/containers/buildah/pkg/parse/parse.go
index bec41f3ae..e8517eafb 100644
--- a/vendor/github.com/containers/buildah/pkg/parse/parse.go
+++ b/vendor/github.com/containers/buildah/pkg/parse/parse.go
@@ -149,27 +149,42 @@ func parseSecurityOpts(securityOpts []string, commonOpts *buildah.CommonBuildOpt
return nil
}
+func ParseVolume(volume string) (specs.Mount, error) {
+ mount := specs.Mount{}
+ arr := strings.SplitN(volume, ":", 3)
+ if len(arr) < 2 {
+ return mount, errors.Errorf("incorrect volume format %q, should be host-dir:ctr-dir[:option]", volume)
+ }
+ if err := validateVolumeHostDir(arr[0]); err != nil {
+ return mount, err
+ }
+ if err := validateVolumeCtrDir(arr[1]); err != nil {
+ return mount, err
+ }
+ mountOptions := ""
+ if len(arr) > 2 {
+ mountOptions = arr[2]
+ if err := validateVolumeOpts(arr[2]); err != nil {
+ return mount, err
+ }
+ }
+ mountOpts := strings.Split(mountOptions, ",")
+ mount.Source = arr[0]
+ mount.Destination = arr[1]
+ mount.Type = "rbind"
+ mount.Options = mountOpts
+ return mount, nil
+}
+
// ParseVolumes validates the host and container paths passed in to the --volume flag
func ParseVolumes(volumes []string) error {
if len(volumes) == 0 {
return nil
}
for _, volume := range volumes {
- arr := strings.SplitN(volume, ":", 3)
- if len(arr) < 2 {
- return errors.Errorf("incorrect volume format %q, should be host-dir:ctr-dir[:option]", volume)
- }
- if err := validateVolumeHostDir(arr[0]); err != nil {
+ if _, err := ParseVolume(volume); err != nil {
return err
}
- if err := validateVolumeCtrDir(arr[1]); err != nil {
- return err
- }
- if len(arr) > 2 {
- if err := validateVolumeOpts(arr[2]); err != nil {
- return err
- }
- }
}
return nil
}
diff --git a/vendor/github.com/containers/buildah/run_linux.go b/vendor/github.com/containers/buildah/run_linux.go
index 8597e3656..1acf655eb 100644
--- a/vendor/github.com/containers/buildah/run_linux.go
+++ b/vendor/github.com/containers/buildah/run_linux.go
@@ -142,7 +142,7 @@ func (b *Builder) Run(command []string, options RunOptions) error {
g = nil
logrus.Debugf("ensuring working directory %q exists", filepath.Join(mountPoint, spec.Process.Cwd))
- if err = os.MkdirAll(filepath.Join(mountPoint, spec.Process.Cwd), 0755); err != nil {
+ if err = os.MkdirAll(filepath.Join(mountPoint, spec.Process.Cwd), 0755); err != nil && !os.IsExist(err) {
return errors.Wrapf(err, "error ensuring working directory %q exists", spec.Process.Cwd)
}
diff --git a/vendor/github.com/containers/buildah/util/util.go b/vendor/github.com/containers/buildah/util/util.go
index 698d79a81..629d9748c 100644
--- a/vendor/github.com/containers/buildah/util/util.go
+++ b/vendor/github.com/containers/buildah/util/util.go
@@ -197,7 +197,7 @@ func FindImage(store storage.Store, firstRegistry string, systemContext *types.S
break
}
if ref == nil || img == nil {
- return nil, nil, errors.Wrapf(err, "error locating image with name %q", image)
+ return nil, nil, errors.Wrapf(err, "error locating image with name %q (%v)", image, names)
}
return ref, img, nil
}
diff --git a/vendor/github.com/containers/storage/drivers/driver.go b/vendor/github.com/containers/storage/drivers/driver.go
index dda172574..e8f8bd5a7 100644
--- a/vendor/github.com/containers/storage/drivers/driver.go
+++ b/vendor/github.com/containers/storage/drivers/driver.go
@@ -40,6 +40,7 @@ var (
type CreateOpts struct {
MountLabel string
StorageOpt map[string]string
+ *idtools.IDMappings
}
// MountOpts contains optional arguments for LayerStope.Mount() methods.
diff --git a/vendor/github.com/containers/storage/drivers/overlay/overlay.go b/vendor/github.com/containers/storage/drivers/overlay/overlay.go
index 5d667d8c6..ef83b6c87 100644
--- a/vendor/github.com/containers/storage/drivers/overlay/overlay.go
+++ b/vendor/github.com/containers/storage/drivers/overlay/overlay.go
@@ -474,10 +474,22 @@ func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) (retErr
func (d *Driver) create(id, parent string, opts *graphdriver.CreateOpts) (retErr error) {
dir := d.dir(id)
- rootUID, rootGID, err := idtools.GetRootUIDGID(d.uidMaps, d.gidMaps)
+ uidMaps := d.uidMaps
+ gidMaps := d.gidMaps
+
+ if opts != nil && opts.IDMappings != nil {
+ uidMaps = opts.IDMappings.UIDs()
+ gidMaps = opts.IDMappings.GIDs()
+ }
+
+ rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
if err != nil {
return err
}
+ // Make the link directory if it does not exist
+ if err := idtools.MkdirAllAs(path.Join(d.home, linkDir), 0700, rootUID, rootGID); err != nil && !os.IsExist(err) {
+ return err
+ }
if err := idtools.MkdirAllAs(path.Dir(dir), 0700, rootUID, rootGID); err != nil {
return err
}
@@ -690,9 +702,17 @@ func (d *Driver) recreateSymlinks() error {
if err != nil {
return fmt.Errorf("error reading driver home directory %q: %v", d.home, err)
}
+ // This makes the link directory if it doesn't exist
+ rootUID, rootGID, err := idtools.GetRootUIDGID(d.uidMaps, d.gidMaps)
+ if err != nil {
+ return err
+ }
+ if err := idtools.MkdirAllAs(path.Join(d.home, linkDir), 0700, rootUID, rootGID); err != nil && !os.IsExist(err) {
+ return err
+ }
for _, dir := range dirs {
- // Skip over the linkDir
- if dir.Name() == linkDir || dir.Mode().IsRegular() {
+ // Skip over the linkDir and anything that is not a directory
+ if dir.Name() == linkDir || !dir.Mode().IsDir() {
continue
}
// Read the "link" file under each layer to get the name of the symlink
diff --git a/vendor/github.com/containers/storage/drivers/vfs/driver.go b/vendor/github.com/containers/storage/drivers/vfs/driver.go
index 5941ccc17..9e256858c 100644
--- a/vendor/github.com/containers/storage/drivers/vfs/driver.go
+++ b/vendor/github.com/containers/storage/drivers/vfs/driver.go
@@ -123,8 +123,13 @@ func (d *Driver) create(id, parent string, opts *graphdriver.CreateOpts, ro bool
return fmt.Errorf("--storage-opt is not supported for vfs")
}
+ idMappings := d.idMappings
+ if opts != nil && opts.IDMappings != nil {
+ idMappings = opts.IDMappings
+ }
+
dir := d.dir(id)
- rootIDs := d.idMappings.RootPair()
+ rootIDs := idMappings.RootPair()
if err := idtools.MkdirAllAndChown(filepath.Dir(dir), 0700, rootIDs); err != nil {
return err
}
diff --git a/vendor/github.com/containers/storage/layers.go b/vendor/github.com/containers/storage/layers.go
index 110e737b2..7bec0aea6 100644
--- a/vendor/github.com/containers/storage/layers.go
+++ b/vendor/github.com/containers/storage/layers.go
@@ -614,6 +614,7 @@ func (r *layerStore) Put(id string, parentLayer *Layer, names []string, mountLab
opts := drivers.CreateOpts{
MountLabel: mountLabel,
StorageOpt: options,
+ IDMappings: idMappings,
}
if moreOptions.TemplateLayer != "" {
if err = r.driver.CreateFromTemplate(id, moreOptions.TemplateLayer, templateIDMappings, parent, parentMappings, &opts, writeable); err != nil {
diff --git a/vendor/github.com/openshift/imagebuilder/vendor.conf b/vendor/github.com/openshift/imagebuilder/vendor.conf
index 39b216feb..e437b79c3 100644
--- a/vendor/github.com/openshift/imagebuilder/vendor.conf
+++ b/vendor/github.com/openshift/imagebuilder/vendor.conf
@@ -1,12 +1,11 @@
github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109
-github.com/containerd/continuity 004b46473808b3e7a4a3049c20e4376c91eb966d
+github.com/containers/storage v1.2
github.com/docker/docker b68221c37ee597950364788204546f9c9d0e46a1
github.com/docker/go-connections 97c2040d34dfae1d1b1275fa3a78dbdd2f41cf7e
github.com/docker/go-units 2fb04c6466a548a03cb009c5569ee1ab1e35398e
github.com/fsouza/go-dockerclient openshift-4.0 https://github.com/openshift/go-dockerclient.git
github.com/gogo/protobuf c5a62797aee0054613cc578653a16c6237fef080
github.com/golang/glog 23def4e6c14b4da8ac2ed8007337bc5eb5007998
-github.com/golang/protobuf v1.3.0
github.com/konsorten/go-windows-terminal-sequences f55edac94c9bbba5d6182a4be46d86a2c9b5b50e
github.com/Microsoft/go-winio 1a8911d1ed007260465c3bfbbc785ac6915a0bb8
github.com/Nvveen/Gotty cd527374f1e5bff4938207604a14f2e38a9cf512
@@ -14,8 +13,8 @@ github.com/opencontainers/go-digest ac19fd6e7483ff933754af248d80be865e543d22
github.com/opencontainers/image-spec 243ea084a44451d27322fed02b682d99e2af3ba9
github.com/opencontainers/runc 923a8f8a9a07aceada5fc48c4d37e905d9b019b5
github.com/pkg/errors 27936f6d90f9c8e1145f11ed52ffffbfdb9e0af7
+github.com/pquerna/ffjson d49c2bc1aa135aad0c6f4fc2056623ec78f5d5ac
github.com/sirupsen/logrus d7b6bf5e4d26448fd977d07d745a2a66097ddecb
golang.org/x/crypto ff983b9c42bc9fbf91556e191cc8efb585c16908
golang.org/x/net 45ffb0cd1ba084b73e26dee67e667e1be5acce83
-golang.org/x/sync 37e7f081c4d4c64e13b10787722085407fe5d15f
golang.org/x/sys 7fbe1cd0fcc20051e1fcb87fbabec4a1bacaaeba