def storageprovider_show(args):
    obj = StorageProvider(args.ip, args.port)
    from common import TableGenerator
    try:
        resultfinal = []
        hyperScale = []
        output = obj.show(args.name, args.xml)
        if(args.xml):
            return common.format_xml(output)
        if("secondary_url" in output):
            hyperScale = obj.portremoval(output["secondary_url"])
            output["hyperscale_host"] = hyperScale[0]
            output["hyperscale_port"] = hyperScale[1]
        if ("provider_id" not in output):
            print "Provider ID not there"
            return []
        else:
            resultfinal.append(output)
            if("secondary_url" in output):
                TableGenerator(
                        resultfinal, [
                            'provider_id', 'name', 'interface',
                            'ip_address', 'port_number', 'hyperscale_host', 'hyperscale_port']).printTable()
            else :
                TableGenerator(
                        resultfinal, [
                            'provider_id', 'name', 'interface',
                            'ip_address', 'port_number']).printTable()
    except SOSError as e:
        common.format_err_msg_and_raise(
            "show",
            "storageprovider",
            e.err_text,
            e.err_code)
Exemple #2
0
def order_show(args):
    orderObj = Order(args.ip, args.uiPort)
    try:

        orderDetails = orderObj.show_by_uri(args.uri, args.xml)

        if (orderDetails is None):
            raise SOSError(SOSError.NOT_FOUND_ERR,
                           "Could not find the matching order")

        if (args.waitForExecution is True):
            orderObj.block_until_complete(args.uri)
            # refresh order details
            orderDetails = orderObj.show_by_uri(args.uri, args.xml)

        if (args.xml):
            return common.format_xml(orderDetails)

        return common.format_json_object(orderDetails)

    except SOSError as e:
        common.format_err_msg_and_raise("show", "order", e.err_text,
                                        e.err_code)

    return
Exemple #3
0
def order_show(args):
    orderObj = Order(args.ip, args.uiPort)
    try:

        orderDetails = orderObj.show_by_uri(args.uri, args.xml)

        if(orderDetails is None):
            raise SOSError(
                SOSError.NOT_FOUND_ERR,
                "Could not find the matching order")

        if (args.waitForExecution is True):
            orderObj.block_until_complete(args.uri)
            # refresh order details
            orderDetails = orderObj.show_by_uri(args.uri, args.xml)

        if(args.xml):
            return common.format_xml(orderDetails)

        return common.format_json_object(orderDetails)

    except SOSError as e:
        common.format_err_msg_and_raise(
            "show",
            "order",
            e.err_text,
            e.err_code)

    return
def quotadirectory_show(args):
    obj = QuotaDirectory(args.ip, args.port)    
    try:
        resourceUri = obj.storageResource_query(
            args.filesystem,
            args.project,
            args.tenant)
        respContent = obj.quotadirectory_show(
            resourceUri,
            args.name,
            args.xml)

        if(args.xml):
            return common.format_xml(respContent)
        else:
            return common.format_json_object(respContent)

    except SOSError as e:
        if (e.err_code == SOSError.SOS_FAILURE_ERR):
            raise SOSError(
                SOSError.SOS_FAILURE_ERR,
                "quotadirectory " +
                args.name +
                ": Not Found")
        else:
            common.format_err_msg_and_raise(
                "show",
                "quotadirectory",
                e.err_text,
                e.err_code)
def storageprovider_show(args):
    obj = StorageProvider(args.ip, args.port)
    from common import TableGenerator
    try:
        resultfinal = []
        hyperScale = []
        output = obj.show(args.name, args.xml)
        if(args.xml):
            return common.format_xml(output)
        if("secondary_url" in output):
            hyperScale = obj.portremoval(output["secondary_url"])
            output["hyperscale_host"] = hyperScale[0]
            output["hyperscale_port"] = hyperScale[1]
        if ("provider_id" not in output):
            print "Provider ID not there"
            return []
        else:
            resultfinal.append(output)
            if("secondary_url" in output):
                TableGenerator(
                        resultfinal, [
                            'provider_id', 'name', 'interface',
                            'ip_address', 'port_number', 'hyperscale_host', 'hyperscale_port']).printTable()
            else :
                TableGenerator(
                        resultfinal, [
                            'provider_id', 'name', 'interface',
                            'ip_address', 'port_number']).printTable()
    except SOSError as e:
        common.format_err_msg_and_raise(
            "show",
            "storageprovider",
            e.err_text,
            e.err_code)
