def getleases(self, args, flags): ip = args[0] principle = digest.sha1file(self.clientconf.pubkey) leasesdata = nodemgrproxy.nodemgrproxy(ip, nodemgr.PORT).getleases() for leasedata in leasesdata: l = lease.lease(leasedata) if re.match(principle, l.principle): print leasedata return 0
def gettickets(self, args, flags): ip = args[0] principle = digest.sha1file(self.clientconf.pubkey) ticketsdata = agentproxy.agentproxy(ip, agent.PORT).gettickets() for ticketdata in ticketsdata: t = ticket.ticket(ticketdata) if re.match(principle, t.principle): print ticketdata return 0
def deletesshkey(self, sshkey): sha1 = digest.sha1file(sshkey, strip=1) key = "%s/%s" % (self.sshkeysdir, sha1) if os.path.exists(key): os.unlink(key)
def savesshkey(self, sshkey): sha1 = digest.sha1file(sshkey, strip=1) shutil.copy(sshkey, "%s/%s" % (self.sshkeysdir, sha1))