# HG changeset patch # User Henry S. Thompson # Date 1641237560 0 # Node ID f13017bb450237badc2404126a9dfccad2a99f96 # Parent a0b702a76872b7322d8792c3eaf5c7ade0980427 works on markup with -v ecclerig... diff -r a0b702a76872 -r f13017bb4502 newkey.py --- a/newkey.py Mon Jan 03 14:17:17 2022 +0000 +++ b/newkey.py Mon Jan 03 19:19:20 2022 +0000 @@ -57,8 +57,7 @@ if clients[0]!='-': print("Note, %s will be dereferenced on paul, not locally"%clients, file=sys.stderr) - cmd="/home/ht/bin/newkey.py %s -i %s %s"%(keytype, - "-v %s"%ihost if ihost is not None else '', + cmd="/home/ht/bin/newkey.py %s -i %s"%(keytype, '%s'%clients if clients is not None else '') print(cmd) res=os.system("mkdir -p /tmp/keys ; cd /tmp ; bash -c 'cp -a %s keys' ; tar -czf keys.tar.gz keys"%os.path.expanduser("~/.ssh/id_%s{,.pub}"%keytype)) @@ -66,10 +65,17 @@ print("tar failed",res) exit(res) with open("/tmp/keys.tar.gz","rb") as keytar: - res=run(['ssh','paul',cmd],stdin=keytar).returncode - if res: - print("paul failed",res) - exit(res) + if ihost is None: + res=run(['ssh','paul',cmd],stdin=keytar).returncode + if res: + print("paul failed",res) + exit(res) + else: + res=run(['ssh',ihost,'/afs/inf.ed.ac.uk/user/h/ht/share/bin/goHome',cmd],stdin=keytar).returncode + if res: + print("going via %s failed"%ihost,res) + exit(res) + if clients[0]=='-': ssh_copy_id(keyfile,clients[3:])