Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azure_rm_virtualnetwork error 'APIVersion 2019-06-01 is not available' #156

Closed
Chaffelson opened this issue Jun 11, 2020 · 4 comments · Fixed by #157
Closed

azure_rm_virtualnetwork error 'APIVersion 2019-06-01 is not available' #156

Chaffelson opened this issue Jun 11, 2020 · 4 comments · Fixed by #157

Comments

@Chaffelson
Copy link
Contributor

SUMMARY

When using azure.azcollection.azure_rm_virtualnetwork it throws the error APIVersion 2019-06-01 is not available. Tested in published master and current dev

ISSUE TYPE
  • Bug Report
COMPONENT NAME

azure_rm_virtualnetwork

ANSIBLE VERSION
ansible 2.9.9
  config file = /Users/dchaffelson/PycharmProjects/fef0/ansible.cfg
  configured module search path = ['/Users/dchaffelson/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/dchaffelson/Projects/py3/fef0/lib/python3.7/site-packages/ansible
  executable location = /Users/dchaffelson/Projects/py3/fef0/bin/ansible
  python version = 3.7.7 (default, Mar 10 2020, 15:43:03) [Clang 11.0.0 (clang-1100.0.33.17)]
CONFIGURATION
DEFAULT_CALLBACK_WHITELIST(/Users/dchaffelson/PycharmProjects/fef0/ansible.cfg) = ['profile_tasks']
DEFAULT_JINJA2_NATIVE(/Users/dchaffelson/PycharmProjects/fef0/ansible.cfg) = True
OS / ENVIRONMENT

MacOX Catalina 10.15.5

STEPS TO REPRODUCE
azure.azcollection.azure_rm_virtualnetwork:  # Collection version broken in 2.9.9
            resource_group: "{{ _fef0_metagroup_name }}"
            location: "{{ fef0_az_region }}"
            name: "{{ _fef0_vpcvnet_name }}"
            state: "{{ _fef0_state }}"
            address_prefixes_cidr: "{{ [fef0_vpc_cidr] }}"
            purge_address_prefixes: yes
            purge_dns_servers: yes
            tags: "{{ _fef0_default_tags }}"
EXPECTED RESULTS

In this case, the vnet should be created, which works fine with the module version i.e. using
azure_rm_virtualnetwork instead of azure.azcollection.azure_rm_virtualnetwork

ACTUAL RESULTS
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NotImplementedError: APIVersion 2019-06-01 is not available
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/Users/dchaffelson/.ansible/tmp/ansible-tmp-1591905822.6336188-53169-51762604834540/AnsiballZ_azure_rm_virtualnetwork.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/Users/dchaffelson/.ansible/tmp/ansible-tmp-1591905822.6336188-53169-51762604834540/AnsiballZ_azure_rm_virtualnetwork.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/Users/dchaffelson/.ansible/tmp/ansible-tmp-1591905822.6336188-53169-51762604834540/AnsiballZ_azure_rm_virtualnetwork.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.azure.azcollection.plugins.modules.azure_rm_virtualnetwork', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File \"/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/var/folders/4d/rv2dcypn6v3cnlh8vg2prz2m0000gp/T/ansible_azure.azcollection.azure_rm_virtualnetwork_payload_3wdxo2vy/ansible_azure.azcollection.azure_rm_virtualnetwork_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_virtualnetwork.py\", line 394, in <module>\n  File \"/var/folders/4d/rv2dcypn6v3cnlh8vg2prz2m0000gp/T/ansible_azure.azcollection.azure_rm_virtualnetwork_payload_3wdxo2vy/ansible_azure.azcollection.azure_rm_virtualnetwork_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_virtualnetwork.py\", line 390, in main\n  File \"/var/folders/4d/rv2dcypn6v3cnlh8vg2prz2m0000gp/T/ansible_azure.azcollection.azure_rm_virtualnetwork_payload_3wdxo2vy/ansible_azure.azcollection.azure_rm_virtualnetwork_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_virtualnetwork.py\", line 245, in __init__\n  File \"/var/folders/4d/rv2dcypn6v3cnlh8vg2prz2m0000gp/T/ansible_azure.azcollection.azure_rm_virtualnetwork_payload_3wdxo2vy/ansible_azure.azcollection.azure_rm_virtualnetwork_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py\", line 418, in __init__\n  File \"/var/folders/4d/rv2dcypn6v3cnlh8vg2prz2m0000gp/T/ansible_azure.azcollection.azure_rm_virtualnetwork_payload_3wdxo2vy/ansible_azure.azcollection.azure_rm_virtualnetwork_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_virtualnetwork.py\", line 272, in exec_module\n  File \"/Users/dchaffelson/Projects/py3/fef0/lib/python3.7/site-packages/azure/mgmt/network/network_management_client.py\", line 2449, in virtual_networks\n    raise NotImplementedError(\"APIVersion {} is not available\".format(api_version))\nNotImplementedError: APIVersion 2019-06-01 is not available\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

@Chaffelson
Copy link
Contributor Author

And azure_rm_securitygroup.
I'm going to take a wild guess that all the network commands are broken.

@Chaffelson
Copy link
Contributor Author

The network_client in azure_rm_common requires it

    def network_client(self):
        self.log('Getting network client')
        if not self._network_client:
            self._network_client = self.get_mgmt_svc_client(NetworkManagementClient,
                                                            base_url=self._cloud_environment.endpoints.resource_manager,
                                                            api_version='2019-06-01')```

@Chaffelson
Copy link
Contributor Author

Looking through the azure_rm_common.py code, it appears that the latest default version for this client is '2018-08-01'

    'latest': {
        'ContainerInstanceManagementClient': '2018-02-01-preview',
        'ComputeManagementClient': dict(
            default_api_version='2018-10-01',
            resource_skus='2018-10-01',
            disks='2018-06-01',
            snapshots='2018-10-01',
            virtual_machine_run_commands='2018-10-01'
        ),
        'NetworkManagementClient': '2018-08-01',
        'ResourceManagementClient': '2017-05-10',
        'StorageManagementClient': '2017-10-01',
        'WebSiteManagementClient': '2018-02-01',
        'PostgreSQLManagementClient': '2017-12-01',
        'MySQLManagementClient': '2017-12-01',
        'MariaDBManagementClient': '2019-03-01',
        'ManagementLockClient': '2016-09-01'
    }}

@Fred-sun
Copy link
Collaborator

@Chaffelson Thank you for reporting this problem, this problem should be caused by your network API version library version is old. Can you upgrade azure-mgmt-network and try again?

   sudo pip3 install azure-mgmt-network==10.2.0 -I

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants