Skip to content

Commit

Permalink
fix sanity test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred-sun authored and haiyuazhang committed Aug 12, 2020
1 parent d3fbf7e commit c60dcd9
Show file tree
Hide file tree
Showing 189 changed files with 986 additions and 633 deletions.
10 changes: 5 additions & 5 deletions plugins/doc_fragments/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ class ModuleDocFragment(object):
the C(AZURE_CLOUD_ENVIRONMENT) environment variable.
type: str
default: AzureCloud
version_added: '2.4'
version_added: '0.0.1'
adfs_authority_url:
description:
- Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority.
type: str
version_added: '2.6'
version_added: '0.0.1'
cert_validation_mode:
description:
- Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but
when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing C(ignore). Can also be
set via credential file profile or the C(AZURE_CERT_VALIDATION) environment variable.
type: str
choices: [ ignore, validate ]
version_added: '2.5'
version_added: '0.0.1'
auth_source:
description:
- Controls the source of the credentials to use for authentication.
Expand All @@ -84,14 +84,14 @@ class ModuleDocFragment(object):
- credential_file
- env
- msi
version_added: '2.5'
version_added: '0.0.1'
api_profile:
description:
- Selects an API profile to use when communicating with Azure services. Default value of C(latest) is appropriate for public clouds;
future values will allow use with Azure Stack.
type: str
default: latest
version_added: '2.5'
version_added: '0.0.1'
requirements:
- python >= 2.7
- azure >= 2.0.0
Expand Down
5 changes: 4 additions & 1 deletion plugins/module_utils/azure_rm_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
import traceback
import json

try:
from azure.graphrbac import GraphRbacManagementClient
except Exception:
pass
from os.path import expanduser

from ansible.module_utils.basic import AnsibleModule, missing_required_lib
Expand Down Expand Up @@ -828,7 +832,6 @@ def get_api_profile(self, client_type_name, api_profile_name):
return dict(default_api_version=profile_raw)

