Esempio n. 1
0
File: main.py Progetto: 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')
Esempio n. 2
0
File: main.py Progetto: ajvb/genesis
 def on_init(self):
     ss = backend.SSHConfig(self.app)
     pk = backend.PKeysConfig(self.app)
     self.ssh = ss.read()
     self.pkeys = pk.read()
Esempio n. 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')