Suggest design to accomodate non-unix platforms ?

Richard Shea shearichard at gmail.com
Wed Apr 18 09:35:40 EDT 2012


On a *nix box this is a reasonable bit of Python :

cmd = "ssh -o StrictHostKeyChecking=no -i %s %s@%s '%s' > %s" % (key,
user, dns, "echo CONNECTION READY", tmp_file)
result = os.system(cmd)

... on a Windows box it will fail because 'ssh' isn't part of Windows.

There *are* ways of achieving the equivalent functionality in Windows,
eg

putty.exe -ssh user at host

... and that's only one of them.

So I'm interested in suggestions/examples where a user can update a
config file to specify by which means they want (in this case) the ssh
functionality to be supplied.

I'm thinking of something in a config file like this ...

ssh_dropin = {exec: 'putty.exe -ssh %s@%s', args:['auser','somehost']}

... which I think would work and be sufficiently flexible to deal with
alternatives to putty.exe but is there a more established (...
better !) way of doing this stuff ?

Thanks

Richard.






More information about the Python-list mailing list