summaryrefslogtreecommitdiff
path: root/ironic/drivers
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2023-01-17 16:57:59 +0000
committerGerrit Code Review <review@openstack.org>2023-01-17 16:57:59 +0000
commita48af6b5f13598ef83fff6dfd5a01480ed23743d (patch)
treed496065fb062556536ad5d0a386c9a9d68783b36 /ironic/drivers
parentb11067cfdcef0a370177803eddb86aa972b12b3d (diff)
parentc05c09fd3ac7ed2c3a5dd13a602e3ae70dfb8734 (diff)
downloadironic-a48af6b5f13598ef83fff6dfd5a01480ed23743d.tar.gz
Merge "Fix selinux context of published image hardlink"
Diffstat (limited to 'ironic/drivers')
-rw-r--r--ironic/drivers/modules/image_utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ironic/drivers/modules/image_utils.py b/ironic/drivers/modules/image_utils.py
index 304c199bf..86607ee25 100644
--- a/ironic/drivers/modules/image_utils.py
+++ b/ironic/drivers/modules/image_utils.py
@@ -211,6 +211,16 @@ class ImageHandler(object):
try:
os.link(image_file, published_file)
os.chmod(image_file, self._file_permission)
+ try:
+ utils.execute(
+ '/usr/sbin/restorecon', '-i', '-R', 'v', public_dir)
+ except FileNotFoundError as exc:
+ LOG.debug(
+ "Could not restore SELinux context on "
+ "%(public_dir)s, restorecon command not found.\n"
+ "Error: %(error)s",
+ {'public_dir': public_dir,
+ 'error': exc})
except OSError as exc:
LOG.debug(