Skip to content

Commit e62546b

Browse files
author
Atharva
committed
Made Changes
1 parent f1d3177 commit e62546b

File tree

2 files changed

+11
-2
lines changed
  • src/workload-orchestration/azext_workload_orchestration/aaz/latest/workload_orchestration/context

2 files changed

+11
-2
lines changed

src/workload-orchestration/azext_workload_orchestration/aaz/latest/workload_orchestration/context/_show.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ def _build_arguments_schema(cls, *args, **kwargs):
6161

6262
def _execute_operations(self):
6363
self.pre_operations()
64+
print (f"Using context '{self.ctx.args.context_name}' in resource group '{self.ctx.args.resource_group}'")
65+
6466
self.ContextsGet(ctx=self.ctx)()
6567
self.post_operations()
6668

src/workload-orchestration/azext_workload_orchestration/aaz/latest/workload_orchestration/context/_use_context.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
6464

6565
def _execute_operations(self):
6666
self.pre_operations()
67+
print (f"Using context '{self.ctx.args.context_name}' in resource group '{self.ctx.args.resource_group}'")
6768
self.ContextsGet(ctx=self.ctx)()
6869
self.post_operations()
6970

@@ -77,8 +78,14 @@ def post_operations(self):
7778

7879
def _output(self, *args, **kwargs):
7980
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
80-
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
81-
CURRENT_CONTEXT_ID = result.get('id')
81+
current_context_id = result.get('id')
82+
if current_context_id:
83+
self.ctx.cli_ctx.config.set_value(
84+
'workload_orchestration', 'context_id', current_context_id)
85+
self.ctx.cli_ctx.config.set_value(
86+
'workload_orchestration', 'context_name', self.ctx.args.context_name.to_serialized_data())
87+
self.ctx.cli_ctx.config.set_value(
88+
'workload_orchestration', 'resource_group', self.ctx.args.resource_group.to_serialized_data())
8289
return f"Successfully set current context to '{self.ctx.args.context_name}'"
8390

8491
class ContextsGet(AAZHttpOperation):

0 commit comments

Comments
 (0)