Merge lp:~bac/launchpad/bug-981114 into lp:launchpad

Proposed by Brad Crittenden
Status: Merged
Approved by: Gary Poster
Approved revision: no longer in the source branch.
Merged at revision: 15102
Proposed branch: lp:~bac/launchpad/bug-981114
Merge into: lp:launchpad
Diff against target: 25 lines (+8/-0)
1 file modified
utilities/setuplxc.py (+8/-0)
To merge this branch: bzr merge lp:~bac/launchpad/bug-981114
Reviewer Review Type Date Requested Status
Gary Poster (community) Approve
Review via email: mp+101970@code.launchpad.net

Commit message

Set /etc/mailname for the containers to avoid errors caused by no bzr whoami.

Description of the change

= Summary =

Tests fail if /etc/mailname is not set, which is not a problem for
developer machines but is for lxc containers.

== Proposed fix ==

Set /etc/mailname to be 'localhost'.

== Pre-implementation notes ==

Discussions with Gary.

== Implementation details ==

As above.

== Tests ==

None

== Demo and Q/A ==

Run setuplxc and verify /etc/mailname is there and that the following
tests pass:

bin/test -vvt test_uncommit_branch

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  utilities/setuplxc.py

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

Cool thank you

review: Approve
Revision history for this message
Gary Poster (gary) wrote :

I talked with bac about making the file from the host in Python rather than in the container via bash. I didn't care a ton, but he said he would pursue.

Revision history for this message
Brad Crittenden (bac) wrote :

I made the change to update the file via the slave host. Good suggestion.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'utilities/setuplxc.py'
2--- utilities/setuplxc.py 2012-03-30 15:00:46 +0000
3+++ utilities/setuplxc.py 2012-04-16 12:44:28 +0000
4@@ -58,6 +58,7 @@
5 HOST_PACKAGES = ['ssh', 'lxc', 'libvirt-bin', 'bzr', 'testrepository',
6 'python-shell-toolbox']
7 HOSTS_FILE = '/etc/hosts'
8+MAILNAME_FILE = '/etc/mailname'
9 LP_APACHE_MODULES = 'proxy proxy_http rewrite ssl deflate headers'
10 LP_APACHE_ROOTS = (
11 '/var/tmp/bazaar.launchpad.dev/static',
12@@ -1111,6 +1112,13 @@
13 # ephemeral container
14 root_sshcall('mkdir -p /rootfs/usr/lib')
15 root_sshcall('ln -s /usr/lib/graphviz /rootfs/usr/lib/graphviz')
16+ # XXX: BradCrittenden 2012-04-13 bug=981114: Manually create /etc/mailname
17+ # or bzrlib gets upset and returns None,None for whoami causing test
18+ # failures.
19+ mailname_file = get_container_path(lxcname, MAILNAME_FILE)
20+ if not os.path.exists(mailname_file):
21+ with open(mailname_file, 'w') as fd:
22+ fd.write('localhost')
23
24
25 def stop_lxc(lxcname, ssh_key_path):