diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-03-15 15:41:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-15 15:41:52 -0400 |
commit | fa0d3c564a0868e79d46d0bfbfea40a98456f2b4 (patch) | |
tree | 3e472248123febf509d7c3e12f1c42691a21b439 | |
parent | 4e2334c1493a03dc26b89cb00b321b268c3ca9ea (diff) | |
parent | 33aa2f2d1c8476a973d83dfefacbb60a36d8d4b1 (diff) | |
download | podman-fa0d3c564a0868e79d46d0bfbfea40a98456f2b4.tar.gz podman-fa0d3c564a0868e79d46d0bfbfea40a98456f2b4.tar.bz2 podman-fa0d3c564a0868e79d46d0bfbfea40a98456f2b4.zip |
Merge pull request #13514 from Luap99/bindings
fix breaking change in pkg/bindings
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | pkg/bindings/containers/checkpoint.go | 9 | ||||
-rw-r--r-- | pkg/bindings/containers/types.go | 23 | ||||
-rw-r--r-- | pkg/bindings/containers/types_restore_options.go | 15 |
4 files changed, 39 insertions, 10 deletions
@@ -192,7 +192,7 @@ endif # dependencies. This is only used for the Windows installer task (podman.msi), which must # include this lightweight helper binary. # -GV_GITURL=git://github.com/containers/gvisor-tap-vsock.git +GV_GITURL=https://github.com/containers/gvisor-tap-vsock.git GV_SHA=e943b1806d94d387c4c38d96719432d50a84bbd0 ### diff --git a/pkg/bindings/containers/checkpoint.go b/pkg/bindings/containers/checkpoint.go index 84590d052..bcb944488 100644 --- a/pkg/bindings/containers/checkpoint.go +++ b/pkg/bindings/containers/checkpoint.go @@ -79,7 +79,14 @@ func Restore(ctx context.Context, nameOrID string, options *RestoreOptions) (*en // Open the to-be-imported archive if needed. var r io.Reader - if i := options.GetImportArchive(); i != "" { + i := options.GetImportArchive() + if i == "" { + // backwards compat, ImportAchive is a typo but we still have to + // support this to avoid breaking users + // TODO: remove ImportAchive with 5.0 + i = options.GetImportAchive() + } + if i != "" { params.Set("import", "true") r, err = os.Open(i) if err != nil { diff --git a/pkg/bindings/containers/types.go b/pkg/bindings/containers/types.go index 3c8b1eefa..c87f82bf4 100644 --- a/pkg/bindings/containers/types.go +++ b/pkg/bindings/containers/types.go @@ -64,14 +64,21 @@ type RestoreOptions struct { IgnoreVolumes *bool IgnoreStaticIP *bool IgnoreStaticMAC *bool - ImportArchive *string - Keep *bool - Name *string - TCPEstablished *bool - Pod *string - PrintStats *bool - PublishPorts []string - FileLocks *bool + // ImportAchive is the path to an archive which contains the checkpoint data. + // + // Deprecated: Use ImportArchive instead. This field name is a typo and + // will be removed in a future major release. + ImportAchive *string + // ImportArchive is the path to an archive which contains the checkpoint data. + // ImportArchive is preferred over ImportAchive when both are set. + ImportArchive *string + Keep *bool + Name *string + TCPEstablished *bool + Pod *string + PrintStats *bool + PublishPorts []string + FileLocks *bool } //go:generate go run ../generator/generator.go CreateOptions diff --git a/pkg/bindings/containers/types_restore_options.go b/pkg/bindings/containers/types_restore_options.go index e8a0e236c..b1b14a704 100644 --- a/pkg/bindings/containers/types_restore_options.go +++ b/pkg/bindings/containers/types_restore_options.go @@ -77,6 +77,21 @@ func (o *RestoreOptions) GetIgnoreStaticMAC() bool { return *o.IgnoreStaticMAC } +// WithImportAchive set field ImportAchive to given value +func (o *RestoreOptions) WithImportAchive(value string) *RestoreOptions { + o.ImportAchive = &value + return o +} + +// GetImportAchive returns value of field ImportAchive +func (o *RestoreOptions) GetImportAchive() string { + if o.ImportAchive == nil { + var z string + return z + } + return *o.ImportAchive +} + // WithImportArchive set field ImportArchive to given value func (o *RestoreOptions) WithImportArchive(value string) *RestoreOptions { o.ImportArchive = &value |