question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when az get-credentials - 'str' object has no attribute 'get'

See original GitHub issue

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az aks get-credentials

Errors:

The command failed with an unexpected error. Here is the traceback:
'str' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.35.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.35.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 658, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.35.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/Cellar/azure-cli/2.35.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
    result = cmd_copy(params)
  File "/usr/local/Cellar/azure-cli/2.35.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.35.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/usr/local/Cellar/azure-cli/2.35.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/acs/custom.py", line 2225, in aks_get_credentials
    _print_or_merge_credentials(
  File "/usr/local/Cellar/azure-cli/2.35.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/acs/custom.py", line 3764, in _print_or_merge_credentials
    merge_kubernetes_configurations(
  File "/usr/local/Cellar/azure-cli/2.35.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/acs/custom.py", line 1201, in merge_kubernetes_configurations
    _handle_merge(existing, addition, 'clusters', replace)
  File "/usr/local/Cellar/azure-cli/2.35.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/acs/custom.py", line 1136, in _handle_merge
    if not existing.get(key):
AttributeError: 'str' object has no attribute 'get'

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here…
  • az aks get-credentials --resource-group {} --name {}

Expected Behavior

Environment Summary

macOS-12.3.1-x86_64-i386-64bit, Darwin 21.4.0
Python 3.10.2
Installer: HOMEBREW

azure-cli 2.35.0

Additional Context

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
FumingZhangcommented, May 11, 2022

Hi @ilozano2, the reason for the error is that the existing kubeconfig file (default path is ~/.kube/config) is not a valid config file.

Workarounds:

  • Option 1 If necessary, back up the existing file, then delete the file and execute the command again.

  • Option 2 Specify some other path to store the kubeconfig file like az aks get-credentials -g {resource_group_name} -n {cluster_name} -f {custom_local_path_to_store_the_config}.

0reactions
msftbot[bot]commented, May 18, 2022

Hi, we’re sending this friendly reminder because we haven’t heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don’t hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure ResourceGraph Python AttributeError: 'str' object has no ...
I am trying to use python lib azure.mgmt.resourcegraph to receive list all cosmosdb accounts in my tenant. Here is code: from azure.mgmt.
Read more >
az aks | Microsoft Learn
Create a kubernetes cluster with standard SKU load balancer and two AKS created IPs for the load balancer outbound connection usage. Azure CLI...
Read more >
azure-storage-file-datalake - PyPI
You need an existing storage account, its URL, and a credential to instantiate the client object. Get credentials. To authenticate the client you...
Read more >
class Redshift. Client - Boto3 Docs 1.26.32 documentation
Exchanges a DC1 Reserved Node for a DC2 Reserved Node with no changes to the configuration (term, payment type, or number of nodes)...
Read more >
Azure Service Bus client library for Python - NET
Get credentials : Use the Azure CLI snippet below to populate an environment variable with the service bus connection string (you can also...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found