Merge lp:~gundlach/nova/lp666554 into lp:~hudson-openstack/nova/trunk

Proposed by Michael Gundlach
Status: Merged
Approved by: Michael Gundlach
Approved revision: 387
Merged at revision: 399
Proposed branch: lp:~gundlach/nova/lp666554
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 31 lines (+14/-2)
1 file modified
nova/compute/disk.py (+14/-2)
To merge this branch: bzr merge lp:~gundlach/nova/lp666554
Reviewer Review Type Date Requested Status
Devin Carlen (community) Approve
Vish Ishaya (community) Approve
Review via email: mp+40997@code.launchpad.net

Description of the change

Ryan_Lane's code to handle /etc/network not existing when we try to inject /etc/network/interfaces into an image.

To post a comment you must log in.
Revision history for this message
Vish Ishaya (vishvananda) wrote :

lgtm

review: Approve
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

The attempt to merge lp:~gundlach/nova/lp666554 into lp:nova failed. Below is the output from the failed tests.

nova/compute/disk.py:169:1: W293 blank line contains whitespace

^
    JCR: Trailing whitespace is superfluous.
    FBM: Except when it occurs as part of a blank line (i.e. the line is
         nothing but whitespace). According to Python docs[1] a line with only
         whitespace is considered a blank line, and is to be ignored. However,
         matching a blank line to its indentation level avoids mistakenly
         terminating a multi-line statement (e.g. class declaration) when
         pasting code into the standard Python interpreter.

         [1] http://docs.python.org/reference/lexical_analysis.html#blank-lines

    The warning returned varies on whether the line itself is blank, for easier
    filtering for those who want to indent their blank lines.

    Okay: spam(1)
    W291: spam(1)\s
    W293: class Foo(object):\n \n bang = 12

lp:~gundlach/nova/lp666554 updated
387. By Michael Gundlach

pep8

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/compute/disk.py'
2--- nova/compute/disk.py 2010-10-31 00:05:31 +0000
3+++ nova/compute/disk.py 2010-11-16 18:52:14 +0000
4@@ -165,6 +165,11 @@
5
6 @defer.inlineCallbacks
7 def _inject_key_into_fs(key, fs, execute=None):
8+ """Add the given public ssh key to root's authorized_keys.
9+
10+ key is an ssh key string.
11+ fs is the path to the base of the filesystem into which to inject the key.
12+ """
13 sshdir = os.path.join(os.path.join(fs, 'root'), '.ssh')
14 yield execute('sudo mkdir -p %s' % sshdir) # existing dir doesn't matter
15 yield execute('sudo chown root %s' % sshdir)
16@@ -175,6 +180,13 @@
17
18 @defer.inlineCallbacks
19 def _inject_net_into_fs(net, fs, execute=None):
20- netfile = os.path.join(os.path.join(os.path.join(
21- fs, 'etc'), 'network'), 'interfaces')
22+ """Inject /etc/network/interfaces into the filesystem rooted at fs.
23+
24+ net is the contents of /etc/network/interfaces.
25+ """
26+ netdir = os.path.join(os.path.join(fs, 'etc'), 'network')
27+ yield execute('sudo mkdir -p %s' % netdir) # existing dir doesn't matter
28+ yield execute('sudo chown root:root %s' % netdir)
29+ yield execute('sudo chmod 755 %s' % netdir)
30+ netfile = os.path.join(netdir, 'interfaces')
31 yield execute('sudo tee %s' % netfile, net)