From 9bea239f71279bd0da39180b28b45935d3203b02 Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Sun, 29 Jul 2012 15:34:07 -0500 Subject: 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 --- nova/virt/disk/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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): -- cgit