def storageprovider_show(args):
    obj = StorageProvider(args.ip, args.port)
    try:
        output = obj.show(args.name, args.xml)
        if args.xml:
            return common.format_xml(output)
        else:
            return common.format_json_object(output)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "storageprovider", e.err_text, e.err_code)
def network_show(args):
    obj = Network(args.ip, args.port)
    try:
        res = obj.show(args.name, args.varray, args.xml)
        if res:
            if args.xml == True:
                return common.format_xml(res)
            return common.format_json_object(res)
    except SOSError as e:
        raise e
def computeimage_show(args):
    try:
        obj = ComputeImage(args.ip, args.port)
        res = obj.show_computeimage(args.name, args.xml)
        if(args.xml):
            return common.format_xml(res)
        return common.format_json_object(res)
    except SOSError as e:
        raise common.format_err_msg_and_raise("show", "computeimage",
                                              e.err_text, e.err_code)
def ps_show(args):
    
    obj = ProtectionSystem(args.ip, args.port)
    try:
        res = obj.ps_show(args.name, args.type, args.xml)
        if(args.xml):
            return common.format_xml(res)
        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "protectionsystem", e.err_text, e.err_code)
def show(args):
    obj = VolumeGroup(args.ip, args.port)
    try:
        res = obj.show(args.name, args.xml)
        if(res):
            if (args.xml == True):
                return common.format_xml(res)
            return common.format_json_object(res)
    except SOSError as e:
        raise e
Exemple #11
0
def computeimage_show(args):
    try:
        obj = ComputeImage(args.ip, args.port)
        res = obj.show_computeimage(args.name, args.xml)
        if (args.xml):
            return common.format_xml(res)
        return common.format_json_object(res)
    except SOSError as e:
        raise common.format_err_msg_and_raise("show", "computeimage",
                                              e.err_text, e.err_code)
Exemple #12
0
def varray_show(args):
    obj = VirtualArray(args.ip, args.port)
    try:
        res = obj.varray_show(args.name, args.xml)
        if (args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "varray", e.err_text,
                                        e.err_code)
Exemple #13
0
def filepolicy_show(args):
    obj = FilePolicy(args.ip, args.port)
    try:
        res = obj.filepolicy_show(args.name, args.xml)
        if args.xml:
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError, e:
        common.format_err_msg_and_raise('show', 'filepolicy',
                e.err_text, e.err_code)
def consistencygroup_show(args):
    
    obj = ConsistencyGroup(args.ip, args.port)
    try:
        res = obj.show(args.name, args.project, args.tenant, args.xml)
        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        raise e
Exemple #15
0
def consistencygroup_show(args):

    obj = ConsistencyGroup(args.ip, args.port)
    try:
        res = obj.show(args.name, args.project, args.tenant, args.xml)
        if (args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        raise e
Exemple #16
0
def keystore_show(args):
    obj = KeyStore(args.ip, args.port)
    try:
        res = obj.keystore_show(args.xml)
        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "keystore",
                                        e.err_text, e.err_code)
def cluster_show(args):
    obj = Cluster(args.ip, args.port)
    try:
        res = obj.cluster_show(args.name, args.project, args.tenant,  args.xml)
        
        if(args.xml):
            return common.format_xml(res)
        
        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "cluster", e.err_text, e.err_code)
def varray_show(args):
    obj = VirtualArray(args.ip, args.port)
    try:
        res = obj.varray_show(args.name, args.xml)
        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "varray",
                                        e.err_text, e.err_code)
Exemple #19
0
def ps_show(args):

    obj = ProtectionSystem(args.ip, args.port)
    try:
        res = obj.ps_show(args.name, args.type, args.xml)
        if (args.xml):
            return common.format_xml(res)
        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "protectionsystem", e.err_text,
                                        e.err_code)
def truststore_show_settings(args):
    obj = TrustStore(args.ip, args.port)
    try:
        res = obj.truststore_get_settings(args.xml)
        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show settings", "truststore",
                                        e.err_text, e.err_code)
Exemple #21
0
def network_show(args):
    obj = Network(args.ip, args.port)
    try:
        res = obj.show(args.name, args.xml)
        if(res):
            if (args.xml):
                return common.format_xml(res)
            return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "network",
                                        e.err_text, e.err_code)
def network_show(args):
    obj = Network(args.ip, args.port)
    try:
        res = obj.show(args.name, args.xml)
        if (res):
            if (args.xml):
                return common.format_xml(res)
            return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "network", e.err_text,
                                        e.err_code)
