Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az cosmosdb database does not work with --key parameter #6770

Closed
fercho-ayala opened this issue Jul 11, 2018 · 7 comments
Closed

az cosmosdb database does not work with --key parameter #6770

fercho-ayala opened this issue Jul 11, 2018 · 7 comments
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Service Attention This issue is responsible by Azure service team.

Comments

@fercho-ayala
Copy link

Describe the bug
The az cosmosdb database commands does works using --key parameter.

az cosmosdb database exists --db-name mydb --key "XXXX" --name mycosmosdb

This just happens after upgrade to azure-cli (2.0.38) or the latest 2.0.41

To Reproduce

  1. Open command prompt
  2. Sign in with Azure CLI 2.0
    az login
  3. Run any az cosmosdb database command:
    az cosmosdb database exists --db-name mydb --key "XXXX" --name mycosmosdb
  4. An error is displayed:
    unsupported operand type(s) for +: 'NoneType' and 'str'
    Traceback (most recent call last):
    File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 197, in invoke
    cmd_result = self.invocation.execute(args)
    File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 334, in execute
    cmd.exception_handler(ex)
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/_exception_handler.py", line 96, in generic_exception_handler
    chained_handler(ex)
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/_exception_handler.py", line 76, in chained_handler
    raise ex
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/_exception_handler.py", line 71, in chained_handler
    h(ex)
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/_exception_handler.py", line 86, in network_exception_handler
    raise ex
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/_exception_handler.py", line 71, in chained_handler
    h(ex)
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/_exception_handler.py", line 59, in unknown_server_failure_exception_handler
    raise ex
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/_exception_handler.py", line 71, in chained_handler
    h(ex)
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/_exception_handler.py", line 51, in invalid_arg_found_exception_handler
    raise ex
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/_exception_handler.py", line 71, in chained_handler
    h(ex)
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/_exception_handler.py", line 29, in resource_not_found_exception_handler
    raise ex
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/_exception_handler.py", line 71, in chained_handler
    h(ex)
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/_exception_handler.py", line 21, in duplicate_resource_exception_handler
    raise ex
    File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 311, in execute
    result = cmd(params)
    File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 170, in call
    return super(AzCliCommand, self).call(*args, **kwargs)
    File "/opt/az/lib/python3.6/site-packages/knack/commands.py", line 109, in call
    return self.handler(*args, **kwargs)
    File "/opt/az/lib/python3.6/site-packages/azure/cli/core/init.py", line 421, in default_command_handler
    result = op(**command_args)
    File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/cosmosdb/custom.py", line 244, in cli_cosmosdb_database_list
    return list(client.ReadDatabases())
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/query_iterable.py", line 112, in next
    return next(self._ex_context)
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/execution_context/base_execution_context.py", line 105, in next
    return self.next()
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/execution_context/execution_dispatcher.py", line 64, in next
    return next(self._execution_context)
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/execution_context/base_execution_context.py", line 105, in next
    return self.next()
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/execution_context/base_execution_context.py", line 95, in next
    results = self.fetch_next_block()
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/execution_context/base_execution_context.py", line 73, in fetch_next_block
    return self._fetch_next_block()
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/execution_context/base_execution_context.py", line 158, in _fetch_next_block
    return self._fetch_items_helper_with_retries(self._fetch_function)
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/execution_context/base_execution_context.py", line 132, in _fetch_items_helper_with_retries
    return retry_utility._Execute(self._client, self._client._global_endpoint_manager, callback)
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/retry_utility.py", line 56, in _Execute
    result = _ExecuteFunction(function, *args, **kwargs)
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/retry_utility.py", line 92, in _ExecuteFunction
    return function(*args, **kwargs)
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/execution_context/base_execution_context.py", line 130, in callback
    return self._fetch_items_helper_no_retries(fetch_function)
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/execution_context/base_execution_context.py", line 120, in _fetch_items_helper_no_retries
    (fetched_items, response_headers) = fetch_function(self._options)
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/document_client.py", line 282, in fetch_fn
    options), self.last_response_headers
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/document_client.py", line 2685, in __QueryFeed
    url_connection = self._global_endpoint_manager.ReadEndpoint
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/global_endpoint_manager.py", line 48, in ReadEndpoint
    self.RefreshEndpointList()
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/global_endpoint_manager.py", line 67, in RefreshEndpointList
    database_account = self._GetDatabaseAccount()
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/global_endpoint_manager.py", line 85, in _GetDatabaseAccount
    database_account = self._GetDatabaseAccountStub(self.DefaultEndpoint)
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/global_endpoint_manager.py", line 105, in _GetDatabaseAccountStub
    return self.Client.GetDatabaseAccount(endpoint)
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/document_client.py", line 2309, in GetDatabaseAccount
    headers)
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/document_client.py", line 2546, in __Get
    headers)
    File "/opt/az/lib/python3.6/site-packages/pydocumentdb/synchronized_request.py", line 210, in SynchronizedRequest
    resource_url = base_url + request_options['path']
    TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Expected behavior
A boolean indicating whether the database exists.

Environment summary
azure-cli (2.0.41)

acr (2.0.28)
acs (2.1.3)
advisor (0.5.1)
ams (0.1.1)
appservice (0.1.36)
backup (1.1.2)
batch (3.2.4)
batchai (0.3.1)
billing (0.1.8)
cdn (0.0.14)
cloud (2.0.15)
cognitiveservices (0.1.13)
command-modules-nspkg (2.0.1)
configure (2.0.17)
consumption (0.3.1)
container (0.2.1)
core (2.0.41)
cosmosdb (0.1.21)
dla (0.1.0)
dls (0.0.22)
dms (0.0.1)
eventgrid (0.1.12)
eventhubs (0.1.3)
extension (0.1.0)
feedback (2.1.3)
find (0.2.11)
interactive (0.3.25)
iot (0.1.21)
keyvault (2.0.23)
lab (0.0.22)
maps (0.2.0)
monitor (0.1.8)
network (2.1.5)
nspkg (3.0.2)
policyinsights (0.1.0)
profile (2.0.27)
rdbms (0.2.5)
redis (0.2.14)
reservations (0.2.1)
resource (2.0.32)
role (2.0.26)
servicebus (0.1.2)
servicefabric (0.0.12)
sql (2.0.27)
storage (2.0.35)
vm (2.0.35)

Python location '/opt/az/bin/python3'
Extensions directory '/home/vagrant/.azure/cliextensions'

Python (Linux) 3.6.1 (default, Jul 2 2018, 18:43:15)
[GCC 4.8.4]

Legal docs and information: aka.ms/AzureCliLegal

Additional context
It works in azure-cli (2.0.27)

@tjprescott tjprescott added bug This issue requires a change to an existing behavior in the product in order to be resolved. CosmosDB az cosmosdb labels Jul 11, 2018
@lukeb1961
Copy link

same error for SHOW as well as EXISTS. Oh and LIST fails too...

@lukeb1961
Copy link

#6827

@madsd
Copy link
Contributor

madsd commented Sep 11, 2018

Still experiencing this problem - any news on the resolution?

@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
@cgkades
Copy link

cgkades commented Mar 15, 2019

I'm also having this issue.. any update?

@tjprescott
Copy link
Member

@christopheranderson for comment.

@shurd
Copy link
Contributor

shurd commented Jun 5, 2019

@fercho-ayala thank you for identifying this problem. I have reverted the change that introduced the problem as a part of #7929. It should be working as of CLI version 2.0.53

@tjprescott
Copy link
Member

tjprescott commented Jun 5, 2019

Closing since this has been fixed. Please reopen if that is not the case.

@haroldrandom haroldrandom added bug This issue requires a change to an existing behavior in the product in order to be resolved. CosmosDB Service Attention This issue is responsible by Azure service team. labels Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests