diff options
author | Zuul <zuul@review.opendev.org> | 2023-01-17 16:57:59 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2023-01-17 16:57:59 +0000 |
commit | a48af6b5f13598ef83fff6dfd5a01480ed23743d (patch) | |
tree | d496065fb062556536ad5d0a386c9a9d68783b36 /ironic/drivers | |
parent | b11067cfdcef0a370177803eddb86aa972b12b3d (diff) | |
parent | c05c09fd3ac7ed2c3a5dd13a602e3ae70dfb8734 (diff) | |
download | ironic-a48af6b5f13598ef83fff6dfd5a01480ed23743d.tar.gz |
Merge "Fix selinux context of published image hardlink"
Diffstat (limited to 'ironic/drivers')
-rw-r--r-- | ironic/drivers/modules/image_utils.py | 10 |
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( |