Exemple #23
0
def keystore_show(args):
    obj = KeyStore(args.ip, args.port)
    try:
        res = obj.keystore_show(args.xml)
        if (args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "keystore", e.err_text,
                                        e.err_code)
Exemple #24
0
def vdc_show(args):
    try:
        res = VirtualDatacenter(args.ip,
                                args.port).vdc_show(args.name, args.xml)
        if (res):
            if (args.xml == True):
                return common.format_xml(res)
            else:
                return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "vdc", e.err_text, e.err_code)
def exportgroup_show(args):
    
    obj = ExportGroup(args.ip, args.port)
    try:
        res = obj.exportgroup_show(args.name, args.project, args.tenant, args.xml)
        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        raise common.format_err_msg_and_raise("show", "exportgroup", e.err_text, e.err_code)
def computeimageserver_show(args):
    obj = ComputeImageServers(args.ip, args.port)
    try:
        res = obj.computeimageserver_show(args.name, args.xml)

        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "computeimageserver",
                                        e.err_text, e.err_code)
Exemple #27
0
def event_details(args):
    obj = Event(args.ip, args.port)
    try:
        res = obj.event_details(args.uri)

        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("details", "event",
                                        e.err_text, e.err_code)
def get_role(args):
    obj = Tenant(args.ip, args.port)

    try:
        res = obj.tenant_get_role(args.name, None, None, args.xml)
        if args.xml:
            return common.format_xml(str(res))

        return common.format_json_object(res)

    except SOSError as e:
        raise e
def computelement_show(args):
    try:
        obj = ComputeElement(args.ip, args.port)
        res = obj.show_compute_element(args.name, args.computesystem, args.xml)
        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)

    except SOSError as e:
        raise common.format_err_msg_and_raise("show", "computelement",
                                              e.err_text, e.err_code)
Exemple #30
0
def event_details(args):
    obj = Event(args.ip, args.port)
    try:
        res = obj.event_details(args.uri)

        if (args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("details", "event", e.err_text,
                                        e.err_code)
def computeimageserver_show(args):
    obj = ComputeImageServers(args.ip, args.port)
    try:
        res = obj.computeimageserver_show(args.name, args.xml)

        if (args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "computeimageserver",
                                        e.err_text, e.err_code)
Exemple #32
0
def computelement_show(args):
    try:
        obj = ComputeElement(args.ip, args.port)
        res = obj.show_compute_element(args.name, args.computesystem, args.xml)
        if (args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)

    except SOSError as e:
        raise common.format_err_msg_and_raise("show", "computelement",
                                              e.err_text, e.err_code)
def cluster_show(args):
    obj = Cluster(args.ip, args.port)
    try:
        res = obj.cluster_show(args.name, args.tenant, args.xml)

        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "cluster",
                                        e.err_text, e.err_code)
def vdc_show(args):
    try:
        res = VirtualDatacenter(args.ip, args.port).vdc_show(args.name,
                                                             args.xml)
        if(res):
            if(args.xml == True):
                return common.format_xml(res)
            else:
                return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "vdc", e.err_text,
                                        e.err_code)
def vnasserver_show(args):
    obj = VnasServer(args.ip, args.port)
    try:
        res = obj.vnasserver_show(args.name, args.xml)

        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "vnasserver",
                                        e.err_text, e.err_code)
def vnasserver_show(args):
    obj = VnasServer(args.ip, args.port)
    try:
        res = obj.vnasserver_show(args.name, args.xml)

        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "vnasserver",
                                        e.err_text, e.err_code)
Exemple #37
0
def bucket_show(args):
    obj = Bucket(args.ip, args.port)
    try:
        res = obj.bucket_show(args.tenant , args.project , args.name, args.xml)

        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "bucket",
                                        e.err_text, e.err_code)
def project_show(args):
    obj = Project(args.ip, args.port)
    try:
        if(not args.tenant):
            args.tenant=""
        res = obj.project_show(args.tenant + "/" + args.name, args.xml)
        if(res):
            if (args.xml == True):
                return common.format_xml(res)
            return common.format_json_object(res)
    except SOSError as e:
        raise e
Exemple #39
0
def project_resource_show(args):
    obj = Project(args.ip, args.port)
    try:
        if(not args.tenant):
            args.tenant = ""
        res = obj.project_resource_show(args.tenant + "/" + args.name, args.xml)
        if(res):
            if (args.xml == True):
                return common.format_xml(res)
            return common.format_json_object(res)
    except SOSError as e:
        raise e
