Skip to content

Commit

Permalink
Merge branch 'k8s-extension/public' of github.com:AzureArcForKubernet…
Browse files Browse the repository at this point in the history
…es/azure-cli-extensions into k8s-extension/private
  • Loading branch information
jonathan-innis committed Oct 15, 2021
2 parents 30fa2ad + f721c84 commit 6cc9ce8
Show file tree
Hide file tree
Showing 507 changed files with 249,567 additions and 34,617 deletions.
30 changes: 30 additions & 0 deletions linter_exclusions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,28 @@ aks create:
assign_kubelet_identity:
rule_exclusions:
- option_length_too_long
aks addon enable:
parameters:
appgw_watch_namespace:
rule_exclusions:
- option_length_too_long
workspace_resource_id:
rule_exclusions:
- option_length_too_long
enable_msi_auth_for_monitoring:
rule_exclusions:
- option_length_too_long
aks addon update:
parameters:
appgw_watch_namespace:
rule_exclusions:
- option_length_too_long
workspace_resource_id:
rule_exclusions:
- option_length_too_long
enable_msi_auth_for_monitoring:
rule_exclusions:
- option_length_too_long
aks enable-addons:
parameters:
appgw_watch_namespace:
Expand Down Expand Up @@ -1229,6 +1251,14 @@ maintenance assignment create:
maintenance_configuration_id:
rule_exclusions:
- option_length_too_long
maintenance assignment create-or-update-parent:
parameters:
configuration_assignment_name:
rule_exclusions:
- option_length_too_long
maintenance_configuration_id:
rule_exclusions:
- option_length_too_long
maintenance assignment delete:
parameters:
configuration_assignment_name:
Expand Down
7 changes: 7 additions & 0 deletions src/aem/azext_aem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ def load_arguments(self, _):
help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=<name>`",
completer=get_resource_name_completion_list('Microsoft.Compute/virtualMachines'), id_part='name')

proxy_arg_type = CLIArgumentType(options_list=['--proxy-uri', '-p'])
proxy_uri = CLIArgumentType(overrides=proxy_arg_type,
help="Set the proxy URI that should be used to access external resources e.g. the Azure API. Example: http://proxyhost:8080")

with self.argument_context('vm aem') as c:
c.argument('vm_name', existing_vm_name)
c.argument('proxy_uri', proxy_uri)
c.argument('skip_storage_check', action='store_true',
help='Disables the test for table content')
c.argument('skip_storage_analytics', action='store_true',
Expand All @@ -50,6 +55,8 @@ def load_arguments(self, _):
help='Set the access of the VM identity to the individual resources, e.g. data disks instead of the complete resource group.')
c.argument('wait_time_in_minutes', type=int,
help='Maximum minutes to wait for the storage metrics to be available')
c.argument('debug_extension', action='store_true',
help='Enable debug mode on the VM Extension for SAP.')


COMMAND_LOADER_CLS = AEMCommandsLoader
27 changes: 23 additions & 4 deletions src/aem/azext_aem/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@


def set_aem(cmd, resource_group_name, vm_name, skip_storage_analytics=False,
install_new_extension=False, set_access_to_individual_resources=False):
install_new_extension=False, set_access_to_individual_resources=False,
proxy_uri=None, debug_extension=False):
aem = EnhancedMonitoring(cmd, resource_group_name, vm_name,
vm_client=get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_COMPUTE),
storage_client=get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_STORAGE),
roles_client=get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_AUTHORIZATION),
skip_storage_analytics=skip_storage_analytics,
install_new_extension=install_new_extension,
set_access_to_individual_resources=set_access_to_individual_resources)
set_access_to_individual_resources=set_access_to_individual_resources,
proxy_uri=proxy_uri,
debug_extension=debug_extension)
return aem.enable()


Expand All @@ -84,7 +87,9 @@ def __init__(self, cmd, resource_group, vm_name, vm_client,
storage_client, roles_client=None, skip_storage_analytics=None,
install_new_extension=None,
set_access_to_individual_resources=None,
no_wait=False):
no_wait=False,
proxy_uri=None,
debug_extension=False):
self._vm_client = vm_client
self._storage_client = storage_client
self._roles_client = roles_client
Expand All @@ -106,6 +111,8 @@ def __init__(self, cmd, resource_group, vm_name, vm_client,
self._install_new_extension = install_new_extension
self._set_access_to_individual_resources = set_access_to_individual_resources
self._no_wait = no_wait
self._proxy_uri = proxy_uri
self._debug_extension = debug_extension

def enable(self):
# * no extension + new extension switch => install new extension
Expand Down Expand Up @@ -173,6 +180,17 @@ def _enable_new(self):

self._create_role_assignments_for_scopes(scopes)

pub_cfg = {}
if self._proxy_uri is not None:
pub_cfg.update({
'proxy': self._proxy_uri
})

if self._debug_extension is True:
pub_cfg.update({
'debug': '1'
})

VirtualMachineExtension = self._cmd.get_models('VirtualMachineExtension',
resource_type=ResourceType.MGMT_COMPUTE,
operation_group='virtual_machine_extensions')
Expand All @@ -183,7 +201,8 @@ def _enable_new(self):
type_properties_type=self._extension['name'],
type_handler_version=self._extension['version'],
settings={
'system': 'SAP'
'system': 'SAP',
'cfg': [{'key': k, 'value': pub_cfg[k]} for k in pub_cfg]
},
auto_upgrade_minor_version=True)

Expand Down
Loading

0 comments on commit 6cc9ce8

Please sign in to comment.