diff options
-rw-r--r-- | docs/README.md (renamed from docs/Readme.md) | 16 | ||||
-rw-r--r-- | docs/source/image.rst | 2 | ||||
-rw-r--r-- | docs/source/markdown/podman-machine-init.1.md | 7 | ||||
-rw-r--r-- | pkg/bindings/test/containers_test.go | 9 | ||||
-rw-r--r-- | pkg/machine/qemu/machine.go | 41 |
5 files changed, 52 insertions, 23 deletions
diff --git a/docs/Readme.md b/docs/README.md index e0918cd54..83f5c79a3 100644 --- a/docs/Readme.md +++ b/docs/README.md @@ -52,3 +52,19 @@ likely caused by broken metadata needed to protect clients from cross-site-scrip style attacks. Please [notify a maintainer](https://github.com/containers/podman#communications) so they may investigate how/why the `swagger.yaml` file's CORS-metadata is incorrect, or the file isn't accessible for some other reason. + +## Local Testing + +Assuming that you have the [dependencies](https://podman.io/getting-started/installation#build-and-run-dependencies) +installed, then also install (showing Fedora in the example): + +``` +# dnf install python3-sphinx python3-recommonmark +# pip install sphinx-markdown-tables +``` +After that completes, cd to the `docs` directory in your Podman sandbox and then do `make html`. + +You can then preview the html files in `docs/build/html` with: +``` +python -m http.server 8000 --directory build/html +``` diff --git a/docs/source/image.rst b/docs/source/image.rst index 2b0ef3d43..0552df929 100644 --- a/docs/source/image.rst +++ b/docs/source/image.rst @@ -40,6 +40,6 @@ Image :doc:`trust <markdown/podman-image-trust.1>` Manage container image trust policy -:doc:`unmount <markdown/podman-unmount.1>` Unmount an image's root filesystem +:doc:`unmount <markdown/podman-image-unmount.1>` Unmount an image's root filesystem :doc:`untag <markdown/podman-untag.1>` Removes one or more names from a locally-stored image diff --git a/docs/source/markdown/podman-machine-init.1.md b/docs/source/markdown/podman-machine-init.1.md index e2ed1eb10..930086ff4 100644 --- a/docs/source/markdown/podman-machine-init.1.md +++ b/docs/source/markdown/podman-machine-init.1.md @@ -28,7 +28,12 @@ Size of the disk for the guest VM in GB. #### **\-\-ignition-path** -Fully qualified path of the ignition file +Fully qualified path of the ignition file. + +If an ignition file is provided, the file +will be copied into the user's CONF_DIR and renamed. Additionally, no SSH keys will +be generated nor will a system connection be made. It is assumed that the user will +do these things manually or handle otherwise. #### **\-\-image-path** diff --git a/pkg/bindings/test/containers_test.go b/pkg/bindings/test/containers_test.go index cb9e0721b..4f049d18b 100644 --- a/pkg/bindings/test/containers_test.go +++ b/pkg/bindings/test/containers_test.go @@ -568,15 +568,6 @@ var _ = Describe("Podman containers ", func() { Expect(err).To(BeNil()) Expect(len(reports.PruneReportsIds(pruneResponse))).To(Equal(0)) Expect(len(reports.PruneReportsErrs(pruneResponse))).To(Equal(0)) - - // Valid filter params container should be pruned now. - filters := map[string][]string{ - "until": {"0s"}, - } - pruneResponse, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filters)) - Expect(err).To(BeNil()) - Expect(len(reports.PruneReportsErrs(pruneResponse))).To(Equal(0)) - Expect(len(reports.PruneReportsIds(pruneResponse))).To(Equal(1)) }) It("podman prune running containers", func() { diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index b4427f160..b48926524 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -37,12 +37,8 @@ func NewMachine(opts machine.InitOptions) (machine.VM, error) { if len(opts.Name) > 0 { vm.Name = opts.Name } - vm.IgnitionFilePath = opts.IgnitionPath - // If no ignitionfilepath was provided, use defaults - if len(vm.IgnitionFilePath) < 1 { - ignitionFile := filepath.Join(vmConfigDir, vm.Name+".ign") - vm.IgnitionFilePath = ignitionFile - } + ignitionFile := filepath.Join(vmConfigDir, vm.Name+".ign") + vm.IgnitionFilePath = ignitionFile // An image was specified if len(opts.ImagePath) > 0 { @@ -125,6 +121,9 @@ func LoadVMByName(name string) (machine.VM, error) { // Init writes the json configuration file to the filesystem for // other verbs (start, stop) func (v *MachineVM) Init(opts machine.InitOptions) error { + var ( + key string + ) sshDir := filepath.Join(homedir.Get(), ".ssh") // GetConfDir creates the directory so no need to check for // its existence @@ -164,9 +163,13 @@ func (v *MachineVM) Init(opts machine.InitOptions) error { // Add location of bootable image v.CmdLine = append(v.CmdLine, "-drive", "if=virtio,file="+v.ImagePath) // This kind of stinks but no other way around this r/n - uri := machine.SSHRemoteConnection.MakeSSHURL("localhost", "/run/user/1000/podman/podman.sock", strconv.Itoa(v.Port), v.RemoteUsername) - if err := machine.AddConnection(&uri, v.Name, filepath.Join(sshDir, v.Name), opts.IsDefault); err != nil { - return err + if len(opts.IgnitionPath) < 1 { + uri := machine.SSHRemoteConnection.MakeSSHURL("localhost", "/run/user/1000/podman/podman.sock", strconv.Itoa(v.Port), v.RemoteUsername) + if err := machine.AddConnection(&uri, v.Name, filepath.Join(sshDir, v.Name), opts.IsDefault); err != nil { + return err + } + } else { + fmt.Println("An ignition path was provided. No SSH connection was added to Podman") } // Write the JSON file b, err := json.MarshalIndent(v, "", " ") @@ -176,9 +179,14 @@ func (v *MachineVM) Init(opts machine.InitOptions) error { if err := ioutil.WriteFile(jsonFile, b, 0644); err != nil { return err } - key, err := machine.CreateSSHKeys(v.IdentityPath) - if err != nil { - return err + + // User has provided ignition file so keygen + // will be skipped. + if len(opts.IgnitionPath) < 1 { + key, err = machine.CreateSSHKeys(v.IdentityPath) + if err != nil { + return err + } } // Run arch specific things that need to be done if err := v.prepare(); err != nil { @@ -200,6 +208,15 @@ func (v *MachineVM) Init(opts machine.InitOptions) error { return errors.Errorf("error resizing image: %q", err) } } + // If the user provides an ignition file, we need to + // copy it into the conf dir + if len(opts.IgnitionPath) > 0 { + inputIgnition, err := ioutil.ReadFile(opts.IgnitionPath) + if err != nil { + return err + } + return ioutil.WriteFile(v.IgnitionFilePath, inputIgnition, 0644) + } // Write the ignition file ign := machine.DynamicIgnition{ Name: opts.Username, |