diff options
author | Toshio Kuratomi <a.badger@gmail.com> | 2019-08-29 18:04:06 +0200 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2019-08-29 18:04:48 +0200 |
commit | 68fa03138c719377b754dc1bbd083529297d38b3 (patch) | |
tree | 12ac3c3ea2dc6e623835f6741fc1453ba3e7f0e7 | |
parent | Properly load module_prefix for collections in task_executor.py (#60420) (diff) | |
download | ansible-68fa03138c719377b754dc1bbd083529297d38b3.tar.xz ansible-68fa03138c719377b754dc1bbd083529297d38b3.zip |
Revert "New Module: NetApp Account (#59939)"
This reverts commit 6a8dcb8fcbc0e79484067dc8c5b5dda173e73ce2.
Reverting this as it breaks CI for azure (more permissions would be
needed for our account)
8 files changed, 0 insertions, 239 deletions
diff --git a/lib/ansible/module_utils/azure_rm_common.py b/lib/ansible/module_utils/azure_rm_common.py index 222da43f13..c51ff09f5c 100644 --- a/lib/ansible/module_utils/azure_rm_common.py +++ b/lib/ansible/module_utils/azure_rm_common.py @@ -179,7 +179,6 @@ try: from msrestazure import AzureConfiguration from msrest.authentication import Authentication from azure.mgmt.resource.locks import ManagementLockClient - from azure.mgmt.netapp.azure_net_app_files_management_client import AzureNetAppFilesManagementClient except ImportError as exc: Authentication = object HAS_AZURE_EXC = traceback.format_exc() @@ -332,7 +331,6 @@ class AzureRMModuleBase(object): self._automation_client = None self._IoThub_client = None self._lock_client = None - self._netapp_client = None self.check_mode = self.module.check_mode self.api_profile = self.module.params.get('api_profile') @@ -914,15 +912,6 @@ class AzureRMModuleBase(object): return self._dns_client @property - def netapp_client(self): - self.log('Getting netapp client') - if not self._netapp_client: - self._netapp_client = self.get_mgmt_svc_client(AzureNetAppFilesManagementClient, - base_url=self._cloud_environment.endpoints.resource_manager, - api_version='2018-05-01') - return self._netapp_client - - @property def dns_models(self): self.log("Getting dns models...") return DnsManagementClient.models('2018-05-01') diff --git a/lib/ansible/modules/cloud/azure/azure_rm_netapp_account.py b/lib/ansible/modules/cloud/azure/azure_rm_netapp_account.py deleted file mode 100644 index 96522e4f77..0000000000 --- a/lib/ansible/modules/cloud/azure/azure_rm_netapp_account.py +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/python -# -# (c) 2019, NetApp, Inc -# GNU General Public License v3.0+ -# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'certified'} - - -DOCUMENTATION = ''' ---- -module: azure_rm_netapp_account - -short_description: Manage NetApp Azure Files Account -version_added: "2.9" -author: NetApp Ansible Team (@carchi8py) <ng-ansibleteam@netapp.com> - -description: - - Create and delete NetApp Azure account. - Provide the Resource group name for the NetApp account to be created. -extends_documentation_fragment: - - netapp.azure_rm_netapp - -options: - name: - description: - - The name of the NetApp account. - required: true - type: str - location: - description: - - Resource location. - - Required for create. - type: str - state: - description: - - State C(present) will check that the NetApp account exists with the requested configuration. - - State C(absent) will delete the NetApp account. - default: present - choices: - - absent - - present - type: str - -''' -EXAMPLES = ''' - -- name: Create NetApp Azure Account - azure_rm_netapp_account: - resource_group: myResourceGroup - name: testaccount - location: eastus - -- name: Delete NetApp Azure Account - azure_rm_netapp_account: - state: absent - resource_group: myResourceGroup - name: testaccount - location: eastus - -''' - -RETURN = ''' -''' - -try: - from msrestazure.azure_exceptions import CloudError - from msrestazure.tools import parse_resource_id - from msrest.polling import LROPoller -except ImportError: - # This is handled in azure_rm_common - pass - -from ansible.module_utils.basic import to_native -from ansible.module_utils.azure_rm_common import AzureRMModuleBase -from ansible.module_utils.netapp_module import NetAppModule -from ansible.module_utils.basic import AnsibleModule -import traceback - -HAS_AZURE_MGMT_NETAPP = False -try: - from azure.mgmt.netapp.azure_net_app_files_management_client import AzureNetAppFilesManagementClient - from azure.mgmt.netapp.models import NetAppAccount - HAS_AZURE_MGMT_NETAPP = True -except ImportError: - HAS_AZURE_MGMT_NETAPP = False - - -class AzureRMNetAppAccount(AzureRMModuleBase): - - def __init__(self): - - self.module_arg_spec = dict( - resource_group=dict(type='str', required=True), - name=dict(type='str', required=True), - location=dict(type='str'), - state=dict(choices=['present', 'absent'], default='present', type='str'), - ) - self.module = AnsibleModule( - argument_spec=self.module_arg_spec, - supports_check_mode=True - ) - self.na_helper = NetAppModule() - self.parameters = self.na_helper.set_parameters(self.module.params) - - # authentication - using CLI - if HAS_AZURE_MGMT_NETAPP is False: - self.module.fail_json(msg="the python Azure-mgmt-NetApp module is required") - super(AzureRMNetAppAccount, self).__init__(derived_arg_spec=self.module_arg_spec, - supports_check_mode=True) - - def get_azure_netapp_account(self): - """ - Returns NetApp Account object for an existing account - Return None if account does not exist - """ - try: - account_get = self.netapp_client.accounts.get(self.parameters['resource_group'], self.parameters['name']) - except CloudError: # account does not exist - return None - return account_get - - def create_azure_netapp_account(self): - """ - Create an Azure NetApp Account - :return: None - """ - account_body = NetAppAccount( - location=self.parameters['location'] - ) - try: - self.netapp_client.accounts.create_or_update(body=account_body, - resource_group_name=self.parameters['resource_group'], - account_name=self.parameters['name']) - except CloudError as error: - self.module.fail_json(msg='Error creating Azure NetApp account %s: %s' - % (self.parameters['name'], to_native(error)), - exception=traceback.format_exc()) - - def delete_azure_netapp_account(self): - """ - Delete an Azure NetApp Account - :return: None - """ - try: - self.netapp_client.accounts.delete(resource_group_name=self.parameters['resource_group'], - account_name=self.parameters['name']) - except CloudError as error: - self.module.fail_json(msg='Error deleting Azure NetApp account %s: %s' - % (self.parameters['name'], to_native(error)), - exception=traceback.format_exc()) - - def exec_module(self, **kwargs): - current = self.get_azure_netapp_account() - cd_action = self.na_helper.get_cd_action(current, self.parameters) - - if self.na_helper.changed: - if self.module.check_mode: - pass - else: - if cd_action == 'create': - self.create_azure_netapp_account() - elif cd_action == 'delete': - self.delete_azure_netapp_account() - - self.module.exit_json(changed=self.na_helper.changed) - - -def main(): - AzureRMNetAppAccount() - - -if __name__ == '__main__': - main() diff --git a/packaging/requirements/requirements-azure.txt b/packaging/requirements/requirements-azure.txt index 586140a2c7..37f112f025 100644 --- a/packaging/requirements/requirements-azure.txt +++ b/packaging/requirements/requirements-azure.txt @@ -37,4 +37,3 @@ azure-mgmt-devtestlabs==3.0.0 azure-mgmt-loganalytics==0.2.0 azure-mgmt-automation==0.1.1 azure-mgmt-iothub==0.7.0 -azure-mgmt-netapp ; python_version >= '2.7' diff --git a/test/integration/targets/azure_rm_netapp_account/aliases b/test/integration/targets/azure_rm_netapp_account/aliases deleted file mode 100644 index 3a0c0dc68d..0000000000 --- a/test/integration/targets/azure_rm_netapp_account/aliases +++ /dev/null @@ -1,3 +0,0 @@ -cloud/azure -shippable/azure/group3 -destructive
\ No newline at end of file diff --git a/test/integration/targets/azure_rm_netapp_account/meta/main.yml b/test/integration/targets/azure_rm_netapp_account/meta/main.yml deleted file mode 100644 index 95e1952f98..0000000000 --- a/test/integration/targets/azure_rm_netapp_account/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - setup_azure diff --git a/test/integration/targets/azure_rm_netapp_account/tasks/main.yml b/test/integration/targets/azure_rm_netapp_account/tasks/main.yml deleted file mode 100644 index f4c398dea7..0000000000 --- a/test/integration/targets/azure_rm_netapp_account/tasks/main.yml +++ /dev/null @@ -1,39 +0,0 @@ -- name: Create Azure NetApp account - azure_rm_netapp_account: - resource_group: "{{ resource_group }}" - name: tests-netapp1 - location: eastus - register: output - -- assert: - that: output.changed - -- name: Create Azure NetApp account (Idempotency) - azure_rm_netapp_account: - resource_group: "{{ resource_group }}" - name: tests-netapp1 - location: eastus - register: output - -- assert: - that: not output.changed - -- name: Delete Azure NetApp account - azure_rm_netapp_account: - state: absent - resource_group: "{{ resource_group }}" - name: tests-netapp1 - register: output - -- assert: - that: output.changed - -- name: Delete Azure NetApp account (Idempotency) - azure_rm_netapp_account: - state: absent - resource_group: "{{ resource_group }}" - name: tests-netapp1 - register: output - -- assert: - that: not output.changed diff --git a/test/lib/ansible_test/_data/requirements/constraints.txt b/test/lib/ansible_test/_data/requirements/constraints.txt index b5e208a5cb..d619be6367 100644 --- a/test/lib/ansible_test/_data/requirements/constraints.txt +++ b/test/lib/ansible_test/_data/requirements/constraints.txt @@ -36,9 +36,6 @@ lxml < 4.3.0 ; python_version < '2.7' # lxml 4.3.0 and later require python 2.7 pyvmomi < 6.0.0 ; python_version < '2.7' # pyvmomi 6.0.0 and later require python 2.7 or later pyone == 1.1.9 # newer versions do not pass current integration tests botocore >= 1.10.0 # adds support for the following AWS services: secretsmanager, fms, and acm-pca -azure-common >= 1.1.12 ; python_version >= '2.7' -azure-mgmt-nspkg >= 3.0.0 ; python_version >= '2.7' -azure-nspkg >= 3.0.0 ; python_version >= '2.7' # freeze pylint and its requirements for consistent test results astroid == 2.2.5 diff --git a/test/lib/ansible_test/_data/requirements/integration.cloud.azure.txt b/test/lib/ansible_test/_data/requirements/integration.cloud.azure.txt index 586140a2c7..37f112f025 100644 --- a/test/lib/ansible_test/_data/requirements/integration.cloud.azure.txt +++ b/test/lib/ansible_test/_data/requirements/integration.cloud.azure.txt @@ -37,4 +37,3 @@ azure-mgmt-devtestlabs==3.0.0 azure-mgmt-loganalytics==0.2.0 azure-mgmt-automation==0.1.1 azure-mgmt-iothub==0.7.0 -azure-mgmt-netapp ; python_version >= '2.7' |