]> thyrsus.com Git - ssh-installkeys.git/commitdiff
Rename for clarity.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 22 Mar 2012 10:15:06 +0000 (06:15 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 22 Mar 2012 10:15:06 +0000 (06:15 -0400)
ssh-installkeys

index 7b1b1ff12676e4402ba867508bffe18564e6b54e..f2c23c4c99b545efae8a87f92327cc3497c03a69 100755 (executable)
@@ -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: