Skip to content

Unable to get generic resources from SQL endpoints #553

Closed

Description

When trying to show a resource:

resource_client.resources.get(
            resource_group_name=<group_name>
            resource_name=<name>,
            resource_provider_namespace=<namespace>,
            resource_type=<type>,
            api_version=<api_version>,
            parent_resource_path=<path> or ''
        )

I get an msrest DeserializationError:

msrest.exceptions.DeserializationError: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'

In the SDK resource_operations.py at line 461 when it tries to deserialize the response is when I'm getting the exception.

The traceback:

File "C:\Users\t\AppData\Local\Programs\Python\Python35-32\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\t\AppData\Local\Programs\Python\Python35-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\t\Documents\github\azure-cli\src\azure\cli\__main__.py", line 14, in <module>
    sys.exit(azure.cli.main.main(sys.argv[1:]))
  File "C:\Users\t\Documents\github\azure-cli\src\azure\cli\main.py", line 44, in main
    cmd_result = parser.execute(args)
  File "C:\Users\t\Documents\github\azure-cli\src\azure\cli\_argparse.py", line 264, in execute
    return ArgumentParserResult(event_data['handler'](parsed, others), output_format)
  File "C:\Users\t\Documents\github\azure-cli\src\azure\cli\commands\resource.py", line 62, in show_resource
    parent_resource_path=args.get('parent', '')
  File "C:\Users\t\Documents\github\azure-cli\env\lib\site-packages\azure\mgmt\resource\resources\operations\resources_operations.py", line 462, in get
    deserialized = self._deserialize('GenericResource', response)
  File "C:\Users\t\Documents\github\azure-cli\env\lib\site-packages\msrest\serialization.py", line 627, in __call__
    raise_with_traceback(DeserializationError, msg, err)
  File "C:\Users\t\Documents\github\azure-cli\env\lib\site-packages\msrest\exceptions.py", line 47, in raise_with_traceback
    raise error.with_traceback(exc_traceback)
  File "C:\Users\trpresco\Documents\github\azure-cli\env\lib\site-packages\msrest\serialization.py", line 622, in __call__
    raw_value = working_data.get(key)
msrest.exceptions.DeserializationError: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'

And the response.content that won't deserialize:
b'<?xml version="1.0" encoding="utf-8"?><entry xml:base="https://testserver23456.database.windows.net/v2/ManagementService.Trusted.svc/modules/ServerManagement/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><id>https://testserver23456.database.windows.net/v2/ManagementService.Trusted.svc/modules/ServerManagement/databases/testsql23456</id><category term="Microsoft.SqlServer.Management.Service.Domain.ArmResourceProvider.Database" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Database" href="databases/testsql23456" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/dataWarehouseQueries" type="application/atom+xml;type=feed" title="dataWarehouseQueries" href="databases/testsql23456/dataWarehouseQueries" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/usages" type="application/atom+xml;type=feed" title="usages" href="databases/testsql23456/usages" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/operationresults" type="application/atom+xml;type=feed" title="operationresults" href="databases/testsql23456/operationresults" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/azureAsyncOperation" type="application/atom+xml;type=feed" title="azureAsyncOperation" href="databases/testsql23456/azureAsyncOperation" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/importExportOperationResults" type="application/atom+xml;type=feed" title="importExportOperationResults" href="databases/testsql23456/importExportOperationResults" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/replicationLinks" type="application/atom+xml;type=feed" title="replicationLinks" href="databases/testsql23456/replicationLinks" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/extensions" type="application/atom+xml;type=feed" title="extensions" href="databases/testsql23456/extensions" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/auditingPolicies" type="application/atom+xml;type=feed" title="auditingPolicies" href="databases/testsql23456/auditingPolicies" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/connectionPolicies" type="application/atom+xml;type=feed" title="connectionPolicies" href="databases/testsql23456/connectionPolicies" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/securityMetrics" type="application/atom+xml;type=feed" title="securityMetrics" href="databases/testsql23456/securityMetrics" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/auditingEvents" type="application/atom+xml;type=feed" title="auditingEvents" href="databases/testsql23456/auditingEvents" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/backupArchivalPolicies" type="application/atom+xml;type=feed" title="backupArchivalPolicies" href="databases/testsql23456/backupArchivalPolicies" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/queryStore" type="application/atom+xml;type=feed" title="queryStore" href="databases/testsql23456/queryStore" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/topQueries" type="application/atom+xml;type=feed" title="topQueries" href="databases/testsql23456/topQueries" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/dataMaskingPolicies" type="application/atom+xml;type=feed" title="dataMaskingPolicies" href="databases/testsql23456/dataMaskingPolicies" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/serviceTierAdvisors" type="application/atom+xml;type=feed" title="serviceTierAdvisors" href="databases/testsql23456/serviceTierAdvisors" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/upgradeHint" type="application/atom+xml;type=entry" title="upgradeHint" href="databases/testsql23456/upgradeHint" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/schemas" type="application/atom+xml;type=feed" title="schemas" href="databases/testsql23456/schemas" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/transparentDataEncryption" type="application/atom+xml;type=feed" title="transparentDataEncryption" href="databases/testsql23456/transparentDataEncryption" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/restorePoints" type="application/atom+xml;type=feed" title="restorePoints" href="databases/testsql23456/restorePoints" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/metrics" type="application/atom+xml;type=feed" title="metrics" href="databases/testsql23456/metrics" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/metricDefinitions" type="application/atom+xml;type=feed" title="metricDefinitions" href="databases/testsql23456/metricDefinitions" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/securityAlertPolicies" type="application/atom+xml;type=feed" title="securityAlertPolicies" href="databases/testsql23456/securityAlertPolicies" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/advisors" type="application/atom+xml;type=feed" title="advisors" href="databases/testsql23456/advisors" /><title /><updated>2016-03-21T17:50:48Z</updated><author><name /></author><m:action metadata="https://testserver23456.database.windows.net/v2/ManagementService.Trusted.svc/modules/ServerManagement/$metadata#ArmResourceProviderModel.pause" title="pause" target="https://testserver23456.database.windows.net/v2/ManagementService.Trusted.svc/modules/ServerManagement/databases/testsql23456/pause" /><m:action metadata="https://testserver23456.database.windows.net/v2/ManagementService.Trusted.svc/modules/ServerManagement/$metadata#ArmResourceProviderModel.resume" title="resume" target="https://testserver23456.database.windows.net/v2/ManagementService.Trusted.svc/modules/ServerManagement/databases/testsql23456/resume" /><m:action metadata="https://testserver23456.database.windows.net/v2/ManagementService.Trusted.svc/modules/ServerManagement/$metadata#ArmResourceProviderModel.export" title="export" target="https://testserver23456.database.windows.net/v2/ManagementService.Trusted.svc/modules/ServerManagement/databases/testsql23456/export" /><content type="application/xml"><m:properties><d:id>/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/TravisTestResourceGroup/providers/Microsoft.Sql/servers/testserver23456/databases/testsql23456</d:id><d:name>testsql23456</d:name><d:type>Microsoft.Sql/servers/databases</d:type><d:location>West US</d:location><d:kind>v12.0,user</d:kind><d:properties m:type="Microsoft.SqlServer.Management.Service.Domain.ArmResourceProvider.Database_DatabaseProperties"><d:databaseId m:type="Edm.Guid">926e001e-945f-4a39-859c-bc80bb259109</d:databaseId><d:edition>Basic</d:edition><d:status>Online</d:status><d:serviceLevelObjective>Basic</d:serviceLevelObjective><d:collation>SQL_Latin1_General_CP1_CI_AS</d:collation><d:maxSizeBytes m:type="Edm.Int64">2147483648</d:maxSizeBytes><d:creationDate m:type="Edm.DateTime">2016-03-15T22:11:13.617Z</d:creationDate><d:currentServiceObjectiveId m:type="Edm.Guid">dd6d99bb-f193-4ec1-86f2-43d3bccbc49c</d:currentServiceObjectiveId><d:requestedServiceObjectiveId m:type="Edm.Guid">dd6d99bb-f193-4ec1-86f2-43d3bccbc49c</d:requestedServiceObjectiveId><d:requestedServiceObjectiveName m:null="true" /><d:createMode m:null="true" /><d:sourceDatabaseId m:null="true" /><d:defaultSecondaryLocation>East US</d:defaultSecondaryLocation><d:earliestRestoreDate m:type="Edm.DateTime">2016-03-15T22:22:00.953Z</d:earliestRestoreDate><d:restorePointInTime m:type="Edm.DateTime" m:null="true" /><d:sourceDatabaseDeletionDate m:type="Edm.DateTime" m:null="true" /><d:blobUriAndSasKey m:null="true" /><d:archivedBackupResourceId m:null="true" /><d:elasticPoolName m:null="true" /><d:containmentState m:type="Edm.Int32">2</d:containmentState></d:properties></m:properties></content></entry>'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions