[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [sandbox PATCH v2 1/2] Use drop-in configuration file instead of creating a custom file



This permit to no longer track the source, to use a custom file
in /etc without conflict. This change require a newer version of
systemd ( > 198 )
---
 bin/virt-sandbox-service | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index 2096be1..3cecff8 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -625,12 +625,16 @@ WantedBy=%(TARGET)s
                 self.add_bind_mount(source, d)
 
     def create_container_unit(self, src, dest, unit):
-            fd = open(dest + "/" + unit, "w")
-            fd.write(""".include %s
+            dropin_dir = "%s/%s.d" % (dest, unit)
+            if not os.path.exists(dropin_dir):
+                os.mkdir(dropin_dir)
+
+            fd = open(dropin_dir + "/virt-sandbox.conf", "w")
+            fd.write("""; file placed here by virt-sandbox-service
 [Service]
 PrivateTmp=false
 PrivateNetwork=false
-""" % src )
+""" )
             fd.close()
 
     def gen_content(self):
-- 
1.8.2.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]