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

ENH: add messages for ssh-agent-helper exit state to make the result clear #197

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

ZLLentz
Copy link
Member

@ZLLentz ZLLentz commented Sep 5, 2024

Reviewers: I mostly want quick opinions about the word choice and the terminal output, you shouldn't spend a lot of time out of your day on this one. I think this is the normal/simplest way to check a return code in a bash script.

Description

If the ssh-add step in ssh-agent-helper runs, let the user know how it goes.
The script remains silent if it didn't need to do anything.

Motivation and Context

This came up when @ljansen7 was deploying IOCs a week or so ago and the script output was unclear: did it work? Did it not work? Do I have to do it again?

Jira at https://jira.slac.stanford.edu/browse/ECS-6095

How Has This Been Tested?

I ran the script a few times with different conditions:

Correct password:

zlentz@pslogin04:~$ source ~/github/engineering_tools/scripts/ssh-agent-helper
Starting ssh agent
Running ssh-add, may prompt for ssh key password
Enter passphrase for /cds/home/z/zlentz/.ssh/id_rsa:
ssh-agent-helper complete: key successfully added

Wrong password a bunch, ctrl+c and skips my message

zlentz@pslogin02:~$ source ~/github/engineering_tools/scripts/ssh-agent-helper
Starting ssh agent
Running ssh-add, may prompt for ssh key password
Enter passphrase for /cds/home/z/zlentz/.ssh/id_rsa:
Bad passphrase, try again for /cds/home/z/zlentz/.ssh/id_rsa:
Bad passphrase, try again for /cds/home/z/zlentz/.ssh/id_rsa:
Bad passphrase, try again for /cds/home/z/zlentz/.ssh/id_rsa:
Bad passphrase, try again for /cds/home/z/zlentz/.ssh/id_rsa:

Empty password, but actually my key is encrypted still and the return code catches it

zlentz@pslogin02:~$ source ~/github/engineering_tools/scripts/ssh-agent-helper
Running ssh-add, may prompt for ssh key password
Enter passphrase for /cds/home/z/zlentz/.ssh/id_rsa:
ssh-agent-helper error: at least one key failed to be added

Where Has This Been Documented?

Here only, later in release notes

Copy link
Contributor

@tangkong tangkong left a comment

Choose a reason for hiding this comment

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

Seems like a net positive to me 👍

@ZLLentz ZLLentz merged commit 2dea8c7 into pcdshub:master Sep 5, 2024
2 checks passed
@ZLLentz ZLLentz deleted the enh_ssh_helper_feedback branch September 5, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants