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

Check CLI option dependencies cleanly #74

Merged
merged 1 commit into from
Jan 10, 2016
Merged

Conversation

nchammas
Copy link
Owner

@nchammas nchammas commented Jan 9, 2016

Option dependencies that could not be checked directly using Click are now checked using a few new utility functions. This means users get nice, fast error messages when they don't provide the right options to Flintrock, rather than getting some ugly barf from EC2 or worse--having Flintrock launch an unusable cluster.

For example, before this PR:

$ flintrock launch nick
Launching 2 instances...
Exception: Error reading SSH protocol banner
Traceback (most recent call last):
  File ".../flintrock/venv/lib/python3.5/site-packages/paramiko/transport.py", line 1724, in _check_banner
    buf = self.packetizer.readline(timeout)
  File ".../flintrock/venv/lib/python3.5/site-packages/paramiko/packet.py", line 326, in readline
    buf += self._read_timeout(timeout)
  File ".../flintrock/venv/lib/python3.5/site-packages/paramiko/packet.py", line 481, in _read_timeout
    raise EOFError()
EOFError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".../flintrock/venv/lib/python3.5/site-packages/paramiko/transport.py", line 1594, in run
    self._check_banner()
  File ".../flintrock/venv/lib/python3.5/site-packages/paramiko/transport.py", line 1728, in _check_banner
    raise SSHException('Error reading SSH protocol banner' + str(e))
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner

Exception: Error reading SSH protocol banner[Errno 54] Connection reset by peer
Traceback (most recent call last):
  File ".../flintrock/venv/lib/python3.5/site-packages/paramiko/transport.py", line 1724, in _check_banner
    buf = self.packetizer.readline(timeout)
  File ".../flintrock/venv/lib/python3.5/site-packages/paramiko/packet.py", line 326, in readline
    buf += self._read_timeout(timeout)
  File ".../flintrock/venv/lib/python3.5/site-packages/paramiko/packet.py", line 479, in _read_timeout
    x = self.__socket.recv(128)
ConnectionResetError: [Errno 54] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".../flintrock/venv/lib/python3.5/site-packages/paramiko/transport.py", line 1594, in run
    self._check_banner()
  File ".../flintrock/venv/lib/python3.5/site-packages/paramiko/transport.py", line 1728, in _check_banner
    raise SSHException('Error reading SSH protocol banner' + str(e))
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner[Errno 54] Connection reset by peer

At least one node raised an error: Error reading SSH protocol banner
Do you want to terminate the 2 instances created by this operation? [Y/n]: 
Terminating instances...
At least one node raised an error: Error reading SSH protocol banner

And with this PR:

Error: Missing option "--ec2-key-name" is required by "--provider ec2".

Before this PR:

$ flintrock launch nick
EC2ResponseError: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidAMIID.Malformed</Code><Message>Invalid id: "None" (expecting "ami-...")</Message></Error></Errors><RequestID>275a403d-da32-4bce-81d7-e02f2e66fb18</RequestID></Response>

With this PR:

Error: Missing option "--ec2-ami" is required by "--provider ec2".

Fixes #5.

nchammas added a commit that referenced this pull request Jan 10, 2016
Check CLI option dependencies cleanly
@nchammas nchammas merged commit 1fbcec6 into master Jan 10, 2016
@nchammas nchammas deleted the friendly-cli-requirements branch January 10, 2016 04:55
nchammas added a commit that referenced this pull request Jan 10, 2016
This pull request was closed.
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.

1 participant