Пример #1
0
 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
 def on_click(self, event, params, vars=None):
     if params[0] == 'add':
         self._editing = len(self.pkeys)
     if params[0] == 'edit':
         self._editing = int(params[1])
     if params[0] == 'del':
         self.pkeys.pop(int(params[1]))
         backend.PKeysConfig(self.app).save(self.pkeys)
Пример #3
0
 def on_click(self, event, params, vars=None):
     if params[0] == 'add':
         self._editing = len(self.pkeys)
     if params[0] == 'edit':
         self._editing = int(params[1])
     if params[0] == 'del':
         self.pkeys.pop(int(params[1]))
         try:
             backend.PKeysConfig(self.app).save(self.pkeys)
         except Exception, e:
             self.put_message(
                 'err', 'Failed to save private keys config: %s' % str(e))
Пример #4
0
 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)
             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
Пример #5
0
 def on_init(self):
     ss = backend.SSHConfig(self.app)
     pk = backend.PKeysConfig(self.app)
     self.ssh = ss.read()
     self.pkeys = pk.read()