ansible-collections / azure

Development area for Azure Collections
https://galaxy.ansible.com/azure/azcollection
GNU General Public License v3.0
245 stars 327 forks source link

"msg": "Error retrieving resource group myrg - __init__() got an unexpected keyword argument 'credential' #1230

Closed venkateshm2012 closed 11 months ago

venkateshm2012 commented 1 year ago
SUMMARY

Unable to use azure_rm_networkinterface module to make update a existing network interface's ip configurations

ISSUE TYPE
COMPONENT NAME

Module- azure_rm_networkinterface plugin - NetworkManagementClient Class (https://learn.microsoft.com/en-us/python/api/azure-mgmt-network/azure.mgmt.network.networkmanagementclient?view=azure-python ) others - azure_rm_common.py

ANSIBLE VERSION

"ansible [core 2.12.5.post0]\n config file = None\n configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']\n ansible python module location = /usr/local/lib/python3.8/site-packages/ansible\n ansible collection location = /runner/requirements_collections:/home/runner/.ansible/collections:/usr/share/ansible/collections\n executable location = /usr/local/bin/ansible\n python version = 3.8.16 (default, Jan 17 2023, 18:50:05) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)]\n jinja version = 2.11.3\n libyaml = True"


##### COLLECTION VERSION
<!--- Paste verbatim output from "ansible-galaxy collection list <namespace>.<collection>"  between the quotes
for example: community.general:7.2.0 
-->
[```paste below]
(azure.azcollection:1.16.0)
CONFIGURATION
N/A
OS / ENVIRONMENT

Centos Version 8

STEPS TO REPRODUCE

try to run a playbook using azure_rm_networkinterface module to do some simple task, adding a nic or updating a ipconfiguration of the existing nic

- name: Get NIC details by IP
  hosts: localhost
  gather_facts: false

    - name: Add new secondary IP configuration
      ansible.builtin.azure_rm_networkinterface:
        resource_group: my_rg
        name: nic_name
        virtual_network: vnet1
        subnet_name: sn1
        ip_configurations:
          - name: test1
            private_ip_address: '192.168.44.166'
            private_ip_allocation_method: Dynamic
            primary: false
            load_balancer_backend_address_pools: null
            public_ip_address: null
            public_ip_allocation_method: null
            application_security_groups: null 
            application_gateway_backend_address_pools: null    
        state: present
EXPECTED RESULTS

update the ipconfiguration of the nic1 with the new secondary interface.

ACTUAL RESULTS

  File "/tmp/ansible_azure_rm_networkinterface_payload_a17e2n3y/ansible_azure_rm_networkinterface_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py", line 596, in get_resource_group

    return self.rm_client.resource_groups.get(resource_group)

  File "/tmp/ansible_azure_rm_networkinterface_payload_a17e2n3y/ansible_azure_rm_networkinterface_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py", line 1102, in rm_client

    self._resource_client = self.get_mgmt_svc_client(ResourceManagementClient,

  File "/tmp/ansible_azure_rm_networkinterface_payload_a17e2n3y/ansible_azure_rm_networkinterface_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py", line 950, in get_mgmt_svc_client

    client = client_type(**client_kwargs)

fatal: [localhost]: FAILED! => {

    "changed": false,

    "invocation": {

        "module_args": {

            "ad_user": null,

            "adfs_authority_url": null,

            "api_profile": "latest",

            "append_tags": true,

            "auth_source": "auto",

            "cert_validation_mode": null,

            "client_id": null,

            "cloud_environment": "AzureCloud",

            "create_with_security_group": true,

            "dns_servers": null,

            "enable_accelerated_networking": false,

            "enable_ip_forwarding": false,

            "ip_configurations": null,

            "location": null,

            "log_mode": null,

            "log_path": null,

            "name": "nic1",

            "open_ports": null,

            "os_type": "Linux",

            "password": null,

            "private_ip_address": null,

            "private_ip_allocation_method": "Dynamic",

            "profile": null,

   "msg": "Error retrieving resource group myrg - __init__() got an unexpected keyword argument 'credential'"
<img width="816" alt="Screenshot 2023-08-01 at 10 44 19 AM" src="https://github.com/ansible-collections/azure/assets/74171842/21f92774-7546-460f-b869-9d6e56d9faf2">
Fred-sun commented 1 year ago

@venkateshm2012 According to your error, the dependency file you installed is too old, can you share the information of "pip3 list"? Thank you!

venkateshm2012 commented 1 year ago

Hello @Fred-sun :

       "Package                            Version",        "---------------------------------- -------------------------",        "adal                               1.2.7",        "ansible-core                       2.12.5.post0",        "ansible-runner                     2.3.1",        "ansible-sign                       0.1.1.post1.dev1+gc25f0bb",        "appdirs                            1.4.4",        "applicationinsights                0.11.10",        "argcomplete                        1.12.3",        "asn1crypto                         1.2.0",        "attrs                              23.1.0",        "autopage                           0.5.1",        "awxkit                             21.10.2",        "azure-cli-core                     2.34.0",        "azure-cli-telemetry                1.0.6",        "azure-common                       1.1.11",        "azure-containerregistry            1.0.0",        "azure-core                         1.26.2",        "azure-graphrbac                    0.61.1",        "azure-identity                     1.7.0",        "azure-keyvault                     1.1.0",        "azure-mgmt-apimanagement           0.2.0",        "azure-mgmt-authorization           2.0.0",        "azure-mgmt-automation              1.0.0",        "azure-mgmt-batch                   5.0.1",        "azure-mgmt-cdn                     11.0.0",        "azure-mgmt-compute                 26.1.0",        "azure-mgmt-containerinstance       9.0.0",        "azure-mgmt-containerregistry       9.1.0",        "azure-mgmt-containerservice        20.0.0",        "azure-mgmt-core                    1.3.0",        "azure-mgmt-cosmosdb                6.4.0",        "azure-mgmt-datafactory             2.0.0",        "azure-mgmt-datalake-store          1.0.0",        "azure-mgmt-devtestlabs             3.0.0",        "azure-mgmt-dns                     8.0.0",        "azure-mgmt-eventhub                10.1.0",        "azure-mgmt-hdinsight               9.0.0",        "azure-mgmt-iothub                  2.2.0",        "azure-mgmt-keyvault                10.0.0",        "azure-mgmt-loganalytics            12.0.0",        "azure-mgmt-managedservices         6.0.0",        "azure-mgmt-managementgroups        0.2.0",        "azure-mgmt-marketplaceordering     0.1.0",        "azure-mgmt-monitor                 3.0.0",        "azure-mgmt-network                 19.1.0",        "azure-mgmt-notificationhubs        7.0.0",        "azure-mgmt-nspkg                   2.0.0",        "azure-mgmt-privatedns              1.0.0",        "azure-mgmt-rdbms                   10.0.0",        "azure-mgmt-recoveryservices        2.0.0",        "azure-mgmt-recoveryservicesbackup  3.0.0",        "azure-mgmt-redis                   13.0.0",        "azure-mgmt-resource                10.2.0",        "azure-mgmt-search                  8.0.0",        "azure-mgmt-servicebus              7.1.0",        "azure-mgmt-sql                     3.0.1",        "azure-mgmt-storage                 19.0.0",        "azure-mgmt-trafficmanager          1.0.0b1",        "azure-mgmt-web                     6.1.0",        "azure-nspkg                        2.0.0",        "azure-storage-blob                 12.11.0",        "Babel                              2.7.0",        "bcrypt                             3.2.0",        "boto3                              1.26.54",        "botocore                           1.29.54",        "cachetools                         5.3.0",        "certifi                            2022.12.7",        "cffi                               1.13.2",        "chardet                            3.0.4",        "charset-normalizer                 2.0.12",        "cliff                              4.3.0",        "cmd2                               2.4.3",        "cryptography                       36.0.0",        "debtcollector                      2.5.0",        "decorator                          5.1.1",        "distlib                            0.3.6",        "docutils                           0.18.1",        "dogpile.cache                      1.1.8",        "dumb-init                          1.2.5.post1",        "google-api-core                    2.11.0",        "google-auth                        2.16.0",        "google-cloud-core                  2.3.2",        "google-cloud-storage               2.7.0",        "google-crc32c                      1.5.0",        "google-resumable-media             2.4.1",        "googleapis-common-protos           1.58.0",        "gssapi                             1.7.3",        "humanfriendly                      10.0",        "idna                               2.8",        "importlib-metadata                 6.8.0",        "ipaddress                          1.0.23",        "iso8601                            1.1.0",        "isodate                            0.6.1",        "Jinja2                             2.11.3",        "jmespath                           1.0.1",        "jsonpatch                          1.32",        "jsonpointer                        2.3",        "keystoneauth1                      5.1.1",        "knack                              0.9.0",        "krb5                               0.3.0",        "kubernetes                         25.3.0",        "lockfile                           0.12.2",        "lxml                               4.4.1",        "MarkupSafe                         1.1.1",        "msal                               1.20.0",        "msal-extensions                    0.3.1",        "msgpack                            1.0.5",        "msrest                             0.7.1",        "msrestazure                        0.6.4",        "munch                              2.5.0",        "ncclient                           0.6.13",        "netaddr                            0.8.0",        "netifaces                          0.11.0",        "nsx-policy-python-sdk              4.1.0.1.0",        "nsx-python-sdk                     4.1.0.1.0",        "nsx-vmc-aws-integration-python-sdk 4.1.0.1.0",        "nsx-vmc-policy-python-sdk          4.1.0.1.0",        "ntlm-auth                          1.5.0",        "oauthlib                           3.2.2",        "openstacksdk                       0.61.0",        "os-client-config                   2.1.0",        "os-service-types                   1.7.0",        "osc-lib                            2.8.0",        "oslo.config                        9.1.1",        "oslo.context                       5.1.1",        "oslo.i18n                          6.0.0",        "oslo.log                           5.2.0",        "oslo.serialization                 5.1.1",        "oslo.utils                         6.2.0",        "ovirt-engine-sdk-python            4.5.2",        "ovirt-imageio                      2.4.7",        "packaging                          21.3",        "paramiko                           2.10.4",        "pbr                                5.11.1",        "pexpect                            4.8.0",        "pip                                22.0.4",        "pkginfo                            1.9.6",        "ply                                3.11",        "portalocker                        1.7.1",        "prettytable                        3.8.0",        "protobuf                           4.21.12",        "psutil                             5.9.4",        "ptyprocess                         0.7.0",        "pyasn1                             0.4.8",        "pyasn1-modules                     0.2.8",        "pycparser                          2.19",        "pycurl                             7.45.2",        "Pygments                           2.14.0",        "pyinotify                          0.9.6",        "PyJWT                              2.6.0",        "pykerberos                         1.2.4",        "PyNaCl                             1.5.0",        "pyOpenSSL                          22.0.0",        "pyparsing                          3.0.8",        "pyperclip                          1.8.2",        "pypsrp                             0.8.1",        "PySocks                            1.7.1",        "pyspnego                           0.5.2",        "python-cinderclient                9.3.0",        "python-daemon                      2.3.0",        "python-dateutil                    2.8.2",        "python-gnupg                       0.5.0",        "python-keystoneclient              5.1.0",        "python-manilaclient                4.4.0",        "python-neutronclient               9.0.0",        "python-novaclient                  18.3.0",        "python-openstackclient             6.0.0",        "python3-ldap                       0.9.8.4",        "pytz                               2019.3",        "pyvmomi                            7.0.3",        "pywinrm                            0.4.3",        "PyYAML                             5.4.1",        "requests                           2.27.1",        "requests-credssp                   2.0.0",        "requests-ntlm                      1.1.0",        "requests-oauthlib                  1.3.1",        "requestsexceptions                 1.4.0",        "resolvelib                         0.5.4",        "rfc3986                            2.0.0",        "rsa                                4.9",        "s3transfer                         0.6.0",        "setuptools                         62.0.0",        "simplejson                         3.19.1",        "six                                1.12.0",        "stevedore                          4.1.1",        "tabulate                           0.9.0",        "toml                               0.10.2",        "typing_extensions                  4.4.0",        "tzdata                             2023.3",        "urllib3                            1.25.7",        "vapi-client-bindings               4.0.0",        "vapi-common-client                 2.40.0",        "vapi-runtime                       2.40.0",        "vcenter-bindings                   4.1.0",        "vmc-client-bindings                1.62.0",        "vmc-draas-client-bindings          1.21.0",        "vsphere-automation-sdk             1.82.0",        "wcwidth                            0.2.6",        "websocket-client                   1.4.2",        "wrapt                              1.15.0",        "xmltodict                          0.12.0",        "zipp                               3.16.0"    ]

Fred-sun commented 1 year ago

@venkateshm2012 Can you upgrade the azure-mgmt-resource version to azure-mgmt-resource==21.1.0 and try again? It is recommended that you overwrite and install the latest Requirements-aze.txt dependency file. Thank you!

Fred-sun commented 1 year ago

@venkateshm2012 Any feedback on this?

venkateshm2012 commented 1 year ago

Hello, @Fred-sun : sorry for the delay. this will take some time, i will update you once the pip is updated. thanks a lot for the quick help.

venkateshm2012 commented 11 months ago

Hello, @Fred-sun : Issue Resolved after Upgrading the Pip3 Package. thanks a lot