Merge lp:~vila/uci-engine/tr-runs-as-ubuntu into lp:uci-engine

Proposed by Vincent Ladeuil
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: 919
Merged at revision: 880
Proposed branch: lp:~vila/uci-engine/tr-runs-as-ubuntu
Merge into: lp:uci-engine
Diff against target: 28 lines (+8/-1)
2 files modified
juju-deployer/test-runner.yaml.tmpl (+2/-1)
test_runner/tstrun/run_worker.py (+6/-0)
To merge this branch: bzr merge lp:~vila/uci-engine/tr-runs-as-ubuntu
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Evan (community) Approve
Review via email: mp+240573@code.launchpad.net

Commit message

Run the test worker as ubuntu/ubuntu into ~ubuntu

Description of the change

I realized recently that the test runner was running with the code directory as it's current working directory, ugh.

So I went on more mile and also change the uid/gid in addition to the working directory. Tests are still happy, so am I ;)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:918
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/1670/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/1670/rebuild

review: Approve (continuous-integration)
Revision history for this message
Evan (ev) wrote :

Looks okay. Just one minor comment.

review: Approve
919. By Vincent Ladeuil

Fallback to /tmp if $HOME is not set.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:919
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/1671/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/1671/rebuild

review: Approve (continuous-integration)
Revision history for this message
Vincent Ladeuil (vila) wrote :

Grrr, can't get my head around saving the comment to save the inline replies.

Anyway, fixed as suggested ;)

Revision history for this message
Joe Talbott (joetalbott) wrote :

On Tue, Nov 04, 2014 at 02:49:08PM -0000, Evan Dandrea wrote:
> > + # We're started in the charm code directory, let's go to a safer place
> > + os.chdir(os.environ['HOME'])
>
> This would probably be safer:
>
> os.environ.get('HOME') or '/tmp'

or

os.environ.get('HOME', '/tmp')

:)

Joe

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'juju-deployer/test-runner.yaml.tmpl'
2--- juju-deployer/test-runner.yaml.tmpl 2014-10-15 07:18:33 +0000
3+++ juju-deployer/test-runner.yaml.tmpl 2014-11-04 15:17:07 +0000
4@@ -10,7 +10,8 @@
5 available_code: ${CI_PAYLOAD_URL}
6 packages: "python-requests python-novaclient python-swiftclient python-glanceclient python-uci-vms autopkgtest haveged python-subunit python-testtools python-lazr.enum python-kombu"
7 unit-config: include-base64://configs/unit_config.yaml
8- uid: root
9+ uid: ubuntu
10+ gid: ubuntu
11 install_sources: |
12 - ${CI_PPA}
13 - "cloud:precise-icehouse"
14
15=== modified file 'test_runner/tstrun/run_worker.py'
16--- test_runner/tstrun/run_worker.py 2014-10-30 20:32:22 +0000
17+++ test_runner/tstrun/run_worker.py 2014-11-04 15:17:07 +0000
18@@ -353,4 +353,10 @@
19 if __name__ == '__main__':
20 logging.basicConfig(level=logging.INFO,
21 format="%(asctime)s %(levelname)s %(message)s")
22+ # We're started in the charm code directory, let's go to a safer place
23+ home = os.environ.get('HOME', None)
24+ if home is None:
25+ logging.warning('$HOME not set ! Going to /tmp')
26+ home = '/tmp'
27+ os.chdir(home)
28 TestRunnerWorker().main(amqp_utils.TEST_RUNNER_QUEUE)

Subscribers

People subscribed via source and target branches