Ejemplo n.º 1
0
def do_share_server_show(cs, args):
    """Show share server info."""
    share_server = cs.share_servers.get(args.id)
    # All 'backend_details' data already present as separated strings,
    # so remove big dict from view.
    if "backend_details" in share_server._info:
        del share_server._info["backend_details"]
    utils.print_dict(share_server._info)
Ejemplo n.º 2
0
def do_share_network_create(cs, args):
    """Create description for network used by the tenant"""
    values = {'neutron_net_id': args.neutron_net_id,
              'neutron_subnet_id': args.neutron_subnet_id,
              'name': args.name,
              'description': args.description}
    share_network = cs.share_networks.create(**values)
    info = share_network._info.copy()
    utils.print_dict(info)
Ejemplo n.º 3
0
def do_share_network_update(cs, args):
    """Update share network data"""
    values = {'neutron_net_id': args.neutron_net_id,
              'neutron_subnet_id': args.neutron_subnet_id,
              'name': args.name,
              'description': args.description}
    share_network = _find_share_network(cs, args.share_network)\
        .update(**values)
    info = share_network._info.copy()
    utils.print_dict(info)
Ejemplo n.º 4
0
def do_security_service_create(cs, args):
    """Create security service used by tenant"""
    values = {'dns_ip': args.dns_ip,
              'server': args.server,
              'domain': args.domain,
              'sid': args.sid,
              'password': args.password,
              'name': args.name,
              'description': args.description}
    security_service = cs.security_services.create(args.type, **values)
    info = security_service._info.copy()
    utils.print_dict(info)
Ejemplo n.º 5
0
def do_security_service_update(cs, args):
    """Update security service."""
    values = {
        'dns_ip': args.dns_ip,
        'server': args.server,
        'domain': args.domain,
        'user': args.user,
        'password': args.password,
        'name': args.name,
        'description': args.description,
    }
    security_service = _find_security_service(
        cs, args.security_service).update(**values)
    utils.print_dict(security_service._info)
Ejemplo n.º 6
0
def do_credentials(cs, args):
    """Show user credentials returned from auth"""
    catalog = cs.client.service_catalog.catalog
    utils.print_dict(catalog['access']['user'], "User Credentials")
    utils.print_dict(catalog['access']['token'], "Token")
Ejemplo n.º 7
0
def do_endpoints(cs, args):
    """Discover endpoints that get returned from the authenticate services"""
    catalog = cs.client.service_catalog.catalog
    for e in catalog['access']['serviceCatalog']:
        utils.print_dict(e['endpoints'][0], e['name'])
Ejemplo n.º 8
0
def do_endpoints(cs, args):
    """Discover endpoints that get returned from the authenticate services"""
    catalog = cs.client.service_catalog.catalog
    for e in catalog['access']['serviceCatalog']:
        utils.print_dict(e['endpoints'][0], e['name'])
Ejemplo n.º 9
0
def _print_share(cs, share):
    info = share._info.copy()
    utils.print_dict(info)
Ejemplo n.º 10
0
def _print_share_snapshot(cs, snapshot):
    info = snapshot._info.copy()
    info.pop('links')
    utils.print_dict(info)
Ejemplo n.º 11
0
def _quota_show(quotas):
    quota_dict = {}
    for resource in _quota_resources:
        quota_dict[resource] = getattr(quotas, resource, None)
    utils.print_dict(quota_dict)
Ejemplo n.º 12
0
def do_allow_access(cs, args):
    """Allow access to the share."""
    share = _find_share(cs, args.share)
    access = share.allow(args.access_type, args.access_to)
    utils.print_dict(access)
Ejemplo n.º 13
0
def _print_share(cs, share):
    info = share._info.copy()
    utils.print_dict(info)
Ejemplo n.º 14
0
def do_security_service_show(cs, args):
    """Show security service."""
    security_service = _find_security_service(cs, args.security_service)
    info = security_service._info.copy()
    utils.print_dict(info)
Ejemplo n.º 15
0
def _quota_show(quotas):
    quota_dict = {}
    for resource in _quota_resources:
        quota_dict[resource] = getattr(quotas, resource, None)
    utils.print_dict(quota_dict)
Ejemplo n.º 16
0
def do_share_network_show(cs, args):
    """Get a description for network used by the tenant"""
    share_network = _find_share_network(cs, args.share_network)
    info = share_network._info.copy()
    utils.print_dict(info)
Ejemplo n.º 17
0
def do_share_server_details(cs, args):
    """Show share server details."""
    details = cs.share_servers.details(args.id)
    utils.print_dict(details._info)
Ejemplo n.º 18
0
def do_metadata_show(cs, args):
    """Show metadata of given share."""
    share = utils.find_share(cs, args.share)
    metadata = cs.shares.get_metadata(share)._info
    utils.print_dict(metadata, 'Metadata-property')
Ejemplo n.º 19
0
def do_metadata_update_all(cs, args):
    """Update all metadata of a share."""
    share = utils.find_share(cs, args.share)
    metadata = _extract_metadata(args)
    metadata = share.update_all_metadata(metadata)._info['metadata']
    utils.print_dict(metadata, 'Metadata-property')
Ejemplo n.º 20
0
def do_allow_access(cs, args):
    """Allow access to the share."""
    share = _find_share(cs, args.share)
    access = share.allow(args.access_type, args.access_to)
    utils.print_dict(access)
Ejemplo n.º 21
0
def do_security_service_show(cs, args):
    """Show security service"""
    security_service = cs.security_services.get(args.security_service)
    info = security_service._info.copy()
    utils.print_dict(info)
Ejemplo n.º 22
0
def _print_share_snapshot(cs, snapshot):
    info = snapshot._info.copy()
    info.pop('links')
    utils.print_dict(info)
Ejemplo n.º 23
0
def do_credentials(cs, args):
    """Show user credentials returned from auth"""
    catalog = cs.client.service_catalog.catalog
    utils.print_dict(catalog['access']['user'], "User Credentials")
    utils.print_dict(catalog['access']['token'], "Token")