~cupstream2distro-maintainers/bileto/trunk

« back to all changes in this revision

Viewing changes to bileto/worker/manager.py

  • Committer: Robert Bruce Park
  • Date: 2016-09-01 03:18:33 UTC
  • Revision ID: robert.park@canonical.com-20160901031833-wolrgmx0qf9ultx8
Streamline setting of ephemeral PPA options.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
%s
59
59
"""
60
60
 
61
 
# This is used to set and check that PPAs have the correct attributes.
62
 
PPA_REQUIREMENTS = dict(
63
 
    authorized_size=20480,
64
 
    build_debug_symbols=True,
65
 
    publish_debug_symbols=True,
66
 
    relative_build_score=1500,
67
 
    require_virtualized=False,
68
 
)
69
 
 
70
 
 
71
61
SUCCESS = re.compile(r'^((Release|Updates) pocket( \([^()]+\). ?)?)+$')
72
62
COMMASPACE = ', '
73
63
SLASH = '/'
350
340
            ephemeral = self.make_ppa(
351
341
                self.ticket.request_id, self.ticket.distribution, description)
352
342
        log.debug('Ephemeral PPA: %s', ephemeral.web_link)
353
 
        for attr, expected in PPA_REQUIREMENTS.items():
354
 
            found = getattr(ephemeral, attr)
355
 
            if found != expected:
356
 
                log.debug('Expected %s %s, found %s', attr, expected, found)
 
343
        self.configure_ppa(ephemeral)
357
344
        if not self.ticket.siloname:
358
345
            self.assign()
359
346
        ppa = self.get_ppa(self.ticket.siloname.rpartition(SLASH)[-1])
401
388
 
402
389
    def configure_ppa(self, ppa):
403
390
        """Correct attributes on a given PPA."""
404
 
        for attr, value in PPA_REQUIREMENTS.items():
405
 
            setattr(ppa, attr, value)
 
391
        attributes = dict(
 
392
            authorized_size=20480,
 
393
            build_debug_symbols=True,
 
394
            publish_debug_symbols=True,
 
395
            relative_build_score=1500,
 
396
            require_virtualized=False,
 
397
        )
 
398
        for attr, expected in attributes.items():
 
399
            found = getattr(ppa, attr)
 
400
            if found != expected:
 
401
                log.debug('Expected %s %s, found %s', attr, expected, found)
 
402
                setattr(ppa, attr, expected)
406
403
        with suppress(Unauthorized):
407
404
            ppa.lp_save()
408
405