def computesystem_show(args):
    try:
        obj = ComputeSystem(args.ip, args.port)
        res = obj.show_computesystem(args.name, args.xml)
        if(res):
            if(args.xml == True):
                return common.format_xml(res)
            else:
                return common.format_json_object(res)

    except SOSError as e:
        raise common.format_err_msg_and_raise("show", "computesystem",
                                              e.err_text, e.err_code)
def computesystem_show(args):
    try:
        obj = ComputeSystem(args.ip, args.port)
        res = obj.show_computesystem(args.name, args.xml)
        if (res):
            if (args.xml == True):
                return common.format_xml(res)
            else:
                return common.format_json_object(res)

    except SOSError as e:
        raise common.format_err_msg_and_raise("show", "computesystem",
                                              e.err_text, e.err_code)
def get_ipsec_status(args):
    try:
        res = IPsecManager(args.ip, args.port).get_ipsec_status(args.xml)
        if(not res or res == ''):
            print 'Failed to get the IPsec status. Reason : ' + res
        else:
            if(args.xml == True):
                return common.format_xml(res)
            else:
                return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("status", "IPsec",
                                        e.err_text, e.err_code)
def order_execution(args):
    orderObj = Order(args.ip, args.uiPort)
    try:
        orderExecutionList = orderObj.show_execution_by_uri(args.uri, args.xml)

        if args.xml:
            return common.format_xml(orderExecutionList)

        return common.format_json_object(orderExecutionList)
    except SOSError as e:
        common.format_err_msg_and_raise("execution", "order", e.err_text, e.err_code)

    return
def get_ipsec_status(args):
    try:
        res = IPsecManager(args.ip, args.port).get_ipsec_status(args.xml)
        if (not res or res == ''):
            print 'Failed to get the IPsec status. Reason : ' + res
        else:
            if (args.xml == True):
                return common.format_xml(res)
            else:
                return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("status", "IPsec", e.err_text,
                                        e.err_code)
Exemple #45
0
def order_execution(args):
    orderObj = Order(args.ip, args.uiPort)
    try:
        orderExecutionList = orderObj.show_execution_by_uri(args.uri, args.xml)

        if (args.xml):
            return common.format_xml(orderExecutionList)

        return common.format_json_object(orderExecutionList)
    except SOSError as e:
        common.format_err_msg_and_raise("execution", "order", e.err_text,
                                        e.err_code)

    return
def tenant_show(args):
    obj = Tenant(args.ip, args.port)
    try:
        res = obj.tenant_show(args.name, args.xml)

        if args.xml:
            return common.format_xml(str(res))

        return common.format_json_object(res)
    except SOSError as e:
        if e.err_code == SOSError.NOT_FOUND_ERR:
            raise SOSError(SOSError.NOT_FOUND_ERR, "Tenant show failed: " + e.err_text)
        else:
            raise e
def varray_show(args):
    obj = VirtualArray(args.ip, args.port)
    try:
        res = obj.varray_show(args.name, args.xml)
	if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        if(e.err_code == SOSError.NOT_FOUND_ERR):
            raise SOSError(SOSError.NOT_FOUND_ERR, 
                           "varray show failed: " + e.err_text)
        else:
            raise e
def show_sanfabrics(args):
    # fabric show command parser
    obj = SanFabrics(args.ip, args.port)
    try:
        res = obj.san_fabrics_zones_list(args.name, args.fabricid, args.xml)
        if (res):
            if (args.xml == True):
                return common.format_xml(res)
            else:
                return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "sanfabrics", e.err_text,
                                        e.err_code)
    return
Exemple #49
0
def storageprovider_show(args):
    obj = StorageProvider(args.ip, args.port)
    try:
        output = obj.show(args.name, args.xml)
        if(args.xml):
            return common.format_xml(output)
        else:
            return common.format_json_object(output)
    except SOSError as e:
        common.format_err_msg_and_raise(
            "show",
            "storageprovider",
            e.err_text,
            e.err_code)
