示例#1
0
文件: main.py 项目: ajvb/genesis
 def on_submit(self, event, params, vars=None):
     if params[0] == 'dlgEdit':
         v = vars.getvalue('value', '')
         if vars.getvalue('action', '') == 'OK':
             h = backend.PKey()
             data = vars.getvalue('value', '').split()
             try:
                 h.type = data[0]
                 h.key = data[1]
                 h.name = data[2]
             except:
                 pass
             try:
                 self.pkeys[self._editing] = h
             except:
                 self.pkeys.append(h)
             backend.PKeysConfig(self.app).save(self.pkeys)
         self._editing = None
     if params[0] == 'frmSSH':
         v = vars.getvalue('value', '')
         if vars.getvalue('action', '') == 'OK':
             self.ssh['root'] = True if vars.getvalue(
                 'root', True) is '1' else False
             self.ssh['pkey'] = True if vars.getvalue(
                 'pkey', False) is '1' else False
             self.ssh['passwd'] = True if vars.getvalue(
                 'passwd', True) is '1' else False
             self.ssh['epasswd'] = True if vars.getvalue(
                 'epasswd', False) is '1' else False
             backend.SSHConfig(self.app).save(self.ssh)
             self.put_message('info', 'Saved')
示例#2
0
文件: main.py 项目: ajvb/genesis
 def on_init(self):
     ss = backend.SSHConfig(self.app)
     pk = backend.PKeysConfig(self.app)
     self.ssh = ss.read()
     self.pkeys = pk.read()
示例#3
0
                try:
                    h.type = data[0]
                    h.key = data[1]
                    h.name = data[2]
                except:
                    pass
                try:
                    self.pkeys[self._editing] = h
                except:
                    self.pkeys.append(h)
                try:
                    backend.PKeysConfig(self.app).save(self.pkeys)
                except Exception, e:
                    self.put_message(
                        'err',
                        'Failed to save private keys config: %s' % str(e))
            self._editing = None
        if params[0] == 'frmSSH':
            v = vars.getvalue('value', '')
            if vars.getvalue('action', '') == 'OK':
                self.ssh['root'] = True if vars.getvalue(
                    'root', True) is '1' else False
                self.ssh['pkey'] = True if vars.getvalue(
                    'pkey', False) is '1' else False
                self.ssh['passwd'] = True if vars.getvalue(
                    'passwd', True) is '1' else False
                self.ssh['epasswd'] = True if vars.getvalue(
                    'epasswd', False) is '1' else False
                backend.SSHConfig(self.app).save(self.ssh)
                self.put_message('success', 'Saved')