Skip to content

Mac: Nice warning if you don't have an identity #637

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

Merged
merged 3 commits into from
Feb 25, 2019

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Feb 22, 2019

Supporting --all on mac is "fun" because we rely on ssh auth and, unlike
Linux's lovely bind mounts, macOS can't share the ssh authorization
directly. Instead we have to carefully bounce the ssh authorization into
the container by sshing into it. One of the steps in this process
requires that the user has an ssh identity configured with their agent.
This is fairly easy to do, but if you haven't done it the error message
was garbage. This catches the original message from ssh-add and sends
the user a nicer one that includes a link to instructions.

Supporting `--all` on mac is "fun" because we rely on ssh auth and, unlike
Linux's lovely bind mounts, macOS can't share the ssh authorization
directly. Instead we have to carefully bounce the ssh authorization into
the container by `ssh`ing into it. One of the steps in this process
requires that the user has an ssh identity configured with their agent.
This is fairly easy to do, but if you haven't done it the error message
was garbage. This catches the original message from `ssh-add` and sends
the user a nicer one that includes a link to instructions.
@nik9000 nik9000 requested review from a user, ddillinger and lcawl February 22, 2019 20:01
Copy link
Contributor

@lcawl lcawl left a comment

Choose a reason for hiding this comment

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

That message looks much better, thanks!

@@ -37,6 +37,7 @@ import time
import webbrowser

DOCKER_BUILD_QUIET_TIME = 3 # seconds
SSH_AGENT_HELP = 'https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent' # noqa

Choose a reason for hiding this comment

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

What does # noqa mean?

Copy link
Member Author

Choose a reason for hiding this comment

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

It tells pycodestyle to ignore the super long line.

build_docs Outdated
@@ -250,6 +251,10 @@ def forward_ssh_auth_into_container(container, docker_run):
handle_popen(get_ssh_public_key, record_public_key)
keys = "\n".join(public_keys) + "\n"
if get_ssh_public_key.returncode != 0:
if 'The agent has no identities.' in keys:
raise ArgError('-all requires an identity be registered with the '

Choose a reason for hiding this comment

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

s/-all/--all/

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah!

@nik9000 nik9000 merged commit 8c35b23 into elastic:master Feb 25, 2019
@nik9000
Copy link
Member Author

nik9000 commented Feb 25, 2019

Thanks for reviewing @lcawl and @ddillinger!

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.

3 participants