Skip to content

Add support for SendEnv#76

Merged
cezmunsta merged 2 commits into
masterfrom
SendEnv
Nov 22, 2021
Merged

Add support for SendEnv#76
cezmunsta merged 2 commits into
masterfrom
SendEnv

Conversation

@cezmunsta
Copy link
Copy Markdown
Owner

@cezmunsta cezmunsta commented Nov 9, 2021

In cases where the remote server supports environment variables
being passed across, adding support for storing SendEnv XXX
would be useful.

  • Added SendEnv to ssh.Connection to store environment var
    names to pass across
  • Added ssh.setSendEnv and updated ssh.BuildConnection to
    call setSendEnv
  • Updated ssh.Connect to search for SendEnv and apply each
    var to cmd.Env
  • Added ssh.SkipOnEmpty to map options that should be omitted
    from both execution and display (connect, print and show)
  • Refactored ssh.BuildConnection to bypass any ssh.SkipOnEmpty
    matches, removing redundant code
  • Updated unit tests

Resolves #54

In cases where the remote server supports environment variables
being passed across, adding support for storing SendEnv XXX
would be useful.

* Added `SendEnv` to `ssh.Connection` to store environment var
  names to pass across
* Added `ssh.setSendEnv` and updated `ssh.BuildConnection` to
  call `setSendEnv`
* Updated `ssh.Connect` to search for `SendEnv` and apply each
  var to `cmd.Env`
* Updated unit tests
@cezmunsta cezmunsta added the enhancement New feature or request label Nov 9, 2021
@cezmunsta cezmunsta self-assigned this Nov 9, 2021
@cezmunsta cezmunsta requested a review from Oneiroi November 9, 2021 17:50
* Added `ssh.SkipOnEmpty` to map options that should be omitted
  from both execution and display (`connect`, `print` and `show`)
* Refactored `ssh.BuildConnection` to bypass any `ssh.SkipOnEmpty`
  matches, removing redundant code
* Updated unit tests
Copy link
Copy Markdown
Collaborator

@Oneiroi Oneiroi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, not sure on the logic for the test expecting SendEnv to be empty however opting to accept as this is a test logic only.

@cezmunsta
Copy link
Copy Markdown
Owner Author

not sure on the logic for the test expecting SendEnv to be empty

If you mean if conn.SendEnv != "" then it is correct to test that

@cezmunsta cezmunsta merged commit 2098b77 into master Nov 22, 2021
@cezmunsta cezmunsta deleted the SendEnv branch November 22, 2021 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for SendEnv

2 participants