Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot pass multiple mac addresses when adding a machine #83

Closed
gnuoy opened this issue Jul 2, 2024 · 0 comments · Fixed by #92
Closed

Cannot pass multiple mac addresses when adding a machine #83

gnuoy opened this issue Jul 2, 2024 · 0 comments · Fixed by #92
Assignees
Labels
bug Something isn't working triaged Triaged to be addressed in a given cycle

Comments

@gnuoy
Copy link
Contributor

gnuoy commented Jul 2, 2024

Maas supports specifying multiple mac addresses when manually adding a machine "... To specify more than one MAC address, the
parameter must be specified twice."
*1. However, there seems to be no way to do this with via the gomaasclient. "PXEMacAddress" is a string type and is passed verbatum in the request.

It can be worked around using the deprecated api client by calling qsp.Add("mac_addresses", mac) for each mac address to be added. Something like:

     	qsp, err := query.Values(machineParams)
	if err != nil {
		return nil, err
	}
	qsp.Add("mac_addresses", mac1)
	qsp.Add("mac_addresses", mac2)
	machineAPI := apiClient.GetSubObject("machines")
	err = apiClient.Post("", qsp, func(data []byte) error {
		return json.Unmarshal(data, machine)
	})

*1 https://github.com/canonical/maas/blob/master/src/maasserver/api/machines.py#L1847
*2 https://github.com/canonical/gomaasclient/blob/master/entity/machine.go#L215

@troyanov troyanov added bug Something isn't working triaged Triaged to be addressed in a given cycle labels Jul 2, 2024
@skatsaounis skatsaounis linked a pull request Aug 2, 2024 that will close this issue
@skatsaounis skatsaounis self-assigned this Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged Triaged to be addressed in a given cycle
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants