Merge lp://staging/~gary/charms/oneiric/buildbot-master/run-as-buildbot into lp://staging/~yellow/charms/oneiric/buildbot-master/trunk

Proposed by Gary Poster
Status: Merged
Approved by: Benji York
Approved revision: 18
Merged at revision: 24
Proposed branch: lp://staging/~gary/charms/oneiric/buildbot-master/run-as-buildbot
Merge into: lp://staging/~yellow/charms/oneiric/buildbot-master/trunk
Diff against target: 392 lines (+155/-49)
6 files modified
config.yaml (+1/-1)
examples/lpbuildbot.yaml (+0/-2)
hooks/buildbot-relation-changed (+5/-3)
hooks/config-changed (+42/-26)
hooks/helpers.py (+63/-1)
hooks/local.py (+44/-16)
To merge this branch: bzr merge lp://staging/~gary/charms/oneiric/buildbot-master/run-as-buildbot
Reviewer Review Type Date Requested Status
Graham Binns (community) Approve
Review via email: mp+92399@code.staging.launchpad.net

Description of the change

This branch makes the buildbot master run as the buildbot user. This necessarily changes some directories, which is all for the better IMO, at least in terms of matching Debian's expectations.

This also sets up helper functions for the buildslave. I'm not really in love with the buildbot/buildslave OSError try except dances: please feel free to encourage me or give me another approach.

To post a comment you must log in.
Revision history for this message
Gary Poster (gary) wrote :

All those helpers are taken from setuplxc.py, btw.

The su contextmanager has an issue: the euid and egid are not set back properly when there is an error in the with block, for some reason. This can cause some problems: for some reason the juju log command hangs when the buildbot user tries to use it. Benji and I took a quick look at it and did not see a reason why they would do this. Perhaps it takes a moment to propagate?

I have not yet run the existing tests. I will do this before landing, resolving any issues. That said, this will bring up a master and slave for lpbuildbot, and at least check out the branch. Subsequently there's an error within Twisted/Buildbot itself, but it's on the right track.

Revision history for this message
Francesco Banconi (frankban) wrote :

> All those helpers are taken from setuplxc.py, btw.
>
> The su contextmanager has an issue: the euid and egid are not set back
> properly when there is an error in the with block, for some reason.

Trapping the error (re-raised inside the generator) using a try/finally statement should solve this.
E.g. http://pastebin.ubuntu.com/836410/

Revision history for this message
Graham Binns (gmb) wrote :

Hi Gary,

Nice branch; thanks for this. I'll merge it presently with the master trunk.

363 + try:
364 + return subprocess.call(['buildslave', 'start', buildbot_dir])
365 + except OSError:
366 + return subprocess.call(['buildbot', 'start', buildbot_dir])

Instead of this you could do something like this:

    def get_buildslave_command():
        if subprocess.call(['which', 'buildslave']) == 0:
            return 'buildslave'
        else:
            return 'buildbot'

and then call get_buildslave_command() where you need it.

review: Approve
Revision history for this message
Graham Binns (gmb) wrote :

> Nice branch; thanks for this. I'll merge it presently with the master trunk.

... and then I read your bit about the tests. How about I give that a shot first :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: