Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
fix-commands-py-bug (#752)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaozha authored Feb 22, 2021
1 parent b13482e commit 40dbd79
Show file tree
Hide file tree
Showing 17 changed files with 620 additions and 195 deletions.
2 changes: 1 addition & 1 deletion src/templates/generated/commands.py.njx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def load_command_table(self, _):
{{commandGroup.customCommandTypeName}} = CliCommandType(
operations_tmpl='{{commandGroup.operationTmplName}}',
client_factory={{commandGroup.clientFactoryName}})
with self.command_group('{{commandGroup.name}}', {{commandGroup.customCommandTypeName}}
with self.command_group('{{commandGroup.name}}', {{commandGroup.customCommandTypeName}}, client_factory={{commandGroup.clientFactoryName}}
{%- for key, value in commandGroup.propertiesString %}
{% if key != 'mode' %}
, {{key}}={{value}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def load_command_table(self, _):
),
client_factory=cf_operation,
)
with self.command_group('attestation', attestation_operation, is_experimental=True) as g:
with self.command_group(
'attestation', attestation_operation, client_factory=cf_operation, is_experimental=True
) as g:
g.custom_command('create-provider', 'attestation_create_provider')
g.custom_command('list-operation', 'attestation_list_operation')

Expand All @@ -34,7 +36,9 @@ def load_command_table(self, _):
operations_tmpl='azext_attestation.vendored_sdks.attestation.operations._attestation_providers_operations#AttestationProvidersOperations.{}',
client_factory=cf_attestation_provider,
)
with self.command_group('attestation attestation-provider', attestation_attestation_provider) as g:
with self.command_group(
'attestation attestation-provider', attestation_attestation_provider, client_factory=cf_attestation_provider
) as g:
g.custom_command('provider list', 'attestation_attestation_provider_provider_list')
g.custom_show_command('show', 'attestation_attestation_provider_show')
g.custom_command('update', 'attestation_attestation_provider_update')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def load_command_table(self, _):
operations_tmpl='azext_boolean.vendored_sdks.boolean.operations._bool_operations#BoolOperations.{}',
client_factory=cf_bool,
)
with self.command_group('test-server bool', bool_bool, is_experimental=True) as g:
with self.command_group('test-server bool', bool_bool, client_factory=cf_bool, is_experimental=True) as g:
g.custom_command('put-false', 'test_server_bool_put_false')
g.custom_command('put-true', 'test_server_bool_put_true')
g.custom_command('show-false', 'test_server_bool_show_false')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ def load_command_table(self, _):
operations_tmpl='azure.mgmt.compute.operations._virtual_machines_operations#VirtualMachinesOperations.{}',
client_factory=cf_virtual_machine,
)
with self.command_group('vm virtual-machine', vm_virtual_machine, is_experimental=True) as g:
with self.command_group(
'vm virtual-machine', vm_virtual_machine, client_factory=cf_virtual_machine, is_experimental=True
) as g:
g.custom_command('assess-patch', 'vm_virtual_machine_assess_patch', minApi='2020-06-01')
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def load_command_table(self, _):
operations_tmpl='azext_datafactory_preview.vendored_sdks.azure_mgmt_datafactory.operations._factories_operations#FactoriesOperations.{}',
client_factory=cf_factory,
)
with self.command_group('datafactory', datafactory_factory, is_experimental=True) as g:
with self.command_group('datafactory', datafactory_factory, client_factory=cf_factory, is_experimental=True) as g:
g.custom_command('list', 'datafactory_list')
g.custom_show_command('show', 'datafactory_show')
g.custom_command('create', 'datafactory_create')
Expand All @@ -38,7 +38,7 @@ def load_command_table(self, _):
operations_tmpl='azext_datafactory_preview.vendored_sdks.azure_mgmt_datafactory.operations._triggers_operations#TriggersOperations.{}',
client_factory=cf_trigger,
)
with self.command_group('datafactory trigger', datafactory_trigger) as g:
with self.command_group('datafactory trigger', datafactory_trigger, client_factory=cf_trigger) as g:
g.custom_command('list', 'datafactory_trigger_list')
g.custom_show_command('show', 'datafactory_trigger_show')
g.custom_command('create', 'datafactory_trigger_create')
Expand All @@ -58,7 +58,9 @@ def load_command_table(self, _):
operations_tmpl='azext_datafactory_preview.vendored_sdks.azure_mgmt_datafactory.operations._integration_runtimes_operations#IntegrationRuntimesOperations.{}',
client_factory=cf_integration_runtime,
)
with self.command_group('datafactory integration-runtime', datafactory_integration_runtime) as g:
with self.command_group(
'datafactory integration-runtime', datafactory_integration_runtime, client_factory=cf_integration_runtime
) as g:
g.custom_command('list', 'datafactory_integration_runtime_list')
g.custom_show_command('show', 'datafactory_integration_runtime_show')
g.custom_command(
Expand Down Expand Up @@ -86,7 +88,9 @@ def load_command_table(self, _):
operations_tmpl='azext_datafactory_preview.vendored_sdks.azure_mgmt_datafactory.operations._domain_services_operations#DomainServicesOperations.{}',
client_factory=cf_domain_service,
)
with self.command_group('datafactory domain-service', datafactory_domain_service) as g:
with self.command_group(
'datafactory domain-service', datafactory_domain_service, client_factory=cf_domain_service
) as g:
g.custom_command('create', 'datafactory_domain_service_create')
g.custom_command('update', 'datafactory_domain_service_update')

Expand All @@ -96,5 +100,5 @@ def load_command_table(self, _):
operations_tmpl='azext_datafactory_preview.vendored_sdks.azure_mgmt_datafactory.operations._groups_operations#GroupsOperations.{}',
client_factory=cf_group,
)
with self.command_group('datafactory group', datafactory_group) as g:
with self.command_group('datafactory group', datafactory_group, client_factory=cf_group) as g:
g.custom_command('create', 'datafactory_group_create')
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def load_command_table(self, _):
operations_tmpl='azure.mgmt.kusto.operations._clusters_operations#ClustersOperations.{}',
client_factory=cf_cluster,
)
with self.command_group('kusto cluster', kusto_cluster) as g:
with self.command_group('kusto cluster', kusto_cluster, client_factory=cf_cluster) as g:
g.custom_command('list', 'kusto_cluster_list')
g.custom_show_command('show', 'kusto_cluster_show')
g.custom_command('create', 'kusto_cluster_create', supports_no_wait=True)
Expand All @@ -45,7 +45,11 @@ def load_command_table(self, _):
operations_tmpl='azure.mgmt.kusto.operations._cluster_principal_assignments_operations#ClusterPrincipalAssignmentsOperations.{}',
client_factory=cf_cluster_principal_assignment,
)
with self.command_group('kusto cluster-principal-assignment', kusto_cluster_principal_assignment) as g:
with self.command_group(
'kusto cluster-principal-assignment',
kusto_cluster_principal_assignment,
client_factory=cf_cluster_principal_assignment,
) as g:
g.custom_command('list', 'kusto_cluster_principal_assignment_list')
g.custom_show_command('show', 'kusto_cluster_principal_assignment_show')
g.custom_command('create', 'kusto_cluster_principal_assignment_create', supports_no_wait=True)
Expand All @@ -63,7 +67,7 @@ def load_command_table(self, _):
operations_tmpl='azure.mgmt.kusto.operations._databases_operations#DatabasesOperations.{}',
client_factory=cf_database,
)
with self.command_group('kusto database', kusto_database) as g:
with self.command_group('kusto database', kusto_database, client_factory=cf_database) as g:
g.custom_command('list', 'kusto_database_list')
g.custom_show_command('show', 'kusto_database_show')
g.custom_command('create', 'kusto_database_create', supports_no_wait=True)
Expand All @@ -80,7 +84,11 @@ def load_command_table(self, _):
operations_tmpl='azure.mgmt.kusto.operations._database_principal_assignments_operations#DatabasePrincipalAssignmentsOperations.{}',
client_factory=cf_database_principal_assignment,
)
with self.command_group('kusto database-principal-assignment', kusto_database_principal_assignment) as g:
with self.command_group(
'kusto database-principal-assignment',
kusto_database_principal_assignment,
client_factory=cf_database_principal_assignment,
) as g:
g.custom_command('list', 'kusto_database_principal_assignment_list')
g.custom_show_command('show', 'kusto_database_principal_assignment_show')
g.custom_command('create', 'kusto_database_principal_assignment_create', supports_no_wait=True)
Expand All @@ -98,7 +106,11 @@ def load_command_table(self, _):
operations_tmpl='azure.mgmt.kusto.operations._attached_database_configurations_operations#AttachedDatabaseConfigurationsOperations.{}',
client_factory=cf_attached_database_configuration,
)
with self.command_group('kusto attached-database-configuration', kusto_attached_database_configuration) as g:
with self.command_group(
'kusto attached-database-configuration',
kusto_attached_database_configuration,
client_factory=cf_attached_database_configuration,
) as g:
g.custom_command('list', 'kusto_attached_database_configuration_list')
g.custom_show_command('show', 'kusto_attached_database_configuration_show')
g.custom_command('create', 'kusto_attached_database_configuration_create', supports_no_wait=True)
Expand All @@ -116,7 +128,7 @@ def load_command_table(self, _):
operations_tmpl='azure.mgmt.kusto.operations._data_connections_operations#DataConnectionsOperations.{}',
client_factory=cf_data_connection,
)
with self.command_group('kusto data-connection', kusto_data_connection) as g:
with self.command_group('kusto data-connection', kusto_data_connection, client_factory=cf_data_connection) as g:
g.custom_command('list', 'kusto_data_connection_list')
g.custom_show_command('show', 'kusto_data_connection_show')
g.custom_command('create', 'kusto_data_connection_create', supports_no_wait=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def load_command_table(self, _):
operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._clusters_operations#ClustersOperations.{}',
client_factory=cf_cluster,
)
with self.command_group('kusto cluster', kusto_cluster, is_experimental=True) as g:
with self.command_group('kusto cluster', kusto_cluster, client_factory=cf_cluster, is_experimental=True) as g:
g.custom_command('list', 'kusto_cluster_list')
g.custom_show_command('show', 'kusto_cluster_show')
g.custom_command('create', 'kusto_cluster_create', supports_no_wait=True)
Expand All @@ -47,7 +47,11 @@ def load_command_table(self, _):
operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._cluster_principal_assignments_operations#ClusterPrincipalAssignmentsOperations.{}',
client_factory=cf_cluster_principal_assignment,
)
with self.command_group('kusto cluster-principal-assignment', kusto_cluster_principal_assignment) as g:
with self.command_group(
'kusto cluster-principal-assignment',
kusto_cluster_principal_assignment,
client_factory=cf_cluster_principal_assignment,
) as g:
g.custom_command('list', 'kusto_cluster_principal_assignment_list')
g.custom_show_command('show', 'kusto_cluster_principal_assignment_show')
g.custom_command('create', 'kusto_cluster_principal_assignment_create', supports_no_wait=True)
Expand All @@ -68,7 +72,7 @@ def load_command_table(self, _):
operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._databases_operations#DatabasesOperations.{}',
client_factory=cf_database,
)
with self.command_group('kusto database', kusto_database) as g:
with self.command_group('kusto database', kusto_database, client_factory=cf_database) as g:
g.custom_command('list', 'kusto_database_list')
g.custom_show_command('show', 'kusto_database_show')
g.custom_command('create', 'kusto_database_create', supports_no_wait=True)
Expand All @@ -85,7 +89,11 @@ def load_command_table(self, _):
operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._database_principal_assignments_operations#DatabasePrincipalAssignmentsOperations.{}',
client_factory=cf_database_principal_assignment,
)
with self.command_group('kusto database-principal-assignment', kusto_database_principal_assignment) as g:
with self.command_group(
'kusto database-principal-assignment',
kusto_database_principal_assignment,
client_factory=cf_database_principal_assignment,
) as g:
g.custom_command('list', 'kusto_database_principal_assignment_list')
g.custom_show_command('show', 'kusto_database_principal_assignment_show')
g.custom_command('create', 'kusto_database_principal_assignment_create', supports_no_wait=True)
Expand All @@ -106,7 +114,11 @@ def load_command_table(self, _):
operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._attached_database_configurations_operations#AttachedDatabaseConfigurationsOperations.{}',
client_factory=cf_attached_database_configuration,
)
with self.command_group('kusto attached-database-configuration', kusto_attached_database_configuration) as g:
with self.command_group(
'kusto attached-database-configuration',
kusto_attached_database_configuration,
client_factory=cf_attached_database_configuration,
) as g:
g.custom_command('list', 'kusto_attached_database_configuration_list')
g.custom_show_command('show', 'kusto_attached_database_configuration_show')
g.custom_command('create', 'kusto_attached_database_configuration_create', supports_no_wait=True)
Expand All @@ -129,7 +141,7 @@ def load_command_table(self, _):
),
client_factory=cf_data_connection,
)
with self.command_group('kusto data-connection', kusto_data_connection) as g:
with self.command_group('kusto data-connection', kusto_data_connection, client_factory=cf_data_connection) as g:
g.custom_command('list', 'kusto_data_connection_list')
g.custom_show_command('show', 'kusto_data_connection_show')
g.custom_command('event-grid create', 'kusto_data_connection_event_grid_create', supports_no_wait=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def load_command_table(self, _):
operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._cluster_operations#ClusterOperations.{}',
client_factory=cf_cluster,
)
with self.command_group('kusto cluster', kusto_cluster, is_experimental=True) as g:
with self.command_group('kusto cluster', kusto_cluster, client_factory=cf_cluster, is_experimental=True) as g:
g.custom_command('list', 'kusto_cluster_list')
g.custom_show_command('show', 'kusto_cluster_show')
g.custom_command('create', 'kusto_cluster_create', supports_no_wait=True)
Expand All @@ -47,7 +47,11 @@ def load_command_table(self, _):
operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._cluster_principal_assignment_operations#ClusterPrincipalAssignmentOperations.{}',
client_factory=cf_cluster_principal_assignment,
)
with self.command_group('kusto cluster-principal-assignment', kusto_cluster_principal_assignment) as g:
with self.command_group(
'kusto cluster-principal-assignment',
kusto_cluster_principal_assignment,
client_factory=cf_cluster_principal_assignment,
) as g:
g.custom_command('list', 'kusto_cluster_principal_assignment_list')
g.custom_show_command('show', 'kusto_cluster_principal_assignment_show')
g.custom_command('create', 'kusto_cluster_principal_assignment_create', supports_no_wait=True)
Expand All @@ -63,7 +67,7 @@ def load_command_table(self, _):
operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._database_operations#DatabaseOperations.{}',
client_factory=cf_database,
)
with self.command_group('kusto database', kusto_database) as g:
with self.command_group('kusto database', kusto_database, client_factory=cf_database) as g:
g.custom_command('list', 'kusto_database_list')
g.custom_show_command('show', 'kusto_database_show')
g.custom_command('create', 'kusto_database_create', supports_no_wait=True)
Expand All @@ -80,7 +84,11 @@ def load_command_table(self, _):
operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._database_principal_assignment_operations#DatabasePrincipalAssignmentOperations.{}',
client_factory=cf_database_principal_assignment,
)
with self.command_group('kusto database-principal-assignment', kusto_database_principal_assignment) as g:
with self.command_group(
'kusto database-principal-assignment',
kusto_database_principal_assignment,
client_factory=cf_database_principal_assignment,
) as g:
g.custom_command('list', 'kusto_database_principal_assignment_list')
g.custom_show_command('show', 'kusto_database_principal_assignment_show')
g.custom_command('create', 'kusto_database_principal_assignment_create', supports_no_wait=True)
Expand All @@ -96,7 +104,11 @@ def load_command_table(self, _):
operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._attached_database_configuration_operations#AttachedDatabaseConfigurationOperations.{}',
client_factory=cf_attached_database_configuration,
)
with self.command_group('kusto attached-database-configuration', kusto_attached_database_configuration) as g:
with self.command_group(
'kusto attached-database-configuration',
kusto_attached_database_configuration,
client_factory=cf_attached_database_configuration,
) as g:
g.custom_command('list', 'kusto_attached_database_configuration_list')
g.custom_show_command('show', 'kusto_attached_database_configuration_show')
g.custom_command('create', 'kusto_attached_database_configuration_create', supports_no_wait=True)
Expand All @@ -114,7 +126,7 @@ def load_command_table(self, _):
),
client_factory=cf_data_connection,
)
with self.command_group('kusto data-connection', kusto_data_connection) as g:
with self.command_group('kusto data-connection', kusto_data_connection, client_factory=cf_data_connection) as g:
g.custom_command('list', 'kusto_data_connection_list')
g.custom_show_command('show', 'kusto_data_connection_show')
g.custom_command('event-grid create', 'kusto_data_connection_event_grid_create', supports_no_wait=True)
Expand Down
Loading

0 comments on commit 40dbd79

Please sign in to comment.