add new file to the package
[plcapi.git] / PLC / Methods / GetSliceFamily.py
index 49aee9b..f1f8dcc 100644 (file)
@@ -6,7 +6,8 @@ from PLC.Faults import *
 from PLC.Parameter import *
 from PLC.Slices import Slice, Slices
 
-from PLC.Accessors.Accessors_standard import *                 # import slice accessors
+from PLC.Accessors.Accessors_standard import *                  # import slice accessors
+from PLC.Accessors.Accessors_omf import *                       # import slice accessors
 
 class GetSliceFamily(Method):
     """
@@ -27,9 +28,9 @@ class GetSliceFamily(Method):
 
     returns = Parameter (str, "the slicefamily this slice should be based upon")
 
-    # 
+    #
     ### system slices - at least planetflow - still rely on 'vref'
-    # 
+    #
     def call(self, auth, slice_id_or_name):
         # Get slice information
         slices = Slices(self.api, [slice_id_or_name])
@@ -50,9 +51,15 @@ class GetSliceFamily(Method):
         # the vref tag, if set, wins over pldistro
         vref = GetSliceVref (self.api).call(auth,slice_id)
 
+        # omf-control'ed slivers need the omf vserver reference image
+        # this is to avoid asking users to set both tags 'omf_control' and 'vref'
+        if not vref and GetSliceOmfControl(self.api).call(auth,slice_id):
+            SetSliceVref (self.api) (auth,slice_id,'omf')
+            vref='omf'
+
         # xxx would make sense to check the corresponding vserver rpms are available
         # in all node-families yum repos (and yumgroups, btw)
-        if vref: 
+        if vref:
             return "%s-%s-%s"%(vref,fcdistro,arch)
         else:
             return "%s-%s-%s"%(pldistro,fcdistro,arch)