Skip to content

Commit

Permalink
add new test
Browse files Browse the repository at this point in the history
add new test--01

remove unuse file

Add FileEndpoint to azure_rm_storageaccount_info (ansible-collections#102)

* Add FileEndpoint to azure_rm_storageaccount_info

Use hasattr instead of dir (ansible-collections#75)

Add ephemeral OS disk for azure_rm_virtualmachine (ansible-collections#124)

* Add ephemeral OS disk  support for azure_rm_virtualmachine

Add ephemeral OS disk for azure_rm_virtualmachinescaleset (ansible-collections#128)

* Add ephemeral OS disk support for azure_rm_virtualmachinescaleset

Change network_client api_version to match latest default api_version (ansible-collections#157)

* #Fixes 156
Change network_client api_version to match latest default api_version

* #Fixes 156
Update azure-mgmt-network to 10.2.0
Update 'latest' version listing and default version for Network Client to 2018-08-01

reverse change

Add ability to remove all Subnet Service Endpoints when supplying an empty list. (ansible-collections#148)

New azure_rm_privatednszone module with tests (ansible-collections#122)

* New azure_rm_privatednszone module with tests

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
Co-authored-by: Fred-sun <xiuxi.sun@qq.com>

Add new azure active directory related modules (ansible-collections#179)

* add ad related modules

* release v0.2.0 preparation and minor ad module bug fixing

fixing sanity testing errors in ad related modules (ansible-collections#182)

* disable ad relate module test
* fixing sanity testing errors in ad related modules

Fixing issues in azure_rm_deployment_info.py  (ansible-collections#180)

- Fixing getting the template_link when it does not exist.
- Feature: Return the correlation_id

Co-authored-by: Steve Kieu <steve.kieu@xvt.com.au>

azure_rm_virtualmachine: Protect against no diskSizeGB (ansible-collections#185)

Disks `diskSizeGB` is not reported if the Virtual Machine is
deallocated.  Trying to fetch it is causing a `KeyError`. This guards
against that KeyError and then nulls out the key so it isn't set
incorrectly in the update call.

add new

Fix wrong module deprecate statement format (ansible-collections#176)

* fix wrong module deprecate statement format
  • Loading branch information
Fred-sun committed Sep 2, 2020
1 parent e2266fb commit ff1ff6a
Show file tree
Hide file tree
Showing 102 changed files with 2,054 additions and 97 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Change Log

## v0.2.0 (2020-07-03)

### NEW MODULES
- azure_rm_privatezone module ([#122](https://github.com/ansible-collections/azure/pull/122))
- azure_rm_adserviceprincipal module ([#179](https://github.com/ansible-collections/azure/pull/179))
- azure_rm_adserviceprincipal_info module ([#179](https://github.com/ansible-collections/azure/pull/179))
- azure_rm_adpassword module ([#179](https://github.com/ansible-collections/azure/pull/179))
- azure_rm_adpassword_info module ([#179](https://github.com/ansible-collections/azure/pull/179))

### FEATURE ENHANCEMENT
- add ability to remove all subnet service endpoints ([#148](https://github.com/ansible-collections/azure/pull/148))
- update network client api version ([#157](https://github.com/ansible-collections/azure/pull/157))
- add ephemeral os disk support for azure_rm_virualmachinescaleset ([#128](https://github.com/ansible-collections/azure/pull/128))
- add ephemeral os disk support for azure_rm_virtualmachine ([#124](https://github.com/ansible-collections/azure/pull/124))
- add FileEndpoint to azure_rm_storageaccount_info ([#102](https://github.com/ansible-collections/azure/pull/102))
- add support for managing the 'Firewall and virtual networks' settings in azure_rm_storageaccount ([#108](https://github.com/ansible-collections/azure/pull/108))

### BUG FIXING
- bug fixing in azure_rm_aks ([#170](https://github.com/ansible-collections/azure/pull/170))
- migrate missing doc_fragments that went missing ([#115](https://github.com/ansible-collections/azure/pull/115))

## v0.1.3 (2020-05-13)

- add new parameter in azure_rm_aks
Expand Down
3 changes: 1 addition & 2 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace: azure
name: azcollection

# The version of the collection. Must be compatible with semantic versioning
version: 0.1.3
version: 0.2.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand All @@ -18,7 +18,6 @@ readme: README.md
# @nicks:irc/im.site#channel'
authors:
- Microsoft <haiyzhan@microsoft.com>
- Microsoft <jieshe@microsoft.com>


### OPTIONAL but strongly recommended
Expand Down
Empty file removed log_plugin.log
Empty file.
44 changes: 38 additions & 6 deletions plugins/module_utils/azure_rm_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def default_api_version(self):
snapshots='2018-10-01',
virtual_machine_run_commands='2018-10-01'
),
'NetworkManagementClient': '2018-08-01',
'NetworkManagementClient': '2019-06-01',
'ResourceManagementClient': '2017-05-10',
'StorageManagementClient': '2017-10-01',
'WebSiteManagementClient': '2018-02-01',
Expand Down Expand Up @@ -227,6 +227,8 @@ def default_api_version(self):
from azure.mgmt.storage import StorageManagementClient
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.dns import DnsManagementClient
from azure.mgmt.privatedns import PrivateDnsManagementClient
import azure.mgmt.privatedns.models as PrivateDnsModels
from azure.mgmt.monitor import MonitorManagementClient
from azure.mgmt.web import WebSiteManagementClient
from azure.mgmt.containerservice import ContainerServiceClient
Expand Down Expand Up @@ -327,6 +329,10 @@ def normalize_location_name(name):
'package_name': 'dns',
'expected_version': '2.1.0'
},
'PrivateDnsManagementClient': {
'package_name': 'privatedns',
'expected_version': '0.1.0'
},
'WebSiteManagementClient': {
'package_name': 'web',
'expected_version': '0.41.0'
Expand All @@ -345,7 +351,7 @@ class AzureRMModuleBase(object):
def __init__(self, derived_arg_spec, bypass_checks=False, no_log=False,
check_invalid_arguments=None, mutually_exclusive=None, required_together=None,
required_one_of=None, add_file_common_args=False, supports_check_mode=False,
required_if=None, supports_tags=True, facts_module=False, skip_exec=False):
required_if=None, supports_tags=True, facts_module=False, skip_exec=False, is_ad_resource=False):

merged_arg_spec = dict()
merged_arg_spec.update(AZURE_COMMON_ARGS)
Expand Down Expand Up @@ -386,6 +392,7 @@ def __init__(self, derived_arg_spec, bypass_checks=False, no_log=False,
self._resource_client = None
self._compute_client = None
self._dns_client = None
self._private_dns_client = None
self._web_client = None
self._marketplace_client = None
self._sql_client = None
Expand All @@ -411,7 +418,7 @@ def __init__(self, derived_arg_spec, bypass_checks=False, no_log=False,
# self.debug = self.module.params.get('debug')

# delegate auth to AzureRMAuth class (shared with all plugin types)
self.azure_auth = AzureRMAuth(fail_impl=self.fail, **self.module.params)
self.azure_auth = AzureRMAuth(fail_impl=self.fail, is_ad_resource=is_ad_resource, **self.module.params)

# common parameter validation
if self.module.params.get('tags'):
Expand Down Expand Up @@ -820,6 +827,14 @@ def get_api_profile(self, client_type_name, api_profile_name):
# wrap basic strings in a dict that just defines the default
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)

return client

def get_mgmt_svc_client(self, client_type, base_url=None, api_version=None):
self.log('Getting management service client {0}'.format(client_type.__name__))
self.check_client_version(client_type)
Expand Down Expand Up @@ -989,6 +1004,20 @@ def dns_models(self):
self.log("Getting dns models...")
return DnsManagementClient.models('2018-05-01')

@property
def private_dns_client(self):
self.log('Getting private dns client')
if not self._private_dns_client:
self._private_dns_client = self.get_mgmt_svc_client(
PrivateDnsManagementClient,
base_url=self._cloud_environment.endpoints.resource_manager)
return self._private_dns_client

@property
def private_dns_models(self):
self.log('Getting private dns models')
return PrivateDnsModels

@property
def web_client(self):
self.log('Getting web client')
Expand Down Expand Up @@ -1204,7 +1233,7 @@ class AzureRMAuthException(Exception):
class AzureRMAuth(object):
def __init__(self, auth_source='auto', profile=None, subscription_id=None, client_id=None, secret=None,
tenant=None, ad_user=None, password=None, cloud_environment='AzureCloud', cert_validation_mode='validate',
api_profile='latest', adfs_authority_url=None, fail_impl=None, **kwargs):
api_profile='latest', adfs_authority_url=None, fail_impl=None, is_ad_resource=False, **kwargs):

if fail_impl:
self._fail_impl = fail_impl
Expand All @@ -1213,6 +1242,7 @@ def __init__(self, auth_source='auto', profile=None, subscription_id=None, clien

self._cloud_environment = None
self._adfs_authority_url = None
self.is_ad_resource = is_ad_resource

# authenticate
self.credentials = self._get_credentials(
Expand Down Expand Up @@ -1358,8 +1388,10 @@ def _get_msi_credentials(self, subscription_id_param=None, **kwargs):
'subscription_id': subscription_id
}

def _get_azure_cli_credentials(self):
credentials, subscription_id = get_azure_cli_credentials()
def _get_azure_cli_credentials(self, resource=None):
if self.is_ad_resource:
resource = 'https://graph.windows.net/'
credentials, subscription_id = get_azure_cli_credentials(resource)
cloud_environment = get_cli_active_cloud()

cli_credentials = {
Expand Down
Loading

0 comments on commit ff1ff6a

Please sign in to comment.