resources models

This commit is contained in:
Zhijun Zhao 2017-12-28 16:32:17 +08:00 committed by Matt Davis
parent 11c5d7b670
commit 8b482ecd81
2 changed files with 7 additions and 14 deletions

View file

@ -379,12 +379,6 @@ except ImportError as exc:
try:
from itertools import chain
from azure.common.exceptions import CloudError
from azure.mgmt.resource.resources.models import (DeploymentProperties,
ParametersLink,
TemplateLink,
Deployment,
ResourceGroup,
Dependency)
from azure.mgmt.resource.resources import ResourceManagementClient
from azure.mgmt.network import NetworkManagementClient
@ -482,21 +476,21 @@ class AzureRMDeploymentManager(AzureRMModuleBase):
:return:
"""
deploy_parameter = DeploymentProperties(self.deployment_mode)
deploy_parameter = self.rm_models.DeploymentProperties(self.deployment_mode)
if not self.parameters_link:
deploy_parameter.parameters = self.parameters
else:
deploy_parameter.parameters_link = ParametersLink(
deploy_parameter.parameters_link = self.rm_models.ParametersLink(
uri=self.parameters_link
)
if not self.template_link:
deploy_parameter.template = self.template
else:
deploy_parameter.template_link = TemplateLink(
deploy_parameter.template_link = self.rm_models.TemplateLink(
uri=self.template_link
)
params = ResourceGroup(location=self.location, tags=self.tags)
params = self.rm_models.ResourceGroup(location=self.location, tags=self.tags)
try:
self.rm_client.resource_groups.create_or_update(self.resource_group_name, params)
@ -627,7 +621,7 @@ class AzureRMDeploymentManager(AzureRMModuleBase):
for dep in dependencies:
if dep.resource_name not in tree:
tree[dep.resource_name] = dict(dep=dep, children=dict())
if isinstance(dep, Dependency) and dep.depends_on is not None and len(dep.depends_on) > 0:
if isinstance(dep, self.rm_models.Dependency) and dep.depends_on is not None and len(dep.depends_on) > 0:
self._build_hierarchy(dep.depends_on, tree[dep.resource_name]['children'])
if 'top' in tree:

View file

@ -96,7 +96,6 @@ state:
try:
from msrestazure.azure_exceptions import CloudError
from azure.mgmt.resource.resources.models import ResourceGroup
except ImportError:
pass
@ -193,13 +192,13 @@ class AzureRMResourceGroup(AzureRMModuleBase):
if self.name_exists():
self.fail("Error: a resource group with the name {0} already exists in your subscription."
.format(self.name))
params = ResourceGroup(
params = self.rm_models.ResourceGroup(
location=self.location,
tags=self.tags
)
else:
# Update resource group
params = ResourceGroup(
params = self.rm_models.ResourceGroup(
location=results['location'],
tags=results['tags']
)