@ec2instance: login issue
When I decorate a task with @ec2instance, it prompts me for a password for the current local user of my local host (instead of using the awsfab-ssh-user user and the default SSH key). I conducted a little test to compare the behaviour of a task decorated with @ec2instance(tags=...) started without --ec2tags and a similar task, not decorated with @ec2instance, but started with --ec2tags=...:
# fabfile.py
from fabric.api import task, run
from awsfabrictasks.decorators import ec2instance
@task
@ec2instance(tags={'Environment':'benchmark'})
def whoami_decorated():
run('whoami')
@task
def whoami_not_decorated():
run('whoami')
I would expect awsfab whoami_decorated and awsfab --ec2tags=Environment=benchmark whoami_not_decorated to produce the same results. Alas, awsfab whoami_decorated fails:
leo@localhost $ awsfab whoami_decorated
[ec2-IP1.us-west-2.compute.amazonaws.com] Executing task 'whoami_decorated'
[ec2-IP1.us-west-2.compute.amazonaws.com] run: whoami
[ec2-IP1.us-west-2.compute.amazonaws.com] Login password for 'leo': ^C
but awsfab --ec2tags=Environment=benchmark whoami_not_decorated succeeds:
leo@localhost $ awsfab --ec2tags=Environment=benchmark whoami_not_decorated
[[email protected]] Executing task 'whoami_not_decorated'
[[email protected]] run: whoami
[[email protected]] out: root
[[email protected]] Executing task 'whoami_not_decorated'
[[email protected]] run: whoami
[[email protected]] out: root
[[email protected]] Executing task 'whoami_not_decorated'
[[email protected]] run: whoami
[[email protected]] out: root
Done.
Disconnecting from [email protected]... done.
Disconnecting from [email protected]... done.
Disconnecting from [email protected]... done.
Now I'm wondering
- Why doesn't
whoami_decorateduse my SSH key and theawsfab-ssh-user(set toroot)? - Why do the two calls give different results?
[This is about @ec2instance just like issue #15, but it is concerned with how it works, not when it is executed, so I decided to open a new issue for it.]