def get_graphrbac_client(self, tenant_id):
from azure.graphrbac import GraphRbacManagementClient
cred = self.azure_auth.azure_credentials
base_url = self.azure_auth._cloud_environment.endpoints.active_directory_graph_resource_id
client = GraphRbacManagementClient(cred, tenant_id, base_url)
Expand Down
5 changes: 3 additions & 2 deletions plugins/modules/azure_rm_adpassword.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
---
module: azure_rm_adpassword
version_added: "2.10"
version_added: "0.2.0"
short_description: Manage application password
Expand Down Expand Up @@ -112,6 +112,7 @@
'''

from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
import uuid

try:
from msrestazure.azure_exceptions import CloudError
Expand Down Expand Up @@ -243,8 +244,8 @@ def delete_password(self, old_passwords):
self.fail("failed to delete password with key id {0} - {1}".format(self.app_id, str(ge)))

def create_password(self, old_passwords):

def gen_guid():
import uuid
return uuid.uuid4()

if self.value is None:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_adpassword_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
DOCUMENTATION = '''
module: azure_rm_adpassword_info
version_added: "2.10"
version_added: "0.2.0"
short_description: Get application password info
Expand Down
9 changes: 6 additions & 3 deletions plugins/modules/azure_rm_adserviceprincipal.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
---
module: azure_rm_adserviceprincipal
version_added: "2.10"
version_added: "0.2.0"
short_description: Manage Azure Active Directory service principal
Expand Down Expand Up @@ -94,6 +94,11 @@
'''

from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common_ext import AzureRMModuleBaseExt
try:
from azure.graphrbac.models import ServicePrincipalCreateParameters
from azure.graphrbac.models import ServicePrincipalUpdateParameters
except Exception:
pass

try:
from msrestazure.azure_exceptions import CloudError
Expand Down Expand Up @@ -147,7 +152,6 @@ def exec_module(self, **kwargs):
return self.results

def create_resource(self):
from azure.graphrbac.models import ServicePrincipalCreateParameters
try:
client = self.get_graphrbac_client(self.tenant)
response = client.service_principals.create(ServicePrincipalCreateParameters(app_id=self.app_id, account_enabled=True))
Expand All @@ -159,7 +163,6 @@ def create_resource(self):

def update_resource(self, old_response):
try:
from azure.graphrbac.models import ServicePrincipalUpdateParameters
client = self.get_graphrbac_client(self.tenant)
to_update = {}
if self.app_role_assignment_required is not None:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_adserviceprincipal_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
DOCUMENTATION = '''
module: azure_rm_adserviceprincipal_info
version_added: "2.10"
version_added: "0.2.0"
short_description: Get Azure Active Directory service principal info
Expand Down
6 changes: 1 addition & 5 deletions plugins/modules/azure_rm_aks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
DOCUMENTATION = '''
---
module: azure_rm_aks
version_added: "2.6"
version_added: "0.1.2"
short_description: Manage a managed Azure Container Service (AKS) instance
description:
- Create, update and delete a managed Azure Container Service (AKS) instance.
Expand Down Expand Up @@ -116,7 +116,6 @@
- Existing non-RBAC enabled AKS clusters cannot currently be updated for RBAC use.
type: bool
default: no
version_added: "2.8"
network_profile:
description:
- Profile of network configuration.
Expand Down Expand Up @@ -159,7 +158,6 @@
- A CIDR notation IP range assigned to the Docker bridge network.
- It must not overlap with any Subnet IP ranges or the Kubernetes service address range.
default: "172.17.0.1/16"
version_added: "2.8"
aad_profile:
description:
- Profile of Azure Active Directory configuration.
Expand All @@ -174,7 +172,6 @@
description:
- The AAD tenant ID to use for authentication.
- If not specified, will use the tenant of the deployment subscription.
version_added: "2.8"
addon:
description:
- Profile of managed cluster add-on.
Expand Down Expand Up @@ -219,7 +216,6 @@
description:
- Subnet associated to the cluster.
required: true
version_added: "2.8"
node_resource_group:
description:
- Name of the resource group containing agent pool nodes.
Expand Down
3 changes: 1 addition & 2 deletions plugins/modules/azure_rm_aks_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
---
module: azure_rm_aks_info
version_added: "2.9"
version_added: "0.1.2"
short_description: Get Azure Kubernetes Service facts
Expand All @@ -37,7 +37,6 @@
description:
- Show kubeconfig of the AKS cluster.
- Note the operation will cost more network overhead, not recommended when listing AKS.
version_added: "2.8"
choices:
- user
- admin
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_aksversion_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
---
module: azure_rm_aksversion_info
version_added: "2.9"
version_added: "0.1.2"
short_description: Get available kubernetes versions supported by Azure Kubernetes Service
Expand Down
4 changes: 1 addition & 3 deletions plugins/modules/azure_rm_appgateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DOCUMENTATION = '''
---
module: azure_rm_appgateway
version_added: "2.7"
version_added: "0.1.2"
short_description: Manage Application Gateway instance
description:
- Create, update and delete instance of Application Gateway.
Expand Down Expand Up @@ -143,7 +143,6 @@
description:
- Name of the resource that is unique within a resource group. This name can be used to access the resource.
redirect_configurations:
version_added: "2.8"
description:
- Redirect configurations of the application gateway resource.
suboptions:
Expand Down Expand Up @@ -232,7 +231,6 @@
description:
- Resource that is unique within a resource group. This name can be used to access the resource.
probes:
version_added: "2.8"
description:
- Probes available to the application gateway resource.
suboptions:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_applicationsecuritygroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DOCUMENTATION = '''
---
module: azure_rm_applicationsecuritygroup
version_added: "2.8"
version_added: "0.1.2"
short_description: Manage Azure Application Security Group
description:
- Create, update and delete instance of Azure Application Security Group.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_applicationsecuritygroup_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DOCUMENTATION = '''
---
module: azure_rm_applicationsecuritygroup_info
version_added: "2.9"
version_added: "0.1.2"
short_description: Get Azure Application Security Group facts
description:
- Get facts of Azure Application Security Group.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_appserviceplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DOCUMENTATION = '''
---
module: azure_rm_appserviceplan
version_added: "2.7"
version_added: "0.1.2"
short_description: Manage App Service Plan
description:
- Create, update and delete instance of App Service Plan.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_appserviceplan_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
---
module: azure_rm_appserviceplan_info
version_added: "2.9"
version_added: "0.1.2"
short_description: Get azure app service plan facts
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_automationaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DOCUMENTATION = '''
---
module: azure_rm_automationaccount
version_added: "2.9"
version_added: "0.1.2"
short_description: Manage Azure Automation account
description:
- Create, delete an Azure Automation account.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_automationaccount_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DOCUMENTATION = '''
---
module: azure_rm_automationaccount_info
version_added: '2.9'
version_added: '0.1.2'
short_description: Get Azure automation account facts
description:
- Get facts of automation account.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_autoscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DOCUMENTATION = '''
---
module: azure_rm_autoscale
version_added: "2.7"
version_added: "0.1.2"
short_description: Manage Azure autoscale setting
description:
- Create, delete an autoscale setting.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_autoscale_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DOCUMENTATION = '''
---
module: azure_rm_autoscale_info
version_added: "2.9"
version_added: "0.1.2"
short_description: Get Azure Auto Scale Setting facts
description:
- Get facts of Auto Scale Setting.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_availabilityset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
---
module: azure_rm_availabilityset
version_added: "2.4"
version_added: "0.1.2"
short_description: Manage Azure Availability Set
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_availabilityset_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
---
module: azure_rm_availabilityset_info
version_added: "2.9"
version_added: "0.1.2"
short_description: Get Azure Availability Set facts
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_azurefirewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DOCUMENTATION = '''
---
module: azure_rm_azurefirewall
version_added: '2.9'
version_added: '0.1.2'
short_description: Manage Azure Firewall instance
description:
- Create, update and delete instance of Azure Firewall.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_azurefirewall_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DOCUMENTATION = '''
---
module: azure_rm_azurefirewall_info
version_added: '2.9'
version_added: '0.1.2'
short_description: Get AzureFirewall info
description:
- Get info of AzureFirewall.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_batchaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
DOCUMENTATION = '''
---
module: azure_rm_batchaccount
version_added: "2.9"
version_added: "0.1.2"
short_description: Manages a Batch Account on Azure
description:
- Create, update and delete instance of Azure Batch Account.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_cdnendpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
DOCUMENTATION = '''
---
module: azure_rm_cdnendpoint
version_added: "2.8"
version_added: "0.1.2"
short_description: Manage a Azure CDN endpoint
description:
- Create, update, start, stop and delete a Azure CDN endpoint.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_cdnendpoint_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
---
module: azure_rm_cdnendpoint_info
version_added: "2.9"
version_added: "0.1.2"
short_description: Get Azure CDN endpoint facts
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_cdnprofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
DOCUMENTATION = '''
---
module: azure_rm_cdnprofile
version_added: "2.8"
version_added: "0.1.2"
short_description: Manage a Azure CDN profile
description:
- Create, update and delete a Azure CDN profile.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_cdnprofile_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
---
module: azure_rm_cdnprofile_info
version_added: "2.9"
version_added: "0.1.2"
short_description: Get Azure CDN profile facts
Expand Down
Loading

0 comments on commit c60dcd9

Please sign in to comment.