summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorBrian Waldon <bcwaldon@gmail.com>2012-02-02 12:06:38 -0800
committerBrian Waldon <bcwaldon@gmail.com>2012-02-02 12:57:18 -0800
commit76e79792b4b94c9edac0ebf3cdf3eb49c7999398 (patch)
treeb45ae06f47066a29535d2ddd82372e7daabca7ab /nova
parented516883faca1976acd6e5a9476d447d39e11ab9 (diff)
Add comments to injected keys and network config
Fixes bug 754950 Change-Id: Ib773479c3b34b9ddd322abd02b297acf5359a847
Diffstat (limited to 'nova')
-rw-r--r--nova/virt/disk/api.py9
-rw-r--r--nova/virt/interfaces.template2
2 files changed, 10 insertions, 1 deletions
diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py
index 8f477bcea..4b1bf7f66 100644
--- a/nova/virt/disk/api.py
+++ b/nova/virt/disk/api.py
@@ -300,8 +300,15 @@ def _inject_key_into_fs(key, fs, execute=None):
utils.execute('chown', 'root', sshdir, run_as_root=True)
utils.execute('chmod', '700', sshdir, run_as_root=True)
keyfile = os.path.join(sshdir, 'authorized_keys')
+ key_data = [
+ '\n',
+ '# The following ssh key was injected by Nova',
+ '\n',
+ key.strip(),
+ '\n',
+ ]
utils.execute('tee', '-a', keyfile,
- process_input='\n' + key.strip() + '\n', run_as_root=True)
+ process_input=''.join(key_data), run_as_root=True)
def _inject_net_into_fs(net, fs, execute=None):
diff --git a/nova/virt/interfaces.template b/nova/virt/interfaces.template
index e527cf35c..ad8c1bcdb 100644
--- a/nova/virt/interfaces.template
+++ b/nova/virt/interfaces.template
@@ -1,3 +1,5 @@
+# Injected by Nova on instance boot
+#
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).