From 7df10fab475b2ac64c3c45e595de8041cde630f1 Mon Sep 17 00:00:00 2001
From: Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Date: Thu, 17 Feb 2011 16:15:38 +0100
Subject: [PATCH] expose .ssh in homedir only for omf-friendly slices

---
 sliver_vs.py     | 4 +++-
 slivermanager.py | 9 ++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/sliver_vs.py b/sliver_vs.py
index a86b3f6..78ff482 100644
--- a/sliver_vs.py
+++ b/sliver_vs.py
@@ -197,7 +197,9 @@ class Sliver_VS(accounts.Account, vserver.VServer):
             time.sleep(delay)
             # the generic /etc/init.d/vinit script is permanently refreshed, and enabled
             self.install_and_enable_vinit()
-            self.expose_ssh_dir()
+            # expose .ssh for omf_friendly slivers
+            if 'omf_control' in self.rspec['tags']:
+                self.expose_ssh_dir()
             # if a change has occured in the slice initscript, reflect this in /etc/init.d/vinit.slice
             self.refresh_slice_vinit()
             child_pid = os.fork()
diff --git a/slivermanager.py b/slivermanager.py
index 341800b..f0a610a 100644
--- a/slivermanager.py
+++ b/slivermanager.py
@@ -178,15 +178,18 @@ def GetSlivers(data, config = None, plc=None, fullupdate=True):
         for resname, default_amount in DEFAULT_ALLOCATION.iteritems():
             try:
                 t = type(default_amount)
-                amt = t.__new__(t, attributes[resname])
-            except (KeyError, ValueError): amt = default_amount
-            rspec[resname] = amt
+                amount = t.__new__(t, attributes[resname])
+            except (KeyError, ValueError): amount = default_amount
+            rspec[resname] = amount
 
         # add in sysctl attributes into the rspec
         for key in attributes.keys():
             if key.find("sysctl.") == 0:
                 rspec[key] = attributes[key]
 
+        # also export tags in rspec so they make it to the sliver_vs.start call
+        rspec['tags']=attributes
+
         database.db.deliver_record(rec)
     if fullupdate: database.db.set_min_timestamp(data['timestamp'])
     # slivers are created here.
-- 
2.47.0