def vcenter_show(args):
    obj = VCenter(args.ip, args.port)
    try:
        res = obj.vcenter_show(args.name, args.tenant, args.xml)

        if res is None:
            raise SOSError(SOSError.NOT_FOUND_ERR, "vcenter " + args.name + ": not found")

        if args.xml:
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "vcenter", e.err_text, e.err_code)
def initiator_show(args):

    try:
        initiatorObj = HostInitiator(args.ip, args.port)
        initiatorUri = initiatorObj.query_by_portwwn(args.initiatorportwwn, args.hostlabel)
        if initiatorUri:
            initiatorDetails = initiatorObj.show_by_uri(initiatorUri, args.xml)

        if args.xml:
            return common.format_xml(initiatorDetails)
        return common.format_json_object(initiatorDetails)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "initiator", e.err_text, e.err_code)

    return
def vcenter_show(args):
    obj = VCenter(args.ip, args.port)
    try:
        res = obj.vcenter_show(args.name, args.tenant, args.xml)

        if(res is None):
            raise SOSError(SOSError.NOT_FOUND_ERR,
                           "vcenter " + args.name + ": not found")

        if(args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "vcenter",
                                        e.err_text, e.err_code)
def initiator_show(args):

    try:
        initiatorObj = HostInitiator(args.ip, args.port)
        initiatorUri = initiatorObj.query_by_portwwn(args.initiatorportwwn,
                                                     args.hostlabel)
        if (initiatorUri):
            initiatorDetails = initiatorObj.show_by_uri(initiatorUri, args.xml)

        if (args.xml):
            return common.format_xml(initiatorDetails)
        return common.format_json_object(initiatorDetails)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "initiator", e.err_text,
                                        e.err_code)

    return
Exemple #54
0
def ipinterface_show(args):

    try:
        ipinterfaceList = []
        ipinterfaceObj = HostIPInterface(args.ip, args.port)
        interfaceUri = ipinterfaceObj.query_by_ipaddress(
            args.ipaddress, args.hostlabel)
        interfaceShow = ipinterfaceObj.show_by_uri(interfaceUri, args.xml)

        if (args.xml):
            return common.format_xml(interfaceShow)
        return common.format_json_object(interfaceShow)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "ip-interface", e.err_text,
                                        e.err_code)

    return
def catalog_execute(args):
    catalogObj = Catalog(args.ip, args.uiPort)
    try:

        if (args.params is not None and len(args.params) % 2 != 0):
            raise SOSError(SOSError.CMD_LINE_ERR,
                           "List of parameter name/value pairs is not even")

        orderDetails = catalogObj.execute(args.path, args.urn, args.params)

        if (args.xml):
            return common.format_xml(orderDetails)
        return common.format_json_object(orderDetails)
    except SOSError as e:
        common.format_err_msg_and_raise("execute", "catalog", e.err_text,
                                        e.err_code)
    return
Exemple #56
0
def storagepool_show(args):
    obj = StoragePool(args.ip, args.port)
    try:
        res = obj.storagepool_show(args.name, args.storagesystem,
                                   args.serialnumber, args.type, args.xml)

        if (args.xml):
            return common.format_xml(res)

        return common.format_json_object(res)
    except SOSError as e:
        if (e.err_code == SOSError.NOT_FOUND_ERR):
            raise SOSError(
                SOSError.NOT_FOUND_ERR,
                "Storagepool show failed: Storagepool " + args.name +
                " : Not Found\n" + e.err_text)
        else:
            raise e
Exemple #57
0
def approval_show(args):
    approvalObj = Approval(args.ip, args.uiPort)
    try:

        approvalDetails = approvalObj.show_by_uri(args.uri, args.xml)

        if (approvalDetails is None):
            raise SOSError(SOSError.NOT_FOUND_ERR,
                           "Could not find the matching approval")

        if (args.xml):
            return common.format_xml(approvalDetails)

        return common.format_json_object(approvalDetails)
    except SOSError as e:
        common.format_err_msg_and_raise("show", "approval", e.err_text,
                                        e.err_code)
    return
def quotadirectory_show(args):
    obj = QuotaDirectory(args.ip, args.port)
    try:
        resourceUri = obj.storageResource_query(args.filesystem, args.project,
                                                args.tenant)
        respContent = obj.quotadirectory_show(resourceUri, args.name, args.xml)

        if (args.xml):
            return common.format_xml(respContent)
        else:
            return common.format_json_object(respContent)

    except SOSError as e:
        if (e.err_code == SOSError.SOS_FAILURE_ERR):
            raise SOSError(SOSError.SOS_FAILURE_ERR,
                           "quotadirectory " + args.name + ": Not Found")
        else:
            common.format_err_msg_and_raise("show", "quotadirectory",
                                            e.err_text, e.err_code)