Example #1
0
 def on_tenant(self, args):
     kwargs = {}
     try:
         utils.print_list(self.top.kc.tenants.list(**kwargs),
                 ['name', 'id', 'enabled', 'description'])
     except kc_exceptions.NotFound:
         # Most likely this is not authorized
         raise exceptions.NotAuthorized(None, 'list tenant')
Example #2
0
 def on_user(self, args):
     if len(args) > 1:
         try:
             tenant_ref = self.top.kc.tenants.get_by_name_or_id(args[1])
             tenant_id = tenant_ref.id
         except kc_exceptions.NotFound:
             print "tenant %s not found" % args[1]
             return
     else:
         tenant_id = None
     try:
         utils.print_list(self.top.kc.users.list(tenant_id=tenant_id,
                                                 limit=999),
                 ['name', 'id', 'enabled', 'email'])
     except kc_exceptions.NotFound:
         # Most likely this is not authorized
         raise exceptions.NotAuthorized(None, 'list user')
Example #3
0
 def on_role(self, args):
     if len(args) > 1:
         try:
             user_ref = self.top.kc.users.get_by_name_or_id(args[1])
             user_id = user_ref.id
         except kc_exceptions.NotFound:
             print "tenant %s not found" % args[1]
             return
     else:
         user_id = None
     try:
         if user_id:
             # FIXME(dtroyer): apparently UserController.get_user_roles()
             #                 is not implemented in keystone
             utils.print_list(self.top.kc.roles.roles_for_user(user_id),
                     ['id', 'name'])
         else:
             utils.print_list(self.top.kc.roles.list(), ['id', 'name'])
     except kc_exceptions.NotFound:
         # Most likely this is not authorized
         raise exceptions.NotAuthorized(None, 'list role')
Example #4
0
 def on_service(self, args):
     try:
         utils.print_list(self.top.kc.services.list(), ['id', 'name'])
     except kc_exceptions.NotFound:
         # Most likely this is not authorized
         raise exceptions.NotAuthorized(None, 'list service')
Example #5
0
 def on_security_group_rules(self, args):
     self.top._get_nova()
     utils.print_list(self.top.nc.security_group_rules.list(),
             ['id', 'name'])
Example #6
0
 def on_keypair(self, args):
     self.top._get_nova()
     utils.print_list(self.top.nc.keypairs.list(), ['id', 'name'])
Example #7
0
 def on_instance(self, args):
     self.top._get_nova()
     utils.print_list(self.top.nc.servers.list(detailed=False),
             ['id', 'name'])
Example #8
0
 def on_imagen(self, args):
     self.top._get_nova()
     utils.print_list(self.top.nc.images.list(), ['id', 'name'])
Example #9
0
 def on_flavor(self, args):
     self.top._get_nova()
     utils.print_list(self.top.nc.flavors.list(), ['id', 'name'])