-
Notifications
You must be signed in to change notification settings - Fork 1.5k
{AKS} az aks bastion: Fix --subscription not being passed to internal az network bastion tunnel and bastion discovery commands
#9671
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5242,10 +5242,11 @@ def aks_bastion(cmd, client, resource_group_name, name, bastion=None, port=None, | |
| kubeconfig_path = os.path.join(temp_dir, ".kube", "config") | ||
|
|
||
| try: | ||
| subscription_id = get_subscription_id(cmd.cli_ctx) | ||
| mc = client.get(resource_group_name, name) | ||
| mc_id = mc.id | ||
| nrg = mc.node_resource_group | ||
| bastion_resource = aks_bastion_parse_bastion_resource(bastion, [nrg]) | ||
| bastion_resource = aks_bastion_parse_bastion_resource(bastion, [nrg], subscription_id) | ||
| port = aks_bastion_get_local_port(port) | ||
|
|
||
|
Comment on lines
+5245
to
5251
|
||
| # Fetch credentials only if kubeconfig not provided | ||
|
|
@@ -5277,6 +5278,7 @@ def aks_bastion(cmd, client, resource_group_name, name, bastion=None, port=None, | |
| port, | ||
| mc_id, | ||
| kubeconfig_path, | ||
| subscription_id=subscription_id, | ||
| test_hook=os.getenv("AKS_BASTION_TEST_HOOK"), | ||
| ) | ||
| ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run_az_cmdis being called without_file=TextIO()butTextIOhere comes fromtyping(a type annotation), not a writable file-like object. This will fail at runtime (or at least won’t behave as intended) when suppressing output. Use a real in-memory buffer (e.g.,io.StringIO) or omitout_fileand rely onrun_az_cmd’s returnedresultinstead.