Beispiel #1
0
 def __init__(self, hosts, imgd, cfg):
     self.s=None
     self.isos=isos()
     self.hosts=hosts
     self.imgd=imgd
     self.cfg=cfg
     self.log=rim.logger("tftp").log
Beispiel #2
0
 def __init__(self, cmd):
     self.log = rim.logger("respawner").log
     self.log("cmd='%s'" % cmd)
     self.child = subprocess.Popen(cmd,
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE,
                                   shell=True)
Beispiel #3
0
 def __init__(self, hosts, tftp):
     self.s = None
     self.hosts = hosts
     for mac in hosts:
         hosts[mac].xid = ""
     self.tftp = tftp
     self.isos = isos()
     self.log = rim.logger("dhcp").log
Beispiel #4
0
 def __init__(self):
     self.refs=0
     self.name=self.mntpt.split('/')[-1]
     self.log=rim.logger("iso[%s]" % self.name).log
     # get our own ip config
     ipjson=ipinfo.get()
     ipcfg=rim.jsonToObject(ipjson)
     self.myIp=ipcfg.IPAddress
Beispiel #5
0
 def __init__(self, hosts, tftp):
     self.s=None
     self.hosts=hosts
     for mac in hosts:
         hosts[mac].xid=""
     self.tftp=tftp
     self.isos=isos()
     self.log=rim.logger("dhcp").log
Beispiel #6
0
 def __init__(self, cfg, logger):
     transport.Transport.__init__(self, cfg)
     cmd = "rsync -av --no-links ${OPTIONS} -R --rsh=ssh --stats --link-dest=${REFDIR} ${INCLUDE} ${EXCLUDE} ${SOURCEDIR} %s@%s:%s/${DSTDIR} || exit 1" % (
         self.getName(), self.getHost(), self.getDir())
     self.outCmd = Template(cmd)
     cmd = "rsync -rltpDO -R --progress --rsh=ssh ${OPTIONS} --rsync-path='cd %s/${DSTDIR} && rsync' --stats %s@%s:. . || exit 1" % (
         self.getDir(), self.getName(), self.getHost())
     self.inCmd = Template(cmd)
     self.log = rim.logger("rsync").log
     self.logErr = logger
Beispiel #7
0
 def __init__(self, cfg, logger):
     transport.Transport.__init__(self, cfg)
     # use base class out and in Cmds.
     self.log=rim.logger("iscsi").log
     self.logErr=logger
     self.outCmd=Template("cd %s/${DSTDIR} && rsync -av --no-links ${OPTIONS} -R --stats --link-dest=${REFDIR} ${INCLUDE} ${EXCLUDE} ${SOURCEDIR} . || exit 1" % (
             self.mntpt
         ))
     self.inCmd=Template("rsync -rltpDO --progress ${OPTIONS} --stats %s/${DSTDIR}/. / || exit 1" % (
             self.mntpt
         ))
Beispiel #8
0
 def __init__(self, cfg):
     self.cfg=cfg
     self.mntpt="/pivot/data/%s" % self.typeName()()
     self.log=rim.logger('transport[%s]' % self.typeName()()).log
     self.outCmd=Template("cd %s/${DSTDIR} && rsync -av --no-links ${OPTIONS} -R --stats --link-dest=${REFDIR} ${INCLUDE} ${EXCLUDE} ${SOURCEDIR} . || exit 1" % (
             self.mntpt
         ))
     self.inCmd=Template("rsync -rltpD -R --progress ${OPTIONS} --rsync-path='cd %s/${DSTDIR} && rsync' --stats . || exit 1" % (
             self.mntpt
         ))
     self.label="RimBackups"
Beispiel #9
0
 def __init__(self):
     self.handlers={}
     self.log=rim.logger("isos").log
     prefix="%s/img/isohandlers" % sys.path[0]
     for infile in sorted(glob.glob('%s/*.py' % prefix)):
 
         # skip over any python package management files
         if os.path.basename(infile)[0:2] == "__": continue
         fname = os.path.basename(infile)[:-3]
         mod=imp.load_source(fname, infile) 
         if 'probe' in dir(mod):
             self.handlers[fname]=mod
