summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Short <chuck.short@canonical.com>2012-07-29 15:34:07 -0500
committerChuck Short <chuck.short@canonical.com>2012-07-29 15:36:27 -0500
commit9bea239f71279bd0da39180b28b45935d3203b02 (patch)
tree75d5e63f1d9e5bd8bd5813112626bd99add8a9bc
parentbad0a496c0e765da3cc879235c988b7cc617f367 (diff)
downloadnova-9bea239f71279bd0da39180b28b45935d3203b02.tar.gz
nova-9bea239f71279bd0da39180b28b45935d3203b02.tar.xz
nova-9bea239f71279bd0da39180b28b45935d3203b02.zip
Check for selinux before setting up selinux.
Check to see if /etc/selinux exists before trying to setup ssh keys for selinux. If it doesnt exist it will result in a traceback when setting up the image since the directory doesnt exist on Ubuntu. Fixes LP: #1030609 Change-Id: I8af1e6232bc5a84cbb878c2663ab30eb4139484c Signed-off-by: Chuck Short <chuck.short@canonical.com>
-rw-r--r--nova/virt/disk/api.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py
index e55b54fa1..af14e3ffc 100644
--- a/nova/virt/disk/api.py
+++ b/nova/virt/disk/api.py
@@ -416,7 +416,9 @@ def _inject_key_into_fs(key, fs):
_inject_file_into_fs(fs, keyfile, key_data, append=True)
- _setup_selinux_for_keys(fs)
+ selinuxdir = _join_and_check_path_within_fs(fs, 'etc', 'selinux')
+ if os.path.exists(selinuxdir):
+ _setup_selinux_for_keys(fs)
def _inject_net_into_fs(net, fs):