python-libmaas icon indicating copy to clipboard operation
python-libmaas copied to clipboard

maas allocate --zone, ... not working

Open Exchizz opened this issue 5 years ago • 0 comments

Hi, I was about to implement --pool on maas allocate, when I discovered --zone, --disk, .. is not getting passed to the MAAS API. I've seen this using wireshark. --dry-run is however passed.

maas allocate --zone someZone

The command above does not get run with --zone someZone as a parameter to the MAAS API.

The bug seems to be around line 312 in flesh/machines.py

params = utils.remove_None(
    {
        "hostname": options.hostname,
        "architectures": options.arch,
        "cpus": options.cpus,
        "memory": options.memory,
        "fabrics": options.fabric,
        "interfaces": options.interface,
        "pod": options.pod,
        "pod_type": options.pod_type,
        "subnets": options.subnet,
        "tags": options.tag,
        "not_fabrics": options.not_fabric,
        "not_subnets": options.not_subnet,
        "not_zones": options.not_zone,
        "agent_name": options.agent_name,
        "comment": options.comment,
        "bridge_all": options.bridge_all,
        "bridge_stp": options.bridge_stp,
        "bridge_fd": options.bridge_fd,
        "dry_run": getattr(options, "dry_run", False),
    }
)

Optional arguments are not inserted into the list shown above. If I add the following line to the list

"zone": options.zone,

I can successfully allocate a node in a zone (verified we wireshark and mass regiond.log).

Am I using the CLI wrong or is it a bug optional parameters are not passed on to origin.Machines.allocate() (on line 337 in flesh/machines.py) ?

Thanks in advance

OF: What is the logic behind the naming of flesh, bones and viscera ?

Exchizz avatar Mar 18 '20 16:03 Exchizz