Beispiel #10
0
    def __init__(self):
        self.handlers = {}
        self.log = rim.logger("isos").log
        prefix = "%s/img/isohandlers" % sys.path[0]
        for infile in sorted(glob.glob('%s/*.py' % prefix)):

            # skip over any python package management files
            if os.path.basename(infile)[0:2] == "__": continue
            fname = os.path.basename(infile)[:-3]
            mod = imp.load_source(fname, infile)
            if 'probe' in dir(mod):
                self.handlers[fname] = mod
Beispiel #11
0
 def __init__(self, vmName):
     self.log = rim.logger("ci-console").log
     self.ciCfg = ci.get()
     self.xIp = self.ciCfg['xIP']
     self.login = self.ciCfg["xenLogin"]
     self.pw = self.ciCfg["xenPassword"]
     self.telnetBase = int(self.ciCfg["telnetBase"])
     url = "https://%s:443/" % self.xIp
     self.session = XenAPI.Session(url)
     self.session.xenapi.login_with_password(self.login, self.pw)
     self.vmRef = self.session.xenapi.VM.get_by_name_label(vmName)[0]
     self.vmName = vmName
     self.cdir = self.ciCfg['consoleDir']
     self.unixFile = "%s/socket.%s" % (self.cdir, self.vmName)
Beispiel #12
0
 def __init__(self, configFile="/etc/backups.conf"):
     self.configFile=configFile;
     self.readCfg();
     self.transport=self.getTransport()
     # take a spapshot of the date/time here
     now = datetime.datetime.now()
     self.timesuffix="%4d_%02d_%02d-%02d.%02d.%02d" % (
         now.year,
         now.month,
         now.day,
         now.hour,
         now.minute,
         now.second
     )
     self.dbglevel=9
     self.log=rim.logger("Backup").log
Beispiel #13
0
 def __init__(self, port, logfile, sock, vmName):
     self.log = rim.logger("telnet[%d]" % port).log
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
     try:
         s.bind(('0.0.0.0', port))
     except:
         self.log("already in use")
         sys.exit(1)
     self.log("listening on port %d" % port)
     s.listen(1)
     self.s = s
     self.clients = []
     self.logfile = logfile
     self.sock = sock
     self.vmName = vmName
Beispiel #14
0
 def __init__(self, cfg, logger):
     transport.Transport.__init__(self, cfg)
     cmd="rsync -av --no-links ${OPTIONS} -R --rsh=ssh --stats --link-dest=${REFDIR} ${INCLUDE} ${EXCLUDE} ${SOURCEDIR} %s@%s:%s/${DSTDIR} || exit 1" % (
             self.getName(),
             self.getHost(),
             self.getDir()
         )
     self.outCmd=Template(cmd)
     cmd="rsync -rltpDO -R --progress --rsh=ssh ${OPTIONS} --rsync-path='cd %s/${DSTDIR} && rsync' --stats %s@%s:. . || exit 1" % (
             self.getDir(),
             self.getName(),
             self.getHost()
         )
     self.inCmd=Template(cmd)
     self.log=rim.logger("rsync").log
     self.logErr=logger
Beispiel #15
0
 def __init__(self, mntpt):
     self.mntpt=mntpt
     iso.__init__(self)
     self.log=rim.logger("ubuntu").log
Beispiel #16
0
 def __init__(self, exitOnEmpty=True):
     self.handlers = []
     self.done = False
     self.exit = exitOnEmpty
     self.log = rim.logger("selector").log
Beispiel #17
0
 def __init__(self, infd, telnet):
     self.log = rim.logger("inOut").log
     self.infd = infd
     self.telnet = telnet
Beispiel #18
0
 def addUs(self, us):
     self.infd = us
     self.log = rim.logger("inOut[%d]" % self.infd.fileno()).log
Beispiel #19
0
 def __init__(self, exitOnEmpty=True):
     self.handlers=[]
     self.done=False
     self.exit=exitOnEmpty
     self.log=rim.logger("selector").log
Beispiel #20
0
 def __init__(self, mntpt):
     self.mntpt = mntpt
     iso.__init__(self)
     self.log = rim.logger("ubuntu").log