Coder Social home page Coder Social logo

Comments (20)

mark100net avatar mark100net commented on August 28, 2024 1

@Fred-sun I am going to close this issue because clearly the problem relates to my setup. But if you have any further suggestions please let me know.

When I deleted the 'network' folder as you instructed and then ran the azure-mgmt-network install it did not install it to the location under my home directory. It installed it to /usr/local/lib/python3.7, and the playbook failed because it was still looking for the azure-mgmt-network under my home directory.

Then I removed ~/Library/Python altogether and the problem went away.

Clearly this applies to me:

https://xkcd.com/1987/

:(

Thanks again for all your time and help with this.

from azure.

Fred-sun avatar Fred-sun commented on August 28, 2024

@mark100net I'm glad you are interested in ansilbe-collections. I tested your playbook and it was successful. The test results are as follows:

TASK [create resource group] ****************************************************************************************************************************************************ok: [localhost]

TASK [Create virtual network] ***************************************************************************************************************************************************changed: [localhost]

TASK [debug] ********************************************************************************************************************************************************************ok: [localhost] => {
    "output": {
        "changed": true,
        "check_mode": false,
        "failed": false,
        "state": {
            "address_prefixes": [
                "10.0.0.0/16"
            ],
            "etag": "W/\"24d39e33-4824-43b4-b7a0-d71c22fe7714\"",
            "id": "/subscriptions/xxxxxxxxxxxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/virtualNetworks/fredvnet003",
            "location": "eastus",
            "name": "fredvnet003",
            "provisioning_state": "Succeeded",
            "tags": null,
            "type": "Microsoft.Network/virtualNetworks"
        }
    }
}

PLAY RECAP **********************************************************************************************************************************************************************localhost                  : ok=4    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

from azure.

Fred-sun avatar Fred-sun commented on August 28, 2024

@mark100net I suspect that your ansible and ansible-collection refer to azure-mgmt-network differently. Can you help confirm this? Thank you very much!
ansible-collection: /usr/local/lib/python3.7/site-packages/azure/mgmt/network/network_management_client.py
ansible: ?

from azure.

mark100net avatar mark100net commented on August 28, 2024

@Fred-sun Thanks for trying to reproduce my issue.

I am not completely sure what you are asking. I do have network_management_client.py in the location you specified.

My azcollection is in ~/.ansible/collections/ansible_collections/azure/azcollection

My ansible --version output is (sorry, I should have put that in the original issue):

 config file = None
 configured module search path = ['/Users/mark/.ansible/plugins/modules',        '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.7 (default, Apr 25 2020, 11:17:28) [Clang 11.0.3 (clang-1103.0.32.29)]

If that does not answer your question please let me know what I need to do to answer your question.

Thanks again.

from azure.

Fred-sun avatar Fred-sun commented on August 28, 2024

@mark100net Can you do such a verification, edit "/usr/local/lib/python3.7/site-packages/ansible/module_utils/azure_rm_common.py". Then test with default tasks and share the fail log to me! Thank you very much!

    @property
    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-07-01')
        return self._network_client

    @property
    def network_models(self):
        self.log("Getting network models...")
        return NetworkManagementClient.models("2018-09-01")

from azure.

mark100net avatar mark100net commented on August 28, 2024

Hello @Fred-sun , thanks for getting back to me.

I was not sure what you meant by "default tasks". But I made the edits you suggested and ran the playbook with the tasks above and got this fail log:

ansible-azure.txt

from azure.

Fred-sun avatar Fred-sun commented on August 28, 2024

@mark100net Sorry for misunderstand to you. default tasks from the cloud/ansible module. Thank you very much!

from azure.

mark100net avatar mark100net commented on August 28, 2024

@Fred-sun I did (also) run the task as the default (i.e. as azure_rm_virtualnetwork without the collection qualifier). I do not get a failure that way (with or without the edits you gave me). In case it helps, here is the output when I run it with the default with the edits:

azure.txt

from azure.

Fred-sun avatar Fred-sun commented on August 28, 2024

@mark100net Thank you very much for your feedback. First of all, you should definitely report an error after changing the API version, because the network API does not have these two versions. So your two task executions use different APIs. Second , that I have encountered such a similar problem, ansible and ansible-collection use azure-mgmt-network in different locations. Could you help remove ansible and ansible-collection and reinstall to retry? Thank you very much!

from azure.

mark100net avatar mark100net commented on August 28, 2024

@Fred-sun I'm sorry, I realized the file you told me to modify was not properly saved and I was running against the original. I made the edits again and actually am getting a failure log (using the default tasks), attached below, so I hope this helps:

azure.txt

Thanks again.

from azure.

Fred-sun avatar Fred-sun commented on August 28, 2024

@mark100net Thanks for your feedback! I see!

from azure.

mark100net avatar mark100net commented on August 28, 2024

@Fred-sun Do you have any other suggestions then?

from azure.

Fred-sun avatar Fred-sun commented on August 28, 2024

@Fred-sun Do you have any other suggestions then?

As you can see from your log, ansible and ansible-collections use the same network_management_client.py, the two test results should be the same, and you should not go wrong here. I am still thinking about how to clarify, thank you!

from azure.

Fred-sun avatar Fred-sun commented on August 28, 2024

@mark100net Please delete β€œ/usr/local/lib/python3.7/site-packages/azure/mgmt/network/”, reinstall azure-mgmt-network and try again, thank you!

sudo pip3 install azure-mgmt-network -I

from azure.

mark100net avatar mark100net commented on August 28, 2024

@Fred-sun Thanks for the suggestion. I was able to get past the original error after doing your suggestion, but I got another error later on in my playbook when creating a virtual network. I will get you the details on that at a later date.

In the meantime, did you want me to do that with or without the edits to the azure_rm_common.py file you gave me before? I get errors either way but the error is different depending on which one.

Thanks again.

from azure.

Fred-sun avatar Fred-sun commented on August 28, 2024

without the edits to the azure_rm_common.py

@mark100net Without the edits to the azure_rm_common.py, Thank you very much!

from azure.

mark100net avatar mark100net commented on August 28, 2024

@Fred-sun After deleting the network directory and reinstalling azure-mgmt-network and running with the original azure_rm_common.py as you suggested I am still getting the same error as originally reported with the azure.azcollection.azure_rm_vurtualnetwork task. Output below:

azure.txt

Thanks again.

from azure.

Fred-sun avatar Fred-sun commented on August 28, 2024

@mark100net Please help provide "pip3 list |grep azure-mgmt-network" information and send me these two files. Thank you!

/Users/mark/Library/Python/3.7/lib/python/site-packages/azure/mgmt/network/network_management_client.py
/Users/mark/Library/Python/3.7/lib/python/site-packages/azure/mgmt/network/_network_management_client.py

from azure.

mark100net avatar mark100net commented on August 28, 2024

@Fred-sun here you go:

> pip3 list | grep azure-mgmt-network
azure-mgmt-network             2.3.0

I do not have a _network_management_client.py in that directory. I have network_management_client.pay included below (with .txt extension added to I could upload it here):

network_management_client.py.txt

Thanks

from azure.

Fred-sun avatar Fred-sun commented on August 28, 2024

@mark100net You are using an old version of azure-mgmt-network, please delete ”/Users/mark/Library/Python/3.7/lib/python/site-packages/azure/mgmt/networkβ€œ folder and reinstall azure-mgmt-network (sudo pip3 install azure-mgmt-network==10.1.0 -I). Thank you!

from azure.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.