Open
Description
Is your feature request related to a problem? Please describe.
The latest container service SDK has switched to a multi-API format. The CLI needs to be updated to use multi-API idioms.
In azure.cli.core.profiles._shared.py
:
Add an entry in the "latest" profile like this:
AZURE_API_PROFILES = {
'latest': {
ResourceType.MGMT_ACS: '2017-07-01', # you can call this whatever you want
ResourceType.MGMT_ACS_PREVIEW: '2018_03_31', # looks like you'll need two versions on a given profile.
ResourceType.MGMT_STORAGE: '2018-07-01',
In init.py for your module:
class ContainerServiceCommandsLoader(AzCommandsLoader):
def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
acs_custom = CliCommandType(operations_tmpl='azure.cli.command_modules.acs.custom#{}')
from azure.cli.core.profile import ResourceType
super(ContainerServiceCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=acs_custom,
min_profile='2017-03-10-profile',
resource_type=ResourceType.MGMT_ACS) # your resource type here
Where ever you have direct import statements, move them into the command or validator they are needed for and convert.
Example:
# this
from azure.mgmt.containerservice.models import ContainerServiceLinuxProfile
from azure.mgmt.containerservice.models import ContainerServiceNetworkProfile
# becomes this
ContainerServiceLinuxProfile, ContainerServiceNetworkProfile = cmd.get_models(
'ContainerServiceLinuxProfile', 'ContainerServiceNetworkProfile'
)
Note you need a cmd context to call get_models
so you can only do this import inside a command or validator, not as a top-level import.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment