Beispiel #1
0
 def new_job(self, rbuilder_url, job_data):
     if rbuilder_url == self.LOCAL_RBUILDER:
         if not self._local_address:
             self.__class__._local_address = getNetName()
         rbuilder_url = 'http://[%s]/' % self._local_address
     job = image_job.ImageJob(rbuilder_url, job_data)
     return self.add_job(job)
Beispiel #2
0
 def __init__(self, key=None):
     server.Server.__init__(self)
     self.host = procutil.getNetName()
     self.port = None
     self.logPath = None
     self.logFd = None
     self.key = key
Beispiel #3
0
 def new_job(self, rbuilder_url, job_data):
     if rbuilder_url == self.LOCAL_RBUILDER:
         if not self._local_address:
             self.__class__._local_address = getNetName()
         rbuilder_url = 'http://[%s]/' % self._local_address
     job = image_job.ImageJob(rbuilder_url, job_data)
     return self.add_job(job)
Beispiel #4
0
 def startTroveLogger(self, trove):
     assert trove.logPath
     host = procutil.getNetName()
     port = self.serverCfg.logServerPort
     auth = self.db.logStore.getLogAuth(trove.logPath)
     name = '%s %s{%s}' % (trove.jobId, trove.getName(),
             trove.getContext() or '')
     key = '%s %s %s' % (trove.logPath, auth, name[:64])
     return host, port, key
Beispiel #5
0
 def getMessageBusHost(self, qualified=False):
     host = self.messageBusHost
     if host in (None, 'LOCAL'):
         if qualified:
             return procutil.getNetName()
         else:
             return 'localhost'
     else:
         return host
Beispiel #6
0
    def sanityCheckForStart(self):
        if self.proxyUrl is None and self.rbuilderUrl:
            self.proxyUrl = self.rbuilderUrl
        if self.hostName == 'localhost':
            self.hostName = procutil.getNetName()
        currUser = pwd.getpwuid(os.getuid()).pw_name
        cfgPaths = ['logDir', 'lockDir', 'serverDir']
        for uri in self.getServerUris():
            if not uri.startswith('unix://'):
                continue
            socketPath = uri[7:]
            if not os.access(os.path.dirname(socketPath), os.W_OK):
                log.error('cannot write to socketPath directory at %s - cannot start server' % os.path.dirname(socketPath))
                sys.exit(1)

        ret = self._sanityCheckForSSL()
        if ret:
            sys.exit(ret)

        cfgPaths = ['buildDir', 'logDir', 'lockDir', 'serverDir']
        for path in cfgPaths:
            if not os.path.exists(self[path]):
                log.error('%s does not exist, expected at %s - cannot start server' % (path, self[path]))
                sys.exit(1)
            if not os.access(self[path], os.W_OK):
                log.error('user "%s" cannot write to %s at %s - cannot start server' % (currUser, path, self[path]))
                sys.exit(1)
        if self.useResolverCache:
            util.mkdirChain(self.getResolverCachePath())
        if self.rbuilderUrl:
            try:
                try:
                    urllib2.urlopen(self.rbuilderUrl).read(1024)
                except urllib2.HTTPError, err:
                    if 200 <= err.code < 400:
                        # Something benign like a redirect
                        pass
                    else:
                        raise
            except Exception, err:
                raise errors.RmakeError('Could not access rbuilder at %s.  '
                        'Please ensure you have a line "rbuilderUrl '
                        'https://<yourRbuilder>" set correctly in your serverrc '
                        'file.  Error: %s' % (self.rbuilderUrl, err))
Beispiel #7
0
def sanityCheckForStart(self):
    if self.proxyUrl is None:
        self.proxyUrl = self.rbuilderUrl
    if self.hostName == 'localhost':
        self.hostName = procutil.getNetName()
    self.oldSanityCheck()
    try:
        try:
            urllib2.urlopen(self.rbuilderUrl).read(1024)
        except urllib2.HTTPError, err:
            if 200 <= err.code < 400:
                # Something benign like a redirect
                pass
            else:
                raise
    except Exception, err:
        raise errors.RmakeError('Could not access rbuilder at %s.  '
                'Please ensure you have a line "rbuilderUrl '
                'https://<yourRbuilder>" set correctly in your serverrc '
                'file.  Error: %s' % (self.rbuilderUrl, err))
Beispiel #8
0
def sanityCheckForStart(self):
    if self.proxyUrl is None:
        self.proxyUrl = self.rbuilderUrl
    if self.hostName == 'localhost':
        self.hostName = procutil.getNetName()
    self.oldSanityCheck()
    try:
        try:
            urllib2.urlopen(self.rbuilderUrl).read(1024)
        except urllib2.HTTPError, err:
            if 200 <= err.code < 400:
                # Something benign like a redirect
                pass
            else:
                raise
    except Exception, err:
        raise errors.RmakeError(
            'Could not access rbuilder at %s.  '
            'Please ensure you have a line "rbuilderUrl '
            'https://<yourRbuilder>" set correctly in your serverrc '
            'file.  Error: %s' % (self.rbuilderUrl, err))