dalethestirling / budgie

A pythonic remote control of servers via ssh
1 stars 1 forks source link

Warning displayed during simple use of budgie #7

Open dwurf opened 10 years ago

dwurf commented 10 years ago

Given the following simple code:

#!/usr/bin/env python

from budgie import localhost
print localhost.hostname()

The following warning is shown

/home/ubuntu/projects/birdcage/budgie.py:46: UserWarning: Empty list passed as an argument to '/usr/bin/ssh'. If you're using glob.glob(), please use sh.glob() instead.
  return super(ssh, self).__call__(args, kwargs)
jumpbox

This happens inside _compile_args in the sh.Command super class, which is called from __call__() in the superclass, from __call__ in the subclass.

I can't determine an appropriate fix without digging further - let's meet to discuss.

dalethestirling commented 10 years ago

Had a quick look at this on the way in today and found the following.

within __call__ the sh.Command parses the supplied args to add params to the command to be executed.

Within budgie we are passing args into the __call__ as an empty tuple. This is then getting passed to the _compile_args method and raising the waning.

I have updated the call method to not pass in args tuple if it is empty eg. () this removes the fall through to that check.

You can see the change here.

I am not sure if this is the best way to handle it, but for now it works :)

Ill leave this open for you to review @dwurf and we should catch up.