Merge branch 'master' of ssh://git.planet-lab.org/git/sfa
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Mon, 27 Sep 2010 18:43:11 +0000 (14:43 -0400)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Mon, 27 Sep 2010 18:43:11 +0000 (14:43 -0400)
sfa.spec
sfa/methods/CreateSliver.py
sfa/plc/slices.py
sfa/util/namespace.py
sfa/util/sfatablesRuntime.py

index 27f51f3..6774c38 100644 (file)
--- a/sfa.spec
+++ b/sfa.spec
@@ -5,8 +5,8 @@
 %define url $URL$
 
 %define name sfa
-%define version 0.9
-%define taglevel 16
+%define version 1.0
+%define taglevel 0
 
 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
 %global python_sitearch        %( python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" )
@@ -147,18 +147,33 @@ rm -rf $RPM_BUILD_ROOT
 %files sfatables
 %{_bindir}/sfatables
 
-%pre plc
-[ -f %{_sysconfdir}/init.d/sfa ] && service sfa stop ||:
-
-%pre cm
-[ -f %{_sysconfdir}/init.d/sfa-cm ] && service sfa-cm stop ||:
-
+### sfa-plc installs the 'sfa' service
 %post plc
 chkconfig --add sfa
 
+%preun plc
+if [ "$1" = 0 ] ; then
+  /sbin/service sfa stop 
+  /sbin/chkconfig --del sfa
+fi
+
+%postun plc
+[ "$1" -ge "1" ] && service sfa restart
+
+### sfa-cm installs the 'sfa-cm' service
 %post cm
 chkconfig --add sfa-cm
 
+%preun cm
+if [ "$1" = 0 ] ; then
+   /sbin/service sfa-cm stop
+   /sbin/chkconfig --del sfa-cm
+fi
+
+%postun cm
+[ "$1" -ge "1" ] && service sfa-cm restart
+
+
 %changelog
 * Tue Sep 07 2010 Tony Mack <tmack@cs.princeton.edu> - sfa-0.9-16
 - truncate login base of external (ProtoGeni, etc) slices to 20 characters
index c21ceb4..d2654b2 100644 (file)
@@ -42,9 +42,9 @@ class CreateSliver(Method):
         
         # flter rspec through sfatables
         if self.api.interface in ['aggregate']:
-            chain_name = 'OUTGOING'
+            chain_name = 'INCOMING'
         elif self.api.interface in ['slicemgr']:
-            chain_name = 'FORWARD-OUTGOING'
+            chain_name = 'FORWARD-INCOMING'
         rspec = run_sfatables(chain_name, hrn, origin_hrn, rspec)
         allocated = manager.create_slice(self.api, slice_xrn, creds, rspec, users)
 
index 8728a25..9b3ff5d 100644 (file)
@@ -333,10 +333,12 @@ class Slices:
                 self.api.plshell.AddPersonToSlice(self.api.plauth, person_dict['email'], slicename)
                 self.api.plshell.AddPersonToSite(self.api.plauth, person_dict['email'], site_id)
             finally:
-                if peer and not local_person:
-                    self.api.plshell.BindObjectToPeer(self.api.plauth, 'person', person_id, peer, person_dict['pointer'])
                 if peer:
-                    self.api.plshell.BindObjectToPeer(self.api.plauth, 'site', site_id, peer, remote_site_id)
+                    try: self.api.plshell.BindObjectToPeer(self.api.plauth, 'site', site_id, peer, remote_site_id)
+                    except: pass
+                if peer and not local_person:
+                    try: self.api.plshell.BindObjectToPeer(self.api.plauth, 'person', person_id, peer, person_dict['pointer'])
+                    except: pass
             
             self.verify_keys(registry, credential, person_dict, key_ids, person_id, peer, local_person)
 
index b94eb1d..512f398 100644 (file)
@@ -57,6 +57,9 @@ def urn_to_hrn(urn):
     """
     convert a urn to hrn
     return a tuple (hrn, type)
+    Warning: urn_to_hrn() replces some special characters that 
+    are not replaced in hrn_to_urn(). Due to this, 
+    urn_to_hrn() -> hrn_to_urn() may not return the original urn
     """
 
     # if this is already a hrn dont do anything
index 14ec6f7..170fa88 100644 (file)
@@ -7,8 +7,6 @@ def fetch_context(slice_hrn, user_hrn, contexts):
     information that sfatables is requesting. But for now, we just return
     the basic information needed in a dict.
     """
-    slice_hrn = urn_to_hrn(slice_xrn)[0]
-    user_hrn = urn_to_hrn(user_xrn)[0]
     base_context = {'sfa':{'user':{'hrn':user_hrn}, 'slice':{'hrn':slice_hrn}}}
     return base_context