Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: Create /etc/pki/libvirt if not exists
......................................................................

packaging: setup: Create /etc/pki/libvirt if not exists

Bug-Url: https://bugzilla.redhat.com/1034634
Change-Id: I5611532e2a2b2a98a662bc1549ed64a275f105fd
Signed-off-by: Yedidyah Bar David <d...@redhat.com>
---
M src/ovirt_hosted_engine_setup/constants.py
M src/plugins/ovirt-hosted-engine-setup/pki/vdsmpki.py
2 files changed, 27 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/47/25747/1

diff --git a/src/ovirt_hosted_engine_setup/constants.py 
b/src/ovirt_hosted_engine_setup/constants.py
index 9275ef4..7054304 100644
--- a/src/ovirt_hosted_engine_setup/constants.py
+++ b/src/ovirt_hosted_engine_setup/constants.py
@@ -182,30 +182,29 @@
         'libvirt-spice',
         'ca-cert.pem'
     )
-    LIBVIRT_CLIENT_CERT = os.path.join(
+    LIBVIRT_PKI = os.path.join(
         SYSCONFDIR,
         'pki',
-        'libvirt',
+        'libvirt'
+    )
+    LIBVIRT_PKI_PRIVATE = os.path.join(
+        LIBVIRT_PKI,
+        'private',
+    )
+    LIBVIRT_CLIENT_CERT = os.path.join(
+        LIBVIRT_PKI,
         'clientcert.pem'
     )
     LIBVIRT_CLIENT_KEY = os.path.join(
-        SYSCONFDIR,
-        'pki',
-        'libvirt',
-        'private',
+        LIBVIRT_PKI_PRIVATE,
         'clientkey.pem'
     )
     LIBVIRT_SERVER_CERT = os.path.join(
-        SYSCONFDIR,
-        'pki',
-        'libvirt',
+        LIBVIRT_PKI,
         'servercert.pem'
     )
     LIBVIRT_SERVER_KEY = os.path.join(
-        SYSCONFDIR,
-        'pki',
-        'libvirt',
-        'private',
+        LIBVIRT_PKI_PRIVATE,
         'serverkey.pem'
     )
     LIBVIRT_QEMU_CONF = os.path.join(
diff --git a/src/plugins/ovirt-hosted-engine-setup/pki/vdsmpki.py 
b/src/plugins/ovirt-hosted-engine-setup/pki/vdsmpki.py
index ee4195a..a68f0f1 100644
--- a/src/plugins/ovirt-hosted-engine-setup/pki/vdsmpki.py
+++ b/src/plugins/ovirt-hosted-engine-setup/pki/vdsmpki.py
@@ -76,6 +76,21 @@
         shutil.copyfile(s, d)
 
     def _copy_vdsm_pki(self):
+        if not os.path.exists(ohostedcons.FileLocations.LIBVIRT_PKI):
+            os.makedirs(ohostedcons.FileLocations.LIBVIRT_PKI)
+        if not os.path.exists(ohostedcons.FileLocations.LIBVIRT_PKI_PRIVATE):
+            os.makedirs(ohostedcons.FileLocations.LIBVIRT_PKI_PRIVATE)
+            os.chmod(ohostedcons.FileLocations.LIBVIRT_PKI_PRIVATE, 0o750)
+            os.chown(
+                ohostedcons.FileLocations.LIBVIRT_PKI_PRIVATE,
+                self.environment[
+                    ohostedcons.VDSMEnv.VDSM_UID
+                ],
+                self.environment[
+                    ohostedcons.VDSMEnv.KVM_GID
+                ]
+            )
+
         for s, d in (
             (ohostedcons.FileLocations.VDSM_CA_CERT,
                 ohostedcons.FileLocations.SYS_CA_CERT),


-- 
To view, visit http://gerrit.ovirt.org/25747
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5611532e2a2b2a98a662bc1549ed64a275f105fd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <d...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to