roll back the option --interface and use --registry-interface (-R) for both version...
[sfa.git] / sfa / client / sfi.py
index a7c6ae1..a52e2bd 100644 (file)
@@ -379,13 +379,15 @@ class Sfi:
                               help='how myslice config variables as well')
 
         if command in ("version"):
-            parser.add_option("-R","--registry-version",
-                              action="store_true", dest="version_registry", default=False,
-                              help="probe registry version instead of sliceapi")
             parser.add_option("-l","--local",
                               action="store_true", dest="version_local", default=False,
                               help="display version of the local client")
 
+        if command in ("version", "trusted"):
+            parser.add_option("-R","--registry-interface",
+                             action="store_true", dest="registry-interface", default=False,
+                             help="target the registry interface instead of slice interface")
+
         if command in ("add", "update"):
             parser.add_option('-x', '--xrn', dest='xrn', metavar='<xrn>', help='object hrn/urn (mandatory)')
             parser.add_option('-t', '--type', dest='type', metavar='<type>', help='object type', default=None)
@@ -834,7 +836,7 @@ use this if you mean an authority instead""")
         if options.version_local:
             version=version_core()
         else:
-            if options.version_registry:
+            if options.registry-interface:
                 server=self.registry()
             else:
                 server = self.sliceapi()
@@ -1594,6 +1596,7 @@ $ sfi m -b http://mymanifold.foo.com:7080/
         # (f) and finally upload them to manifold server
         # xxx todo add an option so the password can be set on the command line
         # (but *NOT* in the config file) so other apps can leverage this
+        self.logger.info("Uploading on backend at %s"%myslice_dict['backend'])
         uploader = ManifoldUploader (logger=self.logger,
                                      url=myslice_dict['backend'],
                                      platform=myslice_dict['platform'],
@@ -1623,13 +1626,21 @@ $ sfi m -b http://mymanifold.foo.com:7080/
         """
         return the trusted certs at this interface (get_trusted_certs)
         """ 
-        trusted_certs = self.registry().get_trusted_certs()
+        if options.registry-interface:
+            server=self.registry()
+        else:
+            server = self.sliceapi()
+        cred = self.my_authority_credential_string()
+        trusted_certs = server.get_trusted_certs(cred)
+        if not options.registry-interface:
+            trusted_certs = ReturnValue.get_value(trusted_certs)
+
         for trusted_cert in trusted_certs:
-            print "\n===========================================================\n"
-            gid = GID(string=trusted_cert)
-            gid.dump()
-            cert = Certificate(string=trusted_cert)
-            self.logger.debug('Sfi.trusted -> %r'%cert.get_subject())
-            print "Certificate:\n%s\n\n"%trusted_cert
-        return 
+             print "\n===========================================================\n"
+             gid = GID(string=trusted_cert)
+             gid.dump()
+             cert = Certificate(string=trusted_cert)
+             self.logger.debug('Sfi.trusted -> %r'%cert.get_subject())
+             print "Certificate:\n%s\n\n"%trusted_cert
 
+        return