juju / python-libjuju

Python library for the Juju API
Apache License 2.0
57 stars 93 forks source link

Failed to add machine from MAAS using machine's FQDN (known in MAAS) #1019

Closed gboutry closed 3 months ago

gboutry commented 5 months ago

Description

I'm failing to use model.add_machine to add a machine known to MAAS to a model hosted on controller connected to a MAAS cloud. (controller has been bootstrapped to the MAAS cloud even)

Error:

machine = await model.add_machine(spec="sb-n1.maas", series="jammy")
Traceback (most recent call last):
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "<console>", line 1, in <module>
  File "/snap/openstack/x69/lib/python3.10/site-packages/juju/model.py", line 1458, in add_machine
    raise ValueError("Error adding machine: %s" % error.message)
ValueError: Error adding machine: invalid model name "sb-n1.maas"

Urgency

Casually reporting

Python-libjuju version

3.2.0.0

Juju version

3.2.4

Reproduce / Test

from juju.controller import Controller

controller = Controller()
await controller.connect(
                endpoint=<endpoints>,
                cacert=<ca>,
                username=<user>,
                password=<password>,
            )
model = await controller.get_model("openstack-machines")
machine = await model.add_machine(spec="sb-n1.maas", series="jammy")
print("Machine created: {}".format(machine.entity_id))
gboutry commented 5 months ago

I have been able to workaround the bug using:

machine = await model.add_machine(spec=model.uuid+":sb-n1.maas", series="jammy")
github-actions[bot] commented 3 months ago

This issue is marked as incomplete because it has been open 30 days with no activity. Please remove incomplete label or comment or this will be closed in 5 days.

github-actions[bot] commented 3 months ago

This issue was closed because it has been stalled for 5 days with no activity.

gboutry commented 3 months ago

Looks like there's some sort of relation with this bug: https://bugs.launchpad.net/juju/+bug/2056501