ccontavalli / ssh-ident

Different agents and different keys for different projects, with ssh.
Other
965 stars 71 forks source link

Not working on python 2.6.6, ValueError: zero length field name in format #14

Closed Nopius closed 8 years ago

Nopius commented 8 years ago

Hi. Thank you for such useful program and very good page with description of ssh-agent forwarding and it's issues. I have 10+ ssh keys and there were constant authentication failure errors. I installed your program (you say it should work starting from Python 2.6), but it didn't.

When I start using I got this error message:

Traceback (most recent call last):
  File "/home/nopius/bin/ssh", line 833, in <module>
    sys.exit(main(sys.argv))
  File "/home/nopius/bin/ssh", line 824, in main
    agent = AgentManager(identity, sshconfig, config)
  File "/home/nopius/bin/ssh", line 613, in __init__
    self.agent_file = self.GetAgentFile(self.agents_path, self.identity)
  File "/home/nopius/bin/ssh", line 716, in GetAgentFile
    path, "agent-{}-{}".format(identity, socket.gethostname()))
ValueError: zero length field name in format

This is due to implicit positioning of arguments in .format(). To be fully compatible with 2.6, you should change the code to use use explicit positioning. Instead of "agent-{}-{}".format(identity, socket.gethostname()) it should be "agent-{0}-{1}".format(identity, socket.gethostname())

After changing such formatting in 13 places I've got working version.

ccontavalli commented 8 years ago

Hello, thank you for the report and good catch! Sorry it took a while, but it's finally fixed. Hopefully, I have not missed any place, but it's working for me.