application-research / ehi-proxmaas

Integrates Proxmox, MAAS and Technitium to provide one-touch deployment of many machines
MIT License
1 stars 1 forks source link

"Node with this Hostname already ex…" when running maas-poker.py #23

Closed PC-Admin closed 1 year ago

PC-Admin commented 1 year ago

This is another rare bug we sometimes see with Proxmaas:

TASK [Run custom MAAS poker to inject Proxmox BMC credentials and correct node name and commission the nodes] ****************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NoneType: None
fatal: [localhost]: FAILED! => {"changed": true, "msg": "non-zero return code", "rc": 1, "stderr": "Traceback (most recent call last):\n  File \"/home/pcadmin/.ansible/tmp/ansible-tmp-1685525220.6475751-1549851-39731284417382/maas_commission.py\", line 53, in <module>\n    machine.save()\n  File \"/home/pcadmin/.local/lib/python3.11/site-packages/maas/client/utils/maas_async.py\", line 43, in wrapper\n    result = eventloop.run_until_complete(result)\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.11/asyncio/base_events.py\", line 653, in run_until_complete\n    return future.result()\n           ^^^^^^^^^^^^^^^\n  File \"/home/pcadmin/.local/lib/python3.11/site-packages/maas/client/viscera/machines.py\", line 382, in save\n    await super(Machine, self).save()\n  File \"/home/pcadmin/.local/lib/python3.11/site-packages/maas/client/viscera/nodes.py\", line 165, in save\n    return await super().save()\n           ^^^^^^^^^^^^^^^^^^^^\n  File \"/home/pcadmin/.local/lib/python3.11/site-packages/maas/client/viscera/__init__.py\", line 473, in save\n    data = await self._handler.update(**update_data)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/pcadmin/.local/lib/python3.11/site-packages/maas/client/bones/__init__.py\", line 309, in __call__\n    response = await self.bind(**params).call(**data)\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/pcadmin/.local/lib/python3.11/site-packages/maas/client/bones/__init__.py\", line 480, in dispatch\n    raise CallError(request, response, content, self)\nmaas.client.bones.CallError: PUT https://maas.estuary.tech/MAAS/api/2.0/machines/yhby3m/ -> HTTP 400 Bad Request ({\"hostname\": [\"Node with this Hostname already ex…)\n", "stderr_lines": ["Traceback (most recent call last):", "  File \"/home/pcadmin/.ansible/tmp/ansible-tmp-1685525220.6475751-1549851-39731284417382/maas_commission.py\", line 53, in <module>", "    machine.save()", "  File \"/home/pcadmin/.local/lib/python3.11/site-packages/maas/client/utils/maas_async.py\", line 43, in wrapper", "    result = eventloop.run_until_complete(result)", "             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3.11/asyncio/base_events.py\", line 653, in run_until_complete", "    return future.result()", "           ^^^^^^^^^^^^^^^", "  File \"/home/pcadmin/.local/lib/python3.11/site-packages/maas/client/viscera/machines.py\", line 382, in save", "    await super(Machine, self).save()", "  File \"/home/pcadmin/.local/lib/python3.11/site-packages/maas/client/viscera/nodes.py\", line 165, in save", "    return await super().save()", "           ^^^^^^^^^^^^^^^^^^^^", "  File \"/home/pcadmin/.local/lib/python3.11/site-packages/maas/client/viscera/__init__.py\", line 473, in save", "    data = await self._handler.update(**update_data)", "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/home/pcadmin/.local/lib/python3.11/site-packages/maas/client/bones/__init__.py\", line 309, in __call__", "    response = await self.bind(**params).call(**data)", "               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/home/pcadmin/.local/lib/python3.11/site-packages/maas/client/bones/__init__.py\", line 480, in dispatch", "    raise CallError(request, response, content, self)", "maas.client.bones.CallError: PUT https://maas.estuary.tech/MAAS/api/2.0/machines/yhby3m/ -> HTTP 400 Bad Request ({\"hostname\": [\"Node with this Hostname already ex…)"], "stdout": "", "stdout_lines": []}

First time ever seeing this, curious about the specific cause or if any fix is possible.

Zorlin commented 1 year ago

This is exactly what it says on the tin - a node with that hostname exists in MAAS, so it can't set the hostname for a node you are trying to create to the correct node name. Not actually a bug; it's a result of a partially successful run (ie: a failed run)