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
=== modified file 'utilities/setuplxc.py'
--- utilities/setuplxc.py 2012-03-30 15:00:46 +0000
+++ utilities/setuplxc.py 2012-04-16 12:44:28 +0000
@@ -58,6 +58,7 @@
58HOST_PACKAGES = ['ssh', 'lxc', 'libvirt-bin', 'bzr', 'testrepository',58HOST_PACKAGES = ['ssh', 'lxc', 'libvirt-bin', 'bzr', 'testrepository',
59 'python-shell-toolbox']59 'python-shell-toolbox']
60HOSTS_FILE = '/etc/hosts'60HOSTS_FILE = '/etc/hosts'
61MAILNAME_FILE = '/etc/mailname'
61LP_APACHE_MODULES = 'proxy proxy_http rewrite ssl deflate headers'62LP_APACHE_MODULES = 'proxy proxy_http rewrite ssl deflate headers'
62LP_APACHE_ROOTS = (63LP_APACHE_ROOTS = (
63 '/var/tmp/bazaar.launchpad.dev/static',64 '/var/tmp/bazaar.launchpad.dev/static',
@@ -1111,6 +1112,13 @@
1111 # ephemeral container1112 # ephemeral container
1112 root_sshcall('mkdir -p /rootfs/usr/lib')1113 root_sshcall('mkdir -p /rootfs/usr/lib')
1113 root_sshcall('ln -s /usr/lib/graphviz /rootfs/usr/lib/graphviz')1114 root_sshcall('ln -s /usr/lib/graphviz /rootfs/usr/lib/graphviz')
1115 # XXX: BradCrittenden 2012-04-13 bug=981114: Manually create /etc/mailname
1116 # or bzrlib gets upset and returns None,None for whoami causing test
1117 # failures.
1118 mailname_file = get_container_path(lxcname, MAILNAME_FILE)
1119 if not os.path.exists(mailname_file):
1120 with open(mailname_file, 'w') as fd:
1121 fd.write('localhost')
11141122
11151123
1116def stop_lxc(lxcname, ssh_key_path):1124def stop_lxc(lxcname, ssh_key_path):