diff --git a/lib/ansible/modules/cloud/azure/azure.py b/lib/ansible/modules/cloud/azure/azure.py index 68c070872e3..377f96f55ef 100644 --- a/lib/ansible/modules/cloud/azure/azure.py +++ b/lib/ansible/modules/cloud/azure/azure.py @@ -1,18 +1,11 @@ #!/usr/bin/python -# This file is part of Ansible # -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright (c) Ansible Project +# 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.0', 'status': ['preview'], @@ -624,6 +617,5 @@ class Wrapper(object): raise e -# import module snippets if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/azure/azure_rm_deployment.py b/lib/ansible/modules/cloud/azure/azure_rm_deployment.py index 1381f33f12b..4f3b0f92427 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_deployment.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_deployment.py @@ -1,19 +1,12 @@ #!/usr/bin/python # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright (c) Ansible Project +# 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.0', 'status': ['preview'], 'supported_by': 'curated'} @@ -374,18 +367,9 @@ deployment: returned: always ''' -PREREQ_IMPORT_ERROR = None +import time try: - import time - import yaml -except ImportError as exc: - IMPORT_ERROR = "Error importing module prerequisites: %s" % exc - -from ansible.module_utils.azure_rm_common import * - -try: - from itertools import chain from azure.common.credentials import ServicePrincipalCredentials from azure.common.exceptions import CloudError from azure.mgmt.resource.resources.models import (DeploymentProperties, @@ -401,6 +385,8 @@ except ImportError: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase + class AzureRMDeploymentManager(AzureRMModuleBase): @@ -448,9 +434,6 @@ class AzureRMDeploymentManager(AzureRMModuleBase): def exec_module(self, **kwargs): - if PREREQ_IMPORT_ERROR: - self.fail(PREREQ_IMPORT_ERROR) - for key in list(self.module_arg_spec.keys()) + ['tags']: setattr(self, key, kwargs[key]) @@ -647,15 +630,15 @@ class AzureRMDeploymentManager(AzureRMModuleBase): ) if ip.dns_settings: ip_dict['dns_settings'] = { - 'domain_name_label':ip.dns_settings.domain_name_label, - 'fqdn':ip.dns_settings.fqdn + 'domain_name_label': ip.dns_settings.domain_name_label, + 'fqdn': ip.dns_settings.fqdn } return ip_dict def _nic_to_public_ips_instance(self, nics): return [self.network_client.public_ip_addresses.get(public_ip_id.split('/')[4], public_ip_id.split('/')[-1]) - for nic_obj in [self.network_client.network_interfaces.get(self.resource_group_name, - nic['dep'].resource_name) for nic in nics] + for nic_obj in (self.network_client.network_interfaces.get(self.resource_group_name, + nic['dep'].resource_name) for nic in nics) for public_ip_id in [ip_conf_instance.public_ip_address.id for ip_conf_instance in nic_obj.ip_configurations if ip_conf_instance.public_ip_address]] @@ -664,7 +647,6 @@ class AzureRMDeploymentManager(AzureRMModuleBase): def main(): AzureRMDeploymentManager() -from ansible.module_utils.basic import * + if __name__ == '__main__': main() - diff --git a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py index 15bc0edff76..efe83b0fb84 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py @@ -3,21 +3,11 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', 'status': ['preview'], @@ -226,9 +216,6 @@ state: } ''' -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * - try: from msrestazure.azure_exceptions import CloudError from azure.mgmt.network.models import NetworkInterface, NetworkInterfaceIPConfiguration, Subnet, \ @@ -237,6 +224,7 @@ except ImportError: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict def nic_to_dict(nic): @@ -577,6 +565,6 @@ class AzureRMNetworkInterface(AzureRMModuleBase): def main(): AzureRMNetworkInterface() + if __name__ == '__main__': main() - diff --git a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py index 5251ae47911..dd2221d41e1 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py @@ -2,22 +2,12 @@ # # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# + +# 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.0', 'status': ['preview'], @@ -121,10 +111,6 @@ azure_networkinterfaces: "type": "Microsoft.Network/networkInterfaces" }] ''' # NOQA - -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * - try: from msrestazure.azure_exceptions import CloudError from azure.common import AzureMissingResourceHttpError, AzureHttpError @@ -132,6 +118,8 @@ except: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase + AZURE_OBJECT_CLASS = 'NetworkInterface' @@ -226,4 +214,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/lib/ansible/modules/cloud/azure/azure_rm_publicipaddress.py b/lib/ansible/modules/cloud/azure/azure_rm_publicipaddress.py index 6c1bf462f92..3ba2878d440 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_publicipaddress.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_publicipaddress.py @@ -3,21 +3,11 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', 'status': ['preview'], @@ -120,8 +110,7 @@ state: } ''' -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * +from ansible.module_utils.azure_rm_common import AzureRMModuleBase try: from msrestazure.azure_exceptions import CloudError @@ -286,4 +275,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/lib/ansible/modules/cloud/azure/azure_rm_publicipaddress_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_publicipaddress_facts.py index 1fa0389ccef..eae11019d9e 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_publicipaddress_facts.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_publicipaddress_facts.py @@ -3,21 +3,10 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', @@ -91,11 +80,6 @@ azure_publicipaddresses: "type": "Microsoft.Network/publicIPAddresses" }] ''' - - -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * - try: from msrestazure.azure_exceptions import CloudError from azure.common import AzureMissingResourceHttpError, AzureHttpError @@ -103,6 +87,8 @@ except: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase + AZURE_OBJECT_CLASS = 'PublicIp' @@ -201,6 +187,6 @@ class AzureRMPublicIPFacts(AzureRMModuleBase): def main(): AzureRMPublicIPFacts() + if __name__ == '__main__': main() - diff --git a/lib/ansible/modules/cloud/azure/azure_rm_resourcegroup.py b/lib/ansible/modules/cloud/azure/azure_rm_resourcegroup.py index 9f05b96499e..6c74663cffa 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_resourcegroup.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_resourcegroup.py @@ -3,21 +3,11 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', 'status': ['preview'], @@ -104,16 +94,14 @@ state: } ''' -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * - - try: from msrestazure.azure_exceptions import CloudError from azure.mgmt.resource.resources.models import ResourceGroup except ImportError: pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase + def resource_group_to_dict(rg): return dict( @@ -266,4 +254,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/lib/ansible/modules/cloud/azure/azure_rm_resourcegroup_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_resourcegroup_facts.py index c9a4fb39884..6a2624f60ad 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_resourcegroup_facts.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_resourcegroup_facts.py @@ -3,21 +3,11 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', 'status': ['preview'], @@ -89,9 +79,6 @@ azure_resourcegroups: }] ''' -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * - try: from msrestazure.azure_exceptions import CloudError from azure.common import AzureMissingResourceHttpError, AzureHttpError @@ -99,6 +86,8 @@ except: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase + AZURE_OBJECT_CLASS = 'ResourceGroup' @@ -170,4 +159,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/lib/ansible/modules/cloud/azure/azure_rm_securitygroup.py b/lib/ansible/modules/cloud/azure/azure_rm_securitygroup.py index 1957aec0a8d..bec44ec9cc8 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_securitygroup.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_securitygroup.py @@ -3,21 +3,11 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', 'status': ['preview'], @@ -336,9 +326,6 @@ state: } ''' # NOQA -from ansible.module_utils.azure_rm_common import AzureRMModuleBase -from ansible.module_utils.six import integer_types - try: from msrestazure.azure_exceptions import CloudError from azure.common import AzureHttpError @@ -350,6 +337,9 @@ except ImportError: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase +from ansible.module_utils.six import integer_types + def validate_rule(rule, rule_type=None): ''' diff --git a/lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py index 4dee9df8b3d..58b45034075 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py @@ -3,21 +3,11 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', 'status': ['preview'], @@ -202,10 +192,6 @@ azure_securitygroups: ''' # NOQA - -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * - try: from msrestazure.azure_exceptions import CloudError from azure.common import AzureMissingResourceHttpError, AzureHttpError @@ -213,6 +199,8 @@ except: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase + AZURE_OBJECT_CLASS = 'NetworkSecurityGroup' @@ -289,4 +277,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/lib/ansible/modules/cloud/azure/azure_rm_storageaccount.py b/lib/ansible/modules/cloud/azure/azure_rm_storageaccount.py index a291ce39065..cbc9721a7bb 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_storageaccount.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_storageaccount.py @@ -3,21 +3,10 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', @@ -149,10 +138,6 @@ state: } ''' - -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * - try: from msrestazure.azure_exceptions import CloudError from azure.storage.cloudstorageaccount import CloudStorageAccount @@ -164,6 +149,7 @@ except ImportError: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AZURE_SUCCESS_STATE, AzureRMModuleBase class AzureRMStorageAccount(AzureRMModuleBase): diff --git a/lib/ansible/modules/cloud/azure/azure_rm_storageaccount_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_storageaccount_facts.py index 056ebc92644..aa4962eea8a 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_storageaccount_facts.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_storageaccount_facts.py @@ -2,22 +2,12 @@ # # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# + +# 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.0', 'status': ['preview'], @@ -105,12 +95,6 @@ azure_storageaccounts: }] ''' -AZURE_OBJECT_CLASS = 'StorageAccount' - - -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * - try: from msrestazure.azure_exceptions import CloudError from azure.common import AzureMissingResourceHttpError, AzureHttpError @@ -118,6 +102,11 @@ except: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase + + +AZURE_OBJECT_CLASS = 'StorageAccount' + class AzureRMStorageAccountFacts(AzureRMModuleBase): def __init__(self): @@ -203,5 +192,6 @@ class AzureRMStorageAccountFacts(AzureRMModuleBase): def main(): AzureRMStorageAccountFacts() + if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/azure/azure_rm_storageblob.py b/lib/ansible/modules/cloud/azure/azure_rm_storageblob.py index ad00a9a46d3..da5bb93d337 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_storageblob.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_storageblob.py @@ -3,21 +3,11 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', 'status': ['preview'], @@ -200,13 +190,8 @@ container: } ''' - import os -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * - - try: from azure.storage.blob.models import ContentSettings from azure.common import AzureMissingResourceHttpError, AzureHttpError @@ -214,6 +199,8 @@ except ImportError: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase + class AzureRMStorageBlob(AzureRMModuleBase): diff --git a/lib/ansible/modules/cloud/azure/azure_rm_subnet.py b/lib/ansible/modules/cloud/azure/azure_rm_subnet.py index 65dbe5c0473..a5bbaad2bb1 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_subnet.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_subnet.py @@ -3,21 +3,11 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', 'status': ['preview'], @@ -132,9 +122,7 @@ state: example: "Succeeded" ''' # NOQA - -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * +from ansible.module_utils.azure_rm_common import AzureRMModuleBase, CIDR_PATTERN, azure_id_to_dict try: from msrestazure.azure_exceptions import CloudError @@ -316,4 +304,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py index e8bc76f1677..650205673a0 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py @@ -3,21 +3,11 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', 'status': ['preview'], @@ -440,9 +430,7 @@ azure_vm: ''' # NOQA import random - -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * +import re try: from msrestazure.azure_exceptions import CloudError @@ -461,6 +449,9 @@ except ImportError: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict + + AZURE_OBJECT_CLASS = 'VirtualMachine' AZURE_ENUM_MODULES = ['azure.mgmt.compute.models.compute_management_client_enums'] @@ -1303,4 +1294,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachineimage_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachineimage_facts.py index 41b70bb35be..ef60d8fb181 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachineimage_facts.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachineimage_facts.py @@ -3,21 +3,10 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', @@ -112,9 +101,6 @@ azure_vmimages: example: [] ''' -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * - try: from msrestazure.azure_exceptions import CloudError from azure.common import AzureMissingResourceHttpError, AzureHttpError @@ -122,8 +108,12 @@ except: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase + + AZURE_ENUM_MODULES = ['azure.mgmt.compute.models.compute_management_client_enums'] + class AzureRMVirtualMachineImageFacts(AzureRMModuleBase): def __init__(self, **kwargs): @@ -241,4 +231,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork.py index 34ded2f0bf4..6f091c648ab 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork.py @@ -3,21 +3,10 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', @@ -138,10 +127,6 @@ state: } ''' - -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * - try: from msrestazure.azure_exceptions import CloudError from azure.mgmt.network.models import VirtualNetwork, AddressSpace, DhcpOptions @@ -149,6 +134,7 @@ except ImportError: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase, CIDR_PATTERN def virtual_network_to_dict(vnet): @@ -366,4 +352,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork_facts.py index 15ff28601f4..86af0d76b15 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork_facts.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork_facts.py @@ -3,21 +3,11 @@ # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, # -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# 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.0', 'status': ['preview'], @@ -100,9 +90,6 @@ azure_virtualnetworks: }] ''' -from ansible.module_utils.basic import * -from ansible.module_utils.azure_rm_common import * - try: from msrestazure.azure_exceptions import CloudError from azure.common import AzureMissingResourceHttpError, AzureHttpError @@ -110,6 +97,8 @@ except: # This is handled in azure_rm_common pass +from ansible.module_utils.azure_rm_common import AzureRMModuleBase + AZURE_OBJECT_CLASS = 'VirtualNetwork' @@ -195,4 +184,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/test/sanity/pep8/legacy-files.txt b/test/sanity/pep8/legacy-files.txt index 6261e069a8b..1fde43a4ae3 100644 --- a/test/sanity/pep8/legacy-files.txt +++ b/test/sanity/pep8/legacy-files.txt @@ -69,17 +69,12 @@ lib/ansible/modules/cloud/atomic/atomic_host.py lib/ansible/modules/cloud/atomic/atomic_image.py lib/ansible/modules/cloud/azure/azure_rm_deployment.py lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py -lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py lib/ansible/modules/cloud/azure/azure_rm_publicipaddress.py lib/ansible/modules/cloud/azure/azure_rm_publicipaddress_facts.py -lib/ansible/modules/cloud/azure/azure_rm_resourcegroup.py -lib/ansible/modules/cloud/azure/azure_rm_resourcegroup_facts.py -lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py lib/ansible/modules/cloud/azure/azure_rm_storageaccount.py lib/ansible/modules/cloud/azure/azure_rm_storageblob.py lib/ansible/modules/cloud/azure/azure_rm_subnet.py lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py -lib/ansible/modules/cloud/azure/azure_rm_virtualmachineimage_facts.py lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork.py lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork_facts.py lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py