Skip to content

Commit

Permalink
Fix az aks get-credentials on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mboersma committed Nov 6, 2017
1 parent 6da4032 commit 21a1799
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/command_modules/azure-cli-acs/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Release History
* deprecate --orchestrator-release option in acs create
* change default VM size for AKS to Standard_D1_v2
* fix "az aks browse" on Windows
* fix "az aks get-credentials" on Windows

2.0.18
++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1289,13 +1289,17 @@ def aks_get_credentials(client, resource_group_name, name, admin=False,
pass

# merge the new kubeconfig into the existing one
with tempfile.NamedTemporaryFile(mode='w+t') as additional_file:
fd, temp_path = tempfile.mkstemp()
additional_file = os.fdopen(fd, 'w+t')
try:
additional_file.write(kubeconfig)
additional_file.flush()
try:
merge_kubernetes_configurations(path, additional_file.name)
except yaml.YAMLError as ex:
logger.warning('Failed to merge credentials to kube config file: %s', ex)
merge_kubernetes_configurations(path, temp_path)
except yaml.YAMLError as ex:
logger.warning('Failed to merge credentials to kube config file: %s', ex)
finally:
additional_file.close()
os.remove(temp_path)


def aks_list(client, resource_group_name=None):
Expand Down

0 comments on commit 21a1799

Please sign in to comment.