Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vary Stdin for Create/Update/Delete #250

Open
rgl opened this issue Aug 22, 2023 · 2 comments
Open

Vary Stdin for Create/Update/Delete #250

rgl opened this issue Aug 22, 2023 · 2 comments
Labels
impact/accessibility Something that is difficult or impossible for some people to use kind/enhancement Improvements or new features

Comments

@rgl
Copy link

rgl commented Aug 22, 2023

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Currently, there is a single Stdin property, which, when set, will be used in all the supported actions. This is somewhat odd, because we might want to use a different input/script for each action.

For example, this is what I'm currently using in C# (the full example at https://github.com/rgl/dotnet-pulumi-libvirt-ubuntu-example/blob/main/Program.cs):

    var informationCommand = new Command("information", new CommandArgs
    {
        Connection = new ConnectionArgs
        {
            Host = domain.NetworkInterfaces.GetAt(0).Apply(n => n.Addresses[0]),
            User = sshUser,
            PrivateKey = sshPrivateKey,
        },
        Create = "/bin/bash",
        Stdin = @"
set -euxo pipefail

# redirect stderr to stdout.
exec 2>&1

# wait for cloud-init to finish.
cloud-init status --long --wait

# show information about the block devices.
lsblk -x KNAME -o KNAME,SIZE,TRAN,SUBSYSTEMS,FSTYPE,UUID,LABEL,MODEL,SERIAL
",
    });

And the suggestion is to have:

  • CreateStdin
  • UpdateStdin
  • DeleteStdin

And their Stdout/Stderr counterparts.

Or, simplify the Command interface, and replace the Create/Update/Delete properties with a single Command, and just set an environment variable with the action being executed and let the command handle it internally?

Affected area/feature

@rgl rgl added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Aug 22, 2023
@danielrbradley
Copy link
Member

Hi @rgl thanks for the suggestion.

One additional option for the layout would be to make the Stdin property either a string or an object of:

{
  Create: string
  Update: string
  Delete: string
}

@danielrbradley danielrbradley added impact/accessibility Something that is difficult or impossible for some people to use and removed needs-triage Needs attention from the triage team labels Aug 24, 2023
@danielrbradley danielrbradley changed the title Stdin property for each of the supported Create/Update/Delete actions or something simpler Vary Stdin for Create/Update/Delete Aug 24, 2023
@iwahbe
Copy link
Member

iwahbe commented Sep 1, 2023

Hi @rgl thanks for the suggestion.

One additional option for the layout would be to make the Stdin property either a string or an object of:

{
  Create: string
  Update: string
  Delete: string
}

I'm hesitant to do something like this. It would be great in typescript, but I believe it would turn into an interface{} in go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/accessibility Something that is difficult or impossible for some people to use kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

3 participants