Beispiel #1
0
    def do_dns(self, options):
        "Get information about dns for every server"

        self.do_checkup(None)

        # List of servers from do_conn function
        ssh = utils.connect(self.servers)

        argv = options.split(' ')

        # If -f option is passed write to xboard.log and return
        if argv[0] == '-f':
            utils.filewrite('dns', ssh, self.servers)
            return

        # If an unknown option is passed display an error message and
        # return
        elif argv[0] != '-f' and argv[0] != '':
            print("Error: Unknown argument '%s' for command dns!" % argv[0])
            return

        sshLength = len(ssh)

        # Go through the list and execute the command for
        # every server
        for i in range(0, sshLength):
            ssh_stdin, ssh_stdout, ssh_stderr = ssh[i].exec_command('dns')
            for line in ssh_stdout.read().splitlines():
                print(line.decode('utf-8').replace(systemPrompt, ''))
            for linerr in ssh_stderr.read().splitlines():
                print ('%s at %s on port %s' % (linerr.decode('utf-8').replace(systemPrompt, ''), \
                        self.servers['server'][i], self.servers['port'][i]))

            ssh[i].close()
Beispiel #2
0
 def _gen_page(p):
   if p.content is None:
     pass
   else:
     basepath = os.path.join(self.destination, p.path)
     if not os.path.isdir(basepath):
       os.makedirs(basepath)
     if p.is_auto_index:
       p.level += 1
       dst = os.path.join(p.destination, 'index.html')
     else:
       dst = os.path.join(p.destination, p.name + '.html')
     utils.filewrite(dst, p.make_page())