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

Michael Scherer misc at zarb.org
Fri May 3 20:01:22 UTC 2013


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




More information about the libvir-list mailing list