source: trunk/bitten/slaves/patches/001_exit_no_pending.patch @ 517

Last change on this file since 517 was 517, checked in by amain, 6 years ago

Merge contrib branch 340:516. Main features added:

  • updated plugin architecture
  • improved patch system
  • bitten continous integration support
  • sever build fixed over time to remain in sync with OpenWrt
File size: 2.5 KB
  • Bitten-0.7dev_r1011-py2.6.egg/bitten/slave.py

    old new  
    190190                 keep_files=False, single_build=False,
    191191                 poll_interval=300, keepalive_interval = 60,
    192192                 username=None, password=None,
    193                  dump_reports=False, no_loop=False, form_auth=False):
     193                 dump_reports=False, no_loop=False, form_auth=False, exit_no_pending=False):
    194194        """Create the build slave instance.
    195195       
    196196        :param urls: a list of URLs of the build masters to connect to, or a
     
    251251        self.cookiejar = cookielib.CookieJar()
    252252        self.username = username \
    253253                        or self.config['authentication.username'] or ''
     254        self.exit_no_pending = exit_no_pending;
    254255
    255256        if not self.local:
    256257            self.password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
     
    392393            self._initiate_build(resp.info().get('location'))
    393394            return True
    394395        elif resp.code == 204:
    395             log.info('No pending builds')
    396             return False
     396            if self.exit_no_pending == True:
     397                log.info('No pending builds')
     398                raise ExitSlave(EX_OK)
     399            else:
     400                log.info('No pending builds')
     401                return False
    397402        else:
    398403            log.error('Unexpected response (%d %s)', resp.code, resp.msg)
    399404            raise ExitSlave(EX_PROTOCOL)
     
    598603                     const=logging.WARN, help='print as little as possible')
    599604    group.add_option('--dump-reports', action='store_true', dest='dump_reports',
    600605                     help='whether report data should be printed')
     606    group.add_option('-e', '--exit-no-pending', action='store_true', dest='exit_no_pending',
     607                     help='exit if no builds pending')
    601608
    602609    parser.set_defaults(dry_run=False, keep_files=False,
    603610                        loglevel=logging.INFO, single_build=False, no_loop=False,
     
    639646                       keepalive_interval=options.keepalive_interval,
    640647                       username=options.username, password=options.password,
    641648                       dump_reports=options.dump_reports,
    642                        form_auth=options.form_auth)
     649                       form_auth=options.form_auth,exit_no_pending=options.exit_no_pending)
    643650        try:
    644651            exit_code = slave.run()
    645652        except KeyboardInterrupt:
Note: See TracBrowser for help on using the repository browser.