From abcadcaae997ee649fc5cef5a3e225d06e951ee6 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 22 Mar 2012 06:15:06 -0400 Subject: [PATCH] Rename for clarity. --- ssh-installkeys | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ssh-installkeys b/ssh-installkeys index 7b1b1ff..f2c23c4 100755 --- a/ssh-installkeys +++ b/ssh-installkeys @@ -642,7 +642,7 @@ class KeyConfig(ConfigParser.RawConfigParser): def save(self): if self.have_config: self.write(open(KeyConfig.configfile(), "w")) - def readremote(self, session): + def remember(self, session): authorized = session.ssh("cat ~/.ssh/authorized_keys") keydict = {} for line in authorized.split("\n"): @@ -655,6 +655,8 @@ class KeyConfig(ConfigParser.RawConfigParser): self.add_section(session.host) for (keyid, types) in keydict.items(): self.set(session.host, keyid, ",".join(types)) + def forget(self, host): + self.remove_section(host) def die(msg): "Die quietly." @@ -773,7 +775,7 @@ if __name__ == '__main__': if delete: os.system('ssh -l %s %s "rm -fr .ssh"' % (login, host)) - config.remove_section(host) + config.forget(host) print "Keys for %s on %s have been deleted." % (login, host) raise SystemExit, 0 @@ -796,11 +798,11 @@ if __name__ == '__main__': # OK, install keys remotely if they don't exist if session.exists("~/.ssh/authorized_keys"): print "authorized_keys already exists on", host - config.readremote(session) + config.remember(session) elif not check: print "Copying your public keys to", host session.scp(keyfile, "~/.ssh/authorized_keys") - config.readremote(session) + config.remember(session) except SystemExit: pass except RuntimeError: -- 2.43.0