From 1b4869cc33c85210e9b64dead87900cf9bc51e66 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Mon, 12 Aug 2024 23:02:09 -0500 Subject: [PATCH] Fix some issues with tar inputs (#126) * Go crap * Fix tar inputs * Regen SDKs --- Makefile | 6 ++- provider/cmd/provisioner/Dockerfile | 8 +++- provider/go.sum | 2 - provider/pkg/provider/cmd/builder.go | 12 ++++- provider/pkg/provider/coreutils/tar.go | 8 +++- sdk/dotnet/Coreutils/Inputs/TarArgsArgs.cs | 9 ++++ sdk/dotnet/Coreutils/Outputs/TarArgs.cs | 12 +++++ sdk/go/baremetal/coreutils/pulumiTypes.go | 18 +++++++ sdk/go/baremetal/x/coreutils/pulumiTypes.go | 18 +++++++ sdk/nodejs/types/input.ts | 3 ++ sdk/nodejs/types/output.ts | 3 ++ .../unmango_baremetal/coreutils/_inputs.py | 36 ++++++++++++++ .../unmango_baremetal/coreutils/outputs.py | 26 ++++++++++ tests/expect/contain_file.go | 6 +-- tests/go.sum | 4 -- tests/tar_test.go | 48 +++++++++++++++++++ tests/util/host.go | 4 +- 17 files changed, 206 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index b76d4349..71fdc015 100644 --- a/Makefile +++ b/Makefile @@ -204,6 +204,10 @@ $(GO_MODULES:%=.make/tidy/%): .make/tidy/%: $(addprefix %/,go.mod go.sum) docker build ${WORKING_DIR} -f $< -t ${PROVISIONER_NAME}:${DOCKER_TAG} @touch $@ +.make/provisioner_docker_test: provider/cmd/provisioner/Dockerfile .dockerignore $(PROVIDER_SRC) + docker build ${WORKING_DIR} -f $< --target test -t ${PROVISIONER_NAME}:test + @touch $@ + .make/examples/%: examples/yaml/** bin/$(PROVIDER) rm -rf ${WORKING_DIR}/examples/$* pulumi convert \ @@ -218,7 +222,7 @@ $(GO_MODULES:%=.make/tidy/%): .make/tidy/%: $(addprefix %/,go.mod go.sum) export GRPC_GO_LOG_SEVERITY_LEVEL ?= TEST_FLAGS ?= -.test/provider: .make/provisioner_test_docker_build +.test/provider: .make/provisioner_docker_test cd tests && $(GINKGO) run -v --silence-skips ${TEST_FLAGS} .test/pkg: $(PKG_SRC) diff --git a/provider/cmd/provisioner/Dockerfile b/provider/cmd/provisioner/Dockerfile index 1d8468f6..ef37201d 100644 --- a/provider/cmd/provisioner/Dockerfile +++ b/provider/cmd/provisioner/Dockerfile @@ -25,14 +25,18 @@ COPY provider/pkg/ ./pkg/ RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /out/provisioner cmd/main.go -FROM --platform=$BUILDPLATFORM ubuntu:noble-20240605 AS test +FROM --platform=$BUILDPLATFORM ubuntu:noble-20240605 AS test-base ENV DEBIAN_FRONTEND=noninteractive RUN apt update \ && apt install -y \ + curl \ wget \ - && rm -rf /var/lib/apt/lists/* + && rm -rf /var/lib/apt/lists/* \ + && mkdir /testdata \ + && curl -fLo /testdata/cni-plugins-linux-amd64-v1.5.1.tgz https://github.com/containernetworking/plugins/releases/download/v1.5.1/cni-plugins-linux-amd64-v1.5.1.tgz +FROM test-base AS test COPY --from=build /out/provisioner / ENTRYPOINT ["/provisioner"] diff --git a/provider/go.sum b/provider/go.sum index 1f6ec180..53179531 100644 --- a/provider/go.sum +++ b/provider/go.sum @@ -175,8 +175,6 @@ github.com/pulumi/pulumi-go-provider v0.21.0 h1:sDHBtWkWRrWn6klfdvDIorlUGMBt6Bwh github.com/pulumi/pulumi-go-provider v0.21.0/go.mod h1:2qQ4M1LXzv+SpY6v8JiTbPVGdeCeqfBMgsqb7WyH77o= github.com/pulumi/pulumi/pkg/v3 v3.127.0 h1:C3qa1SPegwqN5OOO9yX/4Nq0rPyVZfnWQjkVx+kvsJs= github.com/pulumi/pulumi/pkg/v3 v3.127.0/go.mod h1:p1oeYtP+nXjULDxN1hrj9hz/jFBaqIE/OS8T09079zY= -github.com/pulumi/pulumi/sdk/v3 v3.128.0 h1:5VPFfygxt6rva0bEYVQZXxsGAo2/D1wsb9erGOtXxzk= -github.com/pulumi/pulumi/sdk/v3 v3.128.0/go.mod h1:p1U24en3zt51agx+WlNboSOV8eLlPWYAkxMzVEXKbnY= github.com/pulumi/pulumi/sdk/v3 v3.129.0 h1:uZpTTwWTx7Mk8UT9FgatzxzArim47vZ6hzNCKvgvX6A= github.com/pulumi/pulumi/sdk/v3 v3.129.0/go.mod h1:p1U24en3zt51agx+WlNboSOV8eLlPWYAkxMzVEXKbnY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= diff --git a/provider/pkg/provider/cmd/builder.go b/provider/pkg/provider/cmd/builder.go index 07917191..aeb69c41 100644 --- a/provider/pkg/provider/cmd/builder.go +++ b/provider/pkg/provider/cmd/builder.go @@ -1,6 +1,10 @@ package cmd -import pb "github.com/unmango/pulumi-baremetal/gen/go/unmango/baremetal/v1alpha1" +import ( + "strconv" + + pb "github.com/unmango/pulumi-baremetal/gen/go/unmango/baremetal/v1alpha1" +) type Builder interface { FsManipulator @@ -43,6 +47,12 @@ func (b *B) Opv(value, name string) { } } +func (b *B) Opi(value int, name string) { + if value > 0 { + b.add(name, strconv.Itoa(value)) + } +} + func (b *B) Stdin(value string) { b.stdin = &value } diff --git a/provider/pkg/provider/coreutils/tar.go b/provider/pkg/provider/coreutils/tar.go index 3db9271b..50e85794 100644 --- a/provider/pkg/provider/coreutils/tar.go +++ b/provider/pkg/provider/coreutils/tar.go @@ -26,7 +26,7 @@ type TarArgs struct { Extract bool `pulumi:"extract,optional"` List bool `pulumi:"list,optional"` Update bool `pulumi:"update,optional"` - Version bool `pulummi:"version,optional"` + Version bool `pulumi:"version,optional"` // Operation modifiers NoSeek bool `pulumi:"noSeek,optional"` @@ -69,8 +69,10 @@ type TarArgs struct { ExcludeFrom string `pulumi:"excludeFrom,optional"` // File name transformations + Anchored bool `pulumi:"anchored,optional"` StripComponents int `pulumi:"stripComponents,optional"` Transform string `pulumi:"transform,optional"` + NoAnchored bool `pulumi:"noAnchored,optional"` // Informative output Verbose bool `pulumi:"verbose,optional"` @@ -123,6 +125,10 @@ func (t TarArgs) Cmd() (*pb.Command, error) { b.Opv(t.Suffix, "--suffix") b.Opv(t.Transform, "--transform") + b.Op(t.Anchored, "--anchored") + b.Op(t.NoAnchored, "--no-anchored") + b.Opi(t.StripComponents, "--strip-components") + return &pb.Command{ Bin: pb.Bin_BIN_TAR, Args: b.Args, diff --git a/sdk/dotnet/Coreutils/Inputs/TarArgsArgs.cs b/sdk/dotnet/Coreutils/Inputs/TarArgsArgs.cs index 41c7968c..871ef372 100644 --- a/sdk/dotnet/Coreutils/Inputs/TarArgsArgs.cs +++ b/sdk/dotnet/Coreutils/Inputs/TarArgsArgs.cs @@ -13,6 +13,9 @@ namespace UnMango.Baremetal.Coreutils.Inputs public sealed class TarArgsArgs : global::Pulumi.ResourceArgs { + [Input("anchored")] + public Input? Anchored { get; set; } + [Input("append")] public Input? Append { get; set; } @@ -84,6 +87,9 @@ public InputList Args [Input("lzop")] public Input? Lzop { get; set; } + [Input("noAnchored")] + public Input? NoAnchored { get; set; } + [Input("noOverwriteDir")] public Input? NoOverwriteDir { get; set; } @@ -129,6 +135,9 @@ public InputList Args [Input("verify")] public Input? Verify { get; set; } + [Input("version")] + public Input? Version { get; set; } + [Input("xz")] public Input? Xz { get; set; } diff --git a/sdk/dotnet/Coreutils/Outputs/TarArgs.cs b/sdk/dotnet/Coreutils/Outputs/TarArgs.cs index fb501bfc..f549ff85 100644 --- a/sdk/dotnet/Coreutils/Outputs/TarArgs.cs +++ b/sdk/dotnet/Coreutils/Outputs/TarArgs.cs @@ -14,6 +14,7 @@ namespace UnMango.Baremetal.Coreutils.Outputs [OutputType] public sealed class TarArgs { + public readonly bool? Anchored; public readonly bool? Append; public readonly ImmutableArray Args; public readonly bool? Bzip2; @@ -36,6 +37,7 @@ public sealed class TarArgs public readonly bool? Lzip; public readonly bool? Lzma; public readonly bool? Lzop; + public readonly bool? NoAnchored; public readonly bool? NoOverwriteDir; public readonly bool? NoSeek; public readonly bool? Overwrite; @@ -51,11 +53,14 @@ public sealed class TarArgs public readonly bool? Update; public readonly bool? Verbose; public readonly bool? Verify; + public readonly bool? Version; public readonly bool? Xz; public readonly bool? Zstd; [OutputConstructor] private TarArgs( + bool? anchored, + bool? append, ImmutableArray args, @@ -100,6 +105,8 @@ private TarArgs( bool? lzop, + bool? noAnchored, + bool? noOverwriteDir, bool? noSeek, @@ -130,10 +137,13 @@ private TarArgs( bool? verify, + bool? version, + bool? xz, bool? zstd) { + Anchored = anchored; Append = append; Args = args; Bzip2 = bzip2; @@ -156,6 +166,7 @@ private TarArgs( Lzip = lzip; Lzma = lzma; Lzop = lzop; + NoAnchored = noAnchored; NoOverwriteDir = noOverwriteDir; NoSeek = noSeek; Overwrite = overwrite; @@ -171,6 +182,7 @@ private TarArgs( Update = update; Verbose = verbose; Verify = verify; + Version = version; Xz = xz; Zstd = zstd; } diff --git a/sdk/go/baremetal/coreutils/pulumiTypes.go b/sdk/go/baremetal/coreutils/pulumiTypes.go index a5432b36..b4692df7 100644 --- a/sdk/go/baremetal/coreutils/pulumiTypes.go +++ b/sdk/go/baremetal/coreutils/pulumiTypes.go @@ -584,6 +584,7 @@ func (o RmArgsTypeOutput) Verbose() pulumi.BoolPtrOutput { } type TarArgsType struct { + Anchored *bool `pulumi:"anchored"` Append *bool `pulumi:"append"` Args []string `pulumi:"args"` Bzip2 *bool `pulumi:"bzip2"` @@ -606,6 +607,7 @@ type TarArgsType struct { Lzip *bool `pulumi:"lzip"` Lzma *bool `pulumi:"lzma"` Lzop *bool `pulumi:"lzop"` + NoAnchored *bool `pulumi:"noAnchored"` NoOverwriteDir *bool `pulumi:"noOverwriteDir"` NoSeek *bool `pulumi:"noSeek"` Overwrite *bool `pulumi:"overwrite"` @@ -621,6 +623,7 @@ type TarArgsType struct { Update *bool `pulumi:"update"` Verbose *bool `pulumi:"verbose"` Verify *bool `pulumi:"verify"` + Version *bool `pulumi:"version"` Xz *bool `pulumi:"xz"` Zstd *bool `pulumi:"zstd"` } @@ -637,6 +640,7 @@ type TarArgsTypeInput interface { } type TarArgsTypeArgs struct { + Anchored pulumi.BoolPtrInput `pulumi:"anchored"` Append pulumi.BoolPtrInput `pulumi:"append"` Args pulumi.StringArrayInput `pulumi:"args"` Bzip2 pulumi.BoolPtrInput `pulumi:"bzip2"` @@ -659,6 +663,7 @@ type TarArgsTypeArgs struct { Lzip pulumi.BoolPtrInput `pulumi:"lzip"` Lzma pulumi.BoolPtrInput `pulumi:"lzma"` Lzop pulumi.BoolPtrInput `pulumi:"lzop"` + NoAnchored pulumi.BoolPtrInput `pulumi:"noAnchored"` NoOverwriteDir pulumi.BoolPtrInput `pulumi:"noOverwriteDir"` NoSeek pulumi.BoolPtrInput `pulumi:"noSeek"` Overwrite pulumi.BoolPtrInput `pulumi:"overwrite"` @@ -674,6 +679,7 @@ type TarArgsTypeArgs struct { Update pulumi.BoolPtrInput `pulumi:"update"` Verbose pulumi.BoolPtrInput `pulumi:"verbose"` Verify pulumi.BoolPtrInput `pulumi:"verify"` + Version pulumi.BoolPtrInput `pulumi:"version"` Xz pulumi.BoolPtrInput `pulumi:"xz"` Zstd pulumi.BoolPtrInput `pulumi:"zstd"` } @@ -716,6 +722,10 @@ func (o TarArgsTypeOutput) ToOutput(ctx context.Context) pulumix.Output[TarArgsT } } +func (o TarArgsTypeOutput) Anchored() pulumi.BoolPtrOutput { + return o.ApplyT(func(v TarArgsType) *bool { return v.Anchored }).(pulumi.BoolPtrOutput) +} + func (o TarArgsTypeOutput) Append() pulumi.BoolPtrOutput { return o.ApplyT(func(v TarArgsType) *bool { return v.Append }).(pulumi.BoolPtrOutput) } @@ -804,6 +814,10 @@ func (o TarArgsTypeOutput) Lzop() pulumi.BoolPtrOutput { return o.ApplyT(func(v TarArgsType) *bool { return v.Lzop }).(pulumi.BoolPtrOutput) } +func (o TarArgsTypeOutput) NoAnchored() pulumi.BoolPtrOutput { + return o.ApplyT(func(v TarArgsType) *bool { return v.NoAnchored }).(pulumi.BoolPtrOutput) +} + func (o TarArgsTypeOutput) NoOverwriteDir() pulumi.BoolPtrOutput { return o.ApplyT(func(v TarArgsType) *bool { return v.NoOverwriteDir }).(pulumi.BoolPtrOutput) } @@ -864,6 +878,10 @@ func (o TarArgsTypeOutput) Verify() pulumi.BoolPtrOutput { return o.ApplyT(func(v TarArgsType) *bool { return v.Verify }).(pulumi.BoolPtrOutput) } +func (o TarArgsTypeOutput) Version() pulumi.BoolPtrOutput { + return o.ApplyT(func(v TarArgsType) *bool { return v.Version }).(pulumi.BoolPtrOutput) +} + func (o TarArgsTypeOutput) Xz() pulumi.BoolPtrOutput { return o.ApplyT(func(v TarArgsType) *bool { return v.Xz }).(pulumi.BoolPtrOutput) } diff --git a/sdk/go/baremetal/x/coreutils/pulumiTypes.go b/sdk/go/baremetal/x/coreutils/pulumiTypes.go index 536d0353..798875c3 100644 --- a/sdk/go/baremetal/x/coreutils/pulumiTypes.go +++ b/sdk/go/baremetal/x/coreutils/pulumiTypes.go @@ -524,6 +524,7 @@ func (o RmArgsTypeOutput) Verbose() pulumix.Output[*bool] { } type TarArgsType struct { + Anchored *bool `pulumi:"anchored"` Append *bool `pulumi:"append"` Args []string `pulumi:"args"` Bzip2 *bool `pulumi:"bzip2"` @@ -546,6 +547,7 @@ type TarArgsType struct { Lzip *bool `pulumi:"lzip"` Lzma *bool `pulumi:"lzma"` Lzop *bool `pulumi:"lzop"` + NoAnchored *bool `pulumi:"noAnchored"` NoOverwriteDir *bool `pulumi:"noOverwriteDir"` NoSeek *bool `pulumi:"noSeek"` Overwrite *bool `pulumi:"overwrite"` @@ -561,11 +563,13 @@ type TarArgsType struct { Update *bool `pulumi:"update"` Verbose *bool `pulumi:"verbose"` Verify *bool `pulumi:"verify"` + Version *bool `pulumi:"version"` Xz *bool `pulumi:"xz"` Zstd *bool `pulumi:"zstd"` } type TarArgsTypeArgs struct { + Anchored pulumix.Input[*bool] `pulumi:"anchored"` Append pulumix.Input[*bool] `pulumi:"append"` Args pulumix.Input[[]string] `pulumi:"args"` Bzip2 pulumix.Input[*bool] `pulumi:"bzip2"` @@ -588,6 +592,7 @@ type TarArgsTypeArgs struct { Lzip pulumix.Input[*bool] `pulumi:"lzip"` Lzma pulumix.Input[*bool] `pulumi:"lzma"` Lzop pulumix.Input[*bool] `pulumi:"lzop"` + NoAnchored pulumix.Input[*bool] `pulumi:"noAnchored"` NoOverwriteDir pulumix.Input[*bool] `pulumi:"noOverwriteDir"` NoSeek pulumix.Input[*bool] `pulumi:"noSeek"` Overwrite pulumix.Input[*bool] `pulumi:"overwrite"` @@ -603,6 +608,7 @@ type TarArgsTypeArgs struct { Update pulumix.Input[*bool] `pulumi:"update"` Verbose pulumix.Input[*bool] `pulumi:"verbose"` Verify pulumix.Input[*bool] `pulumi:"verify"` + Version pulumix.Input[*bool] `pulumi:"version"` Xz pulumix.Input[*bool] `pulumi:"xz"` Zstd pulumix.Input[*bool] `pulumi:"zstd"` } @@ -643,6 +649,10 @@ func (o TarArgsTypeOutput) ToOutput(ctx context.Context) pulumix.Output[TarArgsT } } +func (o TarArgsTypeOutput) Anchored() pulumix.Output[*bool] { + return pulumix.Apply[TarArgsType](o, func(v TarArgsType) *bool { return v.Anchored }) +} + func (o TarArgsTypeOutput) Append() pulumix.Output[*bool] { return pulumix.Apply[TarArgsType](o, func(v TarArgsType) *bool { return v.Append }) } @@ -732,6 +742,10 @@ func (o TarArgsTypeOutput) Lzop() pulumix.Output[*bool] { return pulumix.Apply[TarArgsType](o, func(v TarArgsType) *bool { return v.Lzop }) } +func (o TarArgsTypeOutput) NoAnchored() pulumix.Output[*bool] { + return pulumix.Apply[TarArgsType](o, func(v TarArgsType) *bool { return v.NoAnchored }) +} + func (o TarArgsTypeOutput) NoOverwriteDir() pulumix.Output[*bool] { return pulumix.Apply[TarArgsType](o, func(v TarArgsType) *bool { return v.NoOverwriteDir }) } @@ -792,6 +806,10 @@ func (o TarArgsTypeOutput) Verify() pulumix.Output[*bool] { return pulumix.Apply[TarArgsType](o, func(v TarArgsType) *bool { return v.Verify }) } +func (o TarArgsTypeOutput) Version() pulumix.Output[*bool] { + return pulumix.Apply[TarArgsType](o, func(v TarArgsType) *bool { return v.Version }) +} + func (o TarArgsTypeOutput) Xz() pulumix.Output[*bool] { return pulumix.Apply[TarArgsType](o, func(v TarArgsType) *bool { return v.Xz }) } diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index a0d26c62..693be073 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -71,6 +71,7 @@ export namespace coreutils { } export interface TarArgsArgs { + anchored?: pulumi.Input; append?: pulumi.Input; args?: pulumi.Input[]>; bzip2?: pulumi.Input; @@ -93,6 +94,7 @@ export namespace coreutils { lzip?: pulumi.Input; lzma?: pulumi.Input; lzop?: pulumi.Input; + noAnchored?: pulumi.Input; noOverwriteDir?: pulumi.Input; noSeek?: pulumi.Input; overwrite?: pulumi.Input; @@ -108,6 +110,7 @@ export namespace coreutils { update?: pulumi.Input; verbose?: pulumi.Input; verify?: pulumi.Input; + version?: pulumi.Input; xz?: pulumi.Input; zstd?: pulumi.Input; } diff --git a/sdk/nodejs/types/output.ts b/sdk/nodejs/types/output.ts index c1686c7c..b8a73307 100644 --- a/sdk/nodejs/types/output.ts +++ b/sdk/nodejs/types/output.ts @@ -71,6 +71,7 @@ export namespace coreutils { } export interface TarArgs { + anchored?: boolean; append?: boolean; args?: string[]; bzip2?: boolean; @@ -93,6 +94,7 @@ export namespace coreutils { lzip?: boolean; lzma?: boolean; lzop?: boolean; + noAnchored?: boolean; noOverwriteDir?: boolean; noSeek?: boolean; overwrite?: boolean; @@ -108,6 +110,7 @@ export namespace coreutils { update?: boolean; verbose?: boolean; verify?: boolean; + version?: boolean; xz?: boolean; zstd?: boolean; } diff --git a/sdk/python/unmango_baremetal/coreutils/_inputs.py b/sdk/python/unmango_baremetal/coreutils/_inputs.py index ba1972fc..f1a7d41c 100644 --- a/sdk/python/unmango_baremetal/coreutils/_inputs.py +++ b/sdk/python/unmango_baremetal/coreutils/_inputs.py @@ -632,6 +632,7 @@ def verbose(self, value: Optional[pulumi.Input[bool]]): @pulumi.input_type class TarArgsArgs: def __init__(__self__, *, + anchored: Optional[pulumi.Input[bool]] = None, append: Optional[pulumi.Input[bool]] = None, args: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, bzip2: Optional[pulumi.Input[bool]] = None, @@ -654,6 +655,7 @@ def __init__(__self__, *, lzip: Optional[pulumi.Input[bool]] = None, lzma: Optional[pulumi.Input[bool]] = None, lzop: Optional[pulumi.Input[bool]] = None, + no_anchored: Optional[pulumi.Input[bool]] = None, no_overwrite_dir: Optional[pulumi.Input[bool]] = None, no_seek: Optional[pulumi.Input[bool]] = None, overwrite: Optional[pulumi.Input[bool]] = None, @@ -669,8 +671,11 @@ def __init__(__self__, *, update: Optional[pulumi.Input[bool]] = None, verbose: Optional[pulumi.Input[bool]] = None, verify: Optional[pulumi.Input[bool]] = None, + version: Optional[pulumi.Input[bool]] = None, xz: Optional[pulumi.Input[bool]] = None, zstd: Optional[pulumi.Input[bool]] = None): + if anchored is not None: + pulumi.set(__self__, "anchored", anchored) if append is not None: pulumi.set(__self__, "append", append) if args is not None: @@ -715,6 +720,8 @@ def __init__(__self__, *, pulumi.set(__self__, "lzma", lzma) if lzop is not None: pulumi.set(__self__, "lzop", lzop) + if no_anchored is not None: + pulumi.set(__self__, "no_anchored", no_anchored) if no_overwrite_dir is not None: pulumi.set(__self__, "no_overwrite_dir", no_overwrite_dir) if no_seek is not None: @@ -745,11 +752,22 @@ def __init__(__self__, *, pulumi.set(__self__, "verbose", verbose) if verify is not None: pulumi.set(__self__, "verify", verify) + if version is not None: + pulumi.set(__self__, "version", version) if xz is not None: pulumi.set(__self__, "xz", xz) if zstd is not None: pulumi.set(__self__, "zstd", zstd) + @property + @pulumi.getter + def anchored(self) -> Optional[pulumi.Input[bool]]: + return pulumi.get(self, "anchored") + + @anchored.setter + def anchored(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "anchored", value) + @property @pulumi.getter def append(self) -> Optional[pulumi.Input[bool]]: @@ -948,6 +966,15 @@ def lzop(self) -> Optional[pulumi.Input[bool]]: def lzop(self, value: Optional[pulumi.Input[bool]]): pulumi.set(self, "lzop", value) + @property + @pulumi.getter(name="noAnchored") + def no_anchored(self) -> Optional[pulumi.Input[bool]]: + return pulumi.get(self, "no_anchored") + + @no_anchored.setter + def no_anchored(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "no_anchored", value) + @property @pulumi.getter(name="noOverwriteDir") def no_overwrite_dir(self) -> Optional[pulumi.Input[bool]]: @@ -1083,6 +1110,15 @@ def verify(self) -> Optional[pulumi.Input[bool]]: def verify(self, value: Optional[pulumi.Input[bool]]): pulumi.set(self, "verify", value) + @property + @pulumi.getter + def version(self) -> Optional[pulumi.Input[bool]]: + return pulumi.get(self, "version") + + @version.setter + def version(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "version", value) + @property @pulumi.getter def xz(self) -> Optional[pulumi.Input[bool]]: diff --git a/sdk/python/unmango_baremetal/coreutils/outputs.py b/sdk/python/unmango_baremetal/coreutils/outputs.py index 464c5384..c4c64e69 100644 --- a/sdk/python/unmango_baremetal/coreutils/outputs.py +++ b/sdk/python/unmango_baremetal/coreutils/outputs.py @@ -530,6 +530,8 @@ def __key_warning(key: str): suggest = "keep_newer_files" elif key == "keepOldfiles": suggest = "keep_oldfiles" + elif key == "noAnchored": + suggest = "no_anchored" elif key == "noOverwriteDir": suggest = "no_overwrite_dir" elif key == "noSeek": @@ -559,6 +561,7 @@ def get(self, key: str, default = None) -> Any: return super().get(key, default) def __init__(__self__, *, + anchored: Optional[bool] = None, append: Optional[bool] = None, args: Optional[Sequence[str]] = None, bzip2: Optional[bool] = None, @@ -581,6 +584,7 @@ def __init__(__self__, *, lzip: Optional[bool] = None, lzma: Optional[bool] = None, lzop: Optional[bool] = None, + no_anchored: Optional[bool] = None, no_overwrite_dir: Optional[bool] = None, no_seek: Optional[bool] = None, overwrite: Optional[bool] = None, @@ -596,8 +600,11 @@ def __init__(__self__, *, update: Optional[bool] = None, verbose: Optional[bool] = None, verify: Optional[bool] = None, + version: Optional[bool] = None, xz: Optional[bool] = None, zstd: Optional[bool] = None): + if anchored is not None: + pulumi.set(__self__, "anchored", anchored) if append is not None: pulumi.set(__self__, "append", append) if args is not None: @@ -642,6 +649,8 @@ def __init__(__self__, *, pulumi.set(__self__, "lzma", lzma) if lzop is not None: pulumi.set(__self__, "lzop", lzop) + if no_anchored is not None: + pulumi.set(__self__, "no_anchored", no_anchored) if no_overwrite_dir is not None: pulumi.set(__self__, "no_overwrite_dir", no_overwrite_dir) if no_seek is not None: @@ -672,11 +681,18 @@ def __init__(__self__, *, pulumi.set(__self__, "verbose", verbose) if verify is not None: pulumi.set(__self__, "verify", verify) + if version is not None: + pulumi.set(__self__, "version", version) if xz is not None: pulumi.set(__self__, "xz", xz) if zstd is not None: pulumi.set(__self__, "zstd", zstd) + @property + @pulumi.getter + def anchored(self) -> Optional[bool]: + return pulumi.get(self, "anchored") + @property @pulumi.getter def append(self) -> Optional[bool]: @@ -787,6 +803,11 @@ def lzma(self) -> Optional[bool]: def lzop(self) -> Optional[bool]: return pulumi.get(self, "lzop") + @property + @pulumi.getter(name="noAnchored") + def no_anchored(self) -> Optional[bool]: + return pulumi.get(self, "no_anchored") + @property @pulumi.getter(name="noOverwriteDir") def no_overwrite_dir(self) -> Optional[bool]: @@ -862,6 +883,11 @@ def verbose(self) -> Optional[bool]: def verify(self) -> Optional[bool]: return pulumi.get(self, "verify") + @property + @pulumi.getter + def version(self) -> Optional[bool]: + return pulumi.get(self, "version") + @property @pulumi.getter def xz(self) -> Optional[bool]: diff --git a/tests/expect/contain_file.go b/tests/expect/contain_file.go index b6589b7a..f6fbb987 100644 --- a/tests/expect/contain_file.go +++ b/tests/expect/contain_file.go @@ -17,14 +17,12 @@ type containFile struct { // Match implements types.GomegaMatcher. func (e *containFile) Match(actual interface{}) (success bool, err error) { - ctx := context.Background() - if host, ok := actual.(util.TestHost); ok { - return host.FileExists(ctx, e.File) + return host.FileExists(e.Context, e.File) } if ctr, ok := actual.(tc.Container); ok { - return util.FileExists(ctx, ctr, e.File) + return util.FileExists(e.Context, ctr, e.File) } return false, fmt.Errorf("unupported match target: %s", reflect.TypeOf(actual)) diff --git a/tests/go.sum b/tests/go.sum index 534b4118..2a6b63f7 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -409,12 +409,8 @@ github.com/pulumi/pulumi-command/sdk v1.0.1 h1:ZuBSFT57nxg/fs8yBymUhKLkjJ6qmyN3g github.com/pulumi/pulumi-command/sdk v1.0.1/go.mod h1:C7sfdFbUIoXKoIASfXUbP/U9xnwPfxvz8dBpFodohlA= github.com/pulumi/pulumi-go-provider v0.21.0 h1:sDHBtWkWRrWn6klfdvDIorlUGMBt6BwhgKXqcPoJh2c= github.com/pulumi/pulumi-go-provider v0.21.0/go.mod h1:2qQ4M1LXzv+SpY6v8JiTbPVGdeCeqfBMgsqb7WyH77o= -github.com/pulumi/pulumi/pkg/v3 v3.128.0 h1:K3qtJYjHg4DkA7LxknY/MoQZ+QHdHQDh/k2njjmjHXM= -github.com/pulumi/pulumi/pkg/v3 v3.128.0/go.mod h1:/spoJXy/mqQ8fBLgXBEbUrAnL7pHdfXOviIo5fZROEY= github.com/pulumi/pulumi/pkg/v3 v3.129.0 h1:n4Jd4ctlvw3eqyHglb/yJKDtRqjOvdkCBfG5T+orU30= github.com/pulumi/pulumi/pkg/v3 v3.129.0/go.mod h1:W3c7JgO064kUH5IfyQMCgmsAr5iwr3PO6KEeIQiO0dY= -github.com/pulumi/pulumi/sdk/v3 v3.128.0 h1:5VPFfygxt6rva0bEYVQZXxsGAo2/D1wsb9erGOtXxzk= -github.com/pulumi/pulumi/sdk/v3 v3.128.0/go.mod h1:p1U24en3zt51agx+WlNboSOV8eLlPWYAkxMzVEXKbnY= github.com/pulumi/pulumi/sdk/v3 v3.129.0 h1:uZpTTwWTx7Mk8UT9FgatzxzArim47vZ6hzNCKvgvX6A= github.com/pulumi/pulumi/sdk/v3 v3.129.0/go.mod h1:p1U24en3zt51agx+WlNboSOV8eLlPWYAkxMzVEXKbnY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= diff --git a/tests/tar_test.go b/tests/tar_test.go index 0762190c..98402d0e 100644 --- a/tests/tar_test.go +++ b/tests/tar_test.go @@ -6,6 +6,7 @@ import ( "compress/gzip" "context" "io" + "path" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -159,6 +160,53 @@ var _ = Describe("Tar", func() { }) }) + When("cni plugins are downloaded", func() { + dest := containerPath(work, "cni-plugins") + archive := path.Join("/testdata", "cni-plugins-linux-amd64-v1.5.1.tgz") + + BeforeEach(func(ctx context.Context) { + By("ensuring container directories exist") + _, err := provisioner.Exec(ctx, "mkdir", "-p", work, dest) + Expect(err).NotTo(HaveOccurred()) + + By("ensuring the cni-plugins exist") + Expect(provisioner).To(ContainFile(ctx, archive)) + }) + + It("should complete a full lifecycle", func(ctx context.Context) { + run(server, integration.LifeCycleTest{ + Resource: resource, + Create: integration.Operation{ + Inputs: pr.NewPropertyMapFromMap(map[string]interface{}{ + "args": map[string]interface{}{ + "extract": true, + "gzip": true, + "file": archive, + "directory": dest, + "args": []string{"macvlan", "vlan"}, + "verbose": true, + "noAnchored": true, + }, + }), + Hook: func(inputs, output pr.PropertyMap) { + Expect(output["exitCode"]).To(HavePropertyValue(0)) + Expect(output["stderr"]).To(HavePropertyValue("")) + Expect(output["stdout"]).To(HavePropertyValue("./vlan\n./macvlan\n")) + Expect(output["createdFiles"]).To(Equal(pr.NewArrayProperty([]pr.PropertyValue{ + pr.NewProperty(containerPath(dest, "macvlan")), + pr.NewProperty(containerPath(dest, "vlan")), + }))) + Expect(output["movedFiles"].V).To(Equal(pr.PropertyMap{})) + Expect(output["args"]).To(Equal(inputs["args"])) + Expect(provisioner).To(ContainFile(ctx, containerPath(dest, "macvlan"))) + Expect(provisioner).To(ContainFile(ctx, containerPath(dest, "vlan"))) + }, + }, + }) + + Expect(provisioner).To(ContainFile(ctx, archive)) + }) + }) }) func createTar(c map[string]string) (*bytes.Buffer, error) { diff --git a/tests/util/host.go b/tests/util/host.go index 2727a1fc..339f804d 100644 --- a/tests/util/host.go +++ b/tests/util/host.go @@ -167,6 +167,6 @@ func (h *host) ensureContainer(ctx context.Context) (tc.Container, error) { var _ = (TestHost)((*host)(nil)) func FileExists(ctx context.Context, ctr tc.Container, path string) (bool, error) { - _, err := ctr.CopyFileFromContainer(ctx, path) - return err == nil, nil + exitCode, _, err := ctr.Exec(ctx, []string{"stat", path}) + return err == nil && exitCode == 0, nil }