Skip to content

Commit

Permalink
Generate maintenance extension using 2021-09-01-preview version. (#3913)
Browse files Browse the repository at this point in the history
Co-authored-by: Kalpesh Chavan <kachavan@microsoft.com>
  • Loading branch information
KalpeshChavan12 and Kalpesh Chavan authored Sep 28, 2021
1 parent f469ebf commit 10c758b
Show file tree
Hide file tree
Showing 51 changed files with 3,557 additions and 3,351 deletions.
8 changes: 8 additions & 0 deletions linter_exclusions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1251,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
4 changes: 4 additions & 0 deletions src/maintenance/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

1.3.0
++++++
* Added support for VM patch maintenance.

1.2.0
++++++
* Added support for VMSS OSImage and extension.
Expand Down
27 changes: 15 additions & 12 deletions src/maintenance/azext_maintenance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,21 @@
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=unused-import

import azext_maintenance._help
from azure.cli.core import AzCommandsLoader
from azext_maintenance.generated._help import helps # pylint: disable=unused-import
try:
from azext_maintenance.manual._help import helps # pylint: disable=reimported
except ImportError:
pass


class MaintenanceClientCommandsLoader(AzCommandsLoader):
class MaintenanceManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_maintenance.generated._client_factory import cf_maintenance_cl
maintenance_custom = CliCommandType(
operations_tmpl='azext_maintenance.custom#{}',
client_factory=cf_maintenance_cl)
parent = super(MaintenanceClientCommandsLoader, self)
parent = super(MaintenanceManagementClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=maintenance_custom)

def load_command_table(self, args):
Expand All @@ -33,8 +30,11 @@ def load_command_table(self, args):
try:
from azext_maintenance.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
except ImportError as e:
if e.name.endswith('manual.commands'):
pass
else:
raise e
return self.command_table

def load_arguments(self, command):
Expand All @@ -43,8 +43,11 @@ def load_arguments(self, command):
try:
from azext_maintenance.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass
except ImportError as e:
if e.name.endswith('manual._params'):
pass
else:
raise e


COMMAND_LOADER_CLS = MaintenanceClientCommandsLoader
COMMAND_LOADER_CLS = MaintenanceManagementClientCommandsLoader
20 changes: 20 additions & 0 deletions src/maintenance/azext_maintenance/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import
# pylint: disable=unused-import
from .generated._help import helps # pylint: disable=reimported
try:
from .manual._help import helps # pylint: disable=reimported
except ImportError as e:
if e.name.endswith('manual._help'):
pass
else:
raise e
7 changes: 5 additions & 2 deletions src/maintenance/azext_maintenance/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError:
pass
except ImportError as e:
if e.name.endswith('manual.action'):
pass
else:
raise e
1 change: 1 addition & 0 deletions src/maintenance/azext_maintenance/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.15.0"
}
7 changes: 5 additions & 2 deletions src/maintenance/azext_maintenance/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError:
pass
except ImportError as e:
if e.name.endswith('manual.custom'):
pass
else:
raise e
12 changes: 2 additions & 10 deletions src/maintenance/azext_maintenance/generated/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

def cf_maintenance_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_maintenance.vendored_sdks.maintenance import MaintenanceClient
from azext_maintenance.vendored_sdks.maintenance import MaintenanceManagementClient
return get_mgmt_service_client(cli_ctx,
MaintenanceClient)
MaintenanceManagementClient)


def cf_public_maintenance_configuration(cli_ctx, *_):
Expand All @@ -32,13 +32,5 @@ def cf_maintenance_configuration(cli_ctx, *_):
return cf_maintenance_cl(cli_ctx).maintenance_configurations


def cf_maintenance_configuration_for_resource_group(cli_ctx, *_):
return cf_maintenance_cl(cli_ctx).maintenance_configurations_for_resource_group


def cf_apply_update_for_resource_group(cli_ctx, *_):
return cf_maintenance_cl(cli_ctx).apply_update_for_resource_group


def cf_update(cli_ctx, *_):
return cf_maintenance_cl(cli_ctx).updates
Loading

0 comments on commit 10c758b

Please sign in to comment.