ployground / ploy

A tool to manage servers through a central configuration. Plugins allow provisioning, configuration and other management tasks.
http://ploy.readthedocs.org
BSD 3-Clause "New" or "Revised" License
78 stars 15 forks source link

assh does not support non-default config from commandline #29

Open tomster opened 10 years ago

tomster commented 10 years ago

when calling assh with -c to specify a non-default config file from the command line it seems to get passed through to ssh because the message reads:

assh -c etc/foo.conf bar
Unknown cipher type 'etc/foo.conf'
fschulze commented 10 years ago

Try aws -c etc/foo.conf ssh bar

tomster commented 10 years ago

sure, that works, of course. but that's not really convenient to use for rsync and/or sftp.

the whole point of assh is convenience in the first place :)

i looked into the implementation but couldn't find a ready means of fixing this, short of using argparse in assh itself, which i'd consider a hack...

tomster commented 10 years ago

i've debugged this a bit more and it seems the bug is bigger than initially expected...

in fact the whole -c | --config feature seems to be broken, the values passed into the AWS.__init__ always take precedence, the value from the command line arguments is never taken into account!

it seems that this is triggered by AWS.config being a lazy property that only consults the value of self.configfile which at this point has already been initialized with the values passed into __init__ before parsing of the args has happened.

try renaming any aws.conf you have in any project you're using mr.awsome in and I dare you to get it working with -c :-)

fschulze commented 9 years ago

My proposed solution works for rsync, because it allows setting a whole command for ssh. For things like scp you have to specify a script and can't use any options, so fixing the option somehow wouldn't work anyway. You can only get scp working by creating a script which uses ploy ... ssh with the correct options.