davidban77 / ansible-collection-gns3

Ansible Collection for GNS3 Server REST API using gns3fy
https://galaxy.ansible.com/davidban77/gns3
MIT License
38 stars 20 forks source link

Error when trying to creat nodes and projects #18

Open jrdunha opened 1 year ago

jrdunha commented 1 year ago

I can get server facts from my GNS3VM through ansible when I run my plays but when I try to run aplay to creat a new project I get a similar error to this. I get this error when I run a play to create a node on an existing project yet it still creates the node. I am lost on how to correct this error.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: requests.exceptions.HTTPError: 400: JSON schema error with API request '/v2/projects/1b47f47f-54f0-42ec-ac5f-f33ea23bd119/nodes/d8123552-b459-4e0a-aba2-3928c30c6015' and JSON data '{'name': 'Ethernet switch', 'compute_id': 'local', 'pydantic_initialised': True}': Additional properties are not allowed ('pydantic_initialised' was unexpected) fatal: [GNS]: FAILED! => {"changed": false, "msg": "400: JSON schema error with API request '/v2/projects/1b47f47f-54f0-42ec-ac5f-f33ea23bd119/nodes/d8123552-b459-4e0a-aba2-3928c30c6015' and JSON data '{'name': 'Ethernet switch', 'compute_id': 'local', 'pydantic_initialised': True}': Additional properties are not allowed ('pydantic_initialised' was unexpected)"}

davidwallis commented 1 year ago

install pydantic==1.9.2 and this will resolve your issue.

jrdunha commented 1 year ago

fatal: [GNS3_Net1]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 192.168.1.193 closed.\r\n", "module_stdout": "/usr/lib/python3/dist-packages/requests/init.py:89: RequestsDependencyWarning: urllib3 (1.26.14) or chardet (3.0.4) doesn't match a supported version!\r\n warnings.warn(\"urllib3 ({}) or chardet ({}) doesn't match a supported \"\r\nTraceback (most recent call last):\r\n File \"/usr/local/lib/python3.8/dist-packages/urllib3/connection.py\", line 174, in _new_conn\r\n conn = connection.create_connection(\r\n File \"/usr/local/lib/python3.8/dist-packages/urllib3/util/connection.py\", line 95, in create_connection\r\n raise err\r\n File \"/usr/local/lib/python3.8/dist-packages/urllib3/util/connection.py\", line 85, in create_connection\r\n sock.connect(sa)\r\nConnectionRefusedError: [Errno 111] Connection refused\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n File \"/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py\", line 703, in urlopen\r\n httplib_response = self._make_request(\r\n File \"/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py\", line 398, in _make_request\r\n conn.request(method, url, httplib_request_kw)\r\n File \"/usr/local/lib/python3.8/dist-packages/urllib3/connection.py\", line 239, in request\r\n super(HTTPConnection, self).request(method, url, body=body, headers=headers)\r\n File \"/usr/lib/python3.8/http/client.py\", line 1256, in request\r\n self._send_request(method, url, body, headers, encode_chunked)\r\n File \"/usr/lib/python3.8/http/client.py\", line 1302, in _send_request\r\n self.endheaders(body, encode_chunked=encode_chunked)\r\n File \"/usr/lib/python3.8/http/client.py\", line 1251, in endheaders\r\n self._send_output(message_body, encode_chunked=encode_chunked)\r\n File \"/usr/lib/python3.8/http/client.py\", line 1011, in _send_output\r\n self.send(msg)\r\n File \"/usr/lib/python3.8/http/client.py\", line 951, in send\r\n self.connect()\r\n File \"/usr/local/lib/python3.8/dist-packages/urllib3/connection.py\", line 205, in connect\r\n conn = self._new_conn()\r\n File \"/usr/local/lib/python3.8/dist-packages/urllib3/connection.py\", line 186, in _new_conn\r\n raise NewConnectionError(\r\nurllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fb1b053bd60>: Failed to establish a new connection: [Errno 111] Connection refused\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n File \"/usr/lib/python3/dist-packages/requests/adapters.py\", line 439, in send\r\n resp = conn.urlopen(\r\n File \"/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py\", line 787, in urlopen\r\n retries = retries.increment(\r\n File \"/usr/local/lib/python3.8/dist-packages/urllib3/util/retry.py\", line 592, in increment\r\n raise MaxRetryError(_pool, url, error or ResponseError(cause))\r\nurllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.193', port=3080): Max retries exceeded with url: /v2/projects (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb1b053bd60>: Failed to establish a new connection: [Errno 111] Connection refused'))\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n File \"/home/gns3/.ansible/tmp/ansible-tmp-1683813462.3382835-1666417-61832007969768/AnsiballZ_gns3_project.py\", line 107, in \r\n _ansiballz_main()\r\n File \"/home/gns3/.ansible/tmp/ansible-tmp-1683813462.3382835-1666417-61832007969768/AnsiballZ_gns3_project.py\", line 99, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/home/gns3/.ansible/tmp/ansible-tmp-1683813462.3382835-1666417-61832007969768/AnsiballZ_gns3_project.py\", line 47, in invoke_module\r\n runpy.run_module(mod_name='ansible_collections.davidban77.gns3.plugins.modules.gns3_project', init_globals=dict(_module_fqn='ansible_collections.davidban77.gns3.plugins.modules.gns3_project', _modlib_path=modlib_path),\r\n File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\r\n _run_code(code, mod_globals, init_globals,\r\n File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\r\n exec(code, run_globals)\r\n File \"/tmp/ansible_gns3_project_payload_mnrgvaxo/ansible_gns3_project_payload.zip/ansible_collections/davidban77/gns3/plugins/modules/gns3_project.py\", line 434, in \r\n File \"/tmp/ansible_gns3_project_payload_mnrgvaxo/ansible_gns3_project_payload.zip/ansible_collections/davidban77/gns3/plugins/modules/gns3_project.py\", line 406, in main\r\n File \"/home/gns3/.local/lib/python3.8/site-packages/gns3fy/gns3fy.py\", line 1264, in create\r\n _response = self.connector.http_call(\"post\", _url, json_data=data)\r\n File \"/home/gns3/.local/lib/python3.8/site-packages/gns3fy/gns3fy.py\", line 130, in http_call\r\n _response = getattr(self.session, method.lower())(\r\n File \"/usr/lib/python3/dist-packages/requests/sessions.py\", line 581, in post\r\n return self.request('POST', url, data=data, json=json, kwargs)\r\n File \"/usr/lib/python3/dist-packages/requests/sessions.py\", line 533, in request\r\n resp = self.send(prep, send_kwargs)\r\n File \"/usr/lib/python3/dist-packages/requests/sessions.py\", line 646, in send\r\n r = adapter.send(request, kwargs)\r\n File \"/usr/lib/python3/dist-packages/requests/adapters.py\", line 516, in send\r\n raise ConnectionError(e, request=request)\r\nrequests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.193', port=3080): Max retries exceeded with url: /v2/projects (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb1b053bd60>: Failed to establish a new connection: [Errno 111] Connection refused'))\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

This is currently my new error I tried installing the urllib3 and chardet version and it did not resolve the problem