from sfa.client.sfaserverproxy import SfaServerProxy, ServerException
from sfa.client.client_helper import pg_users_arg, sfa_users_arg
from sfa.client.return_value import ReturnValue
+from sfa.client.candidates import Candidates
CM_PORT=12346
("get_ticket", "slice_hrn rspec"),
("redeem_ticket", "ticket"),
("delegate", "name"),
- ("create_gid", "[name]"),
- ("get_trusted_certs", "cred"),
+ ("gid", "[name]"),
+ ("trusted", "cred"),
("config", ""),
]
# 'create' does return the new rspec, makes sense to save that too
- if command in ("resources", "show", "list", "create_gid", 'create'):
+ if command in ("resources", "show", "list", "gid", 'create'):
parser.add_option("-o", "--output", dest="file",
help="output XML to file", metavar="FILE", default=None)
self.print_command_help(options)
return -1
- command = args[0]
+ # complete / find unique match with command set
+ command_candidates = Candidates (self.available_names)
+ input = args[0]
+ command = command_candidates.only_match(input)
+ if not command:
+ self.print_command_help(options)
+ sys.exit(1)
+ # second pass options parsing
self.command_parser = self.create_command_parser(command)
(command_options, command_args) = self.command_parser.parse_args(args[1:])
self.command_options = command_options
self.read_config ()
self.bootstrap ()
- self.logger.info("Command=%s" % command)
+ self.logger.debug("Command=%s" % command)
try:
self.dispatch(command, command_options, command_args)
# init self-signed cert, user credentials and gid
def bootstrap (self):
- client_bootstrap = SfaClientBootstrap (self.user, self.reg_url, self.options.sfi_dir)
+ client_bootstrap = SfaClientBootstrap (self.user, self.reg_url, self.options.sfi_dir,
+ logger=self.logger)
# if -k is provided, use this to initialize private key
if self.options.user_private_key:
client_bootstrap.init_private_key_if_missing (self.options.user_private_key)
rspec.filter({'component_manager_id': server_version['urn']})
rspec = RSpecConverter.to_pg_rspec(rspec.toxml(), content_type='request')
else:
+ print >>sys.stderr, "\r\n \r\n \r\n WOOOOOO"
users = sfa_users_arg(user_records, slice_record)
# do not append users, keys, or slice tags. Anything
self.logger.log_exc(e.message)
return
- def create_gid(self, options, args):
+ def gid(self, options, args):
"""
Create a GID (CreateGid)
"""
self.logger.info("delegated credential for %s to %s and wrote to %s"%(object_hrn, delegee_hrn,dest_fn))
- def get_trusted_certs(self, options, args):
+ def trusted(self, options, args):
"""
return uhe trusted certs at this interface (get_trusted_certs)
"""
gid = GID(string=trusted_cert)
gid.dump()
cert = Certificate(string=trusted_cert)
- self.logger.debug('Sfi.get_trusted_certs -> %r'%cert.get_subject())
+ self.logger.debug('Sfi.trusted -> %r'%cert.get_subject())
return
def config (self, options, args):