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

Salt-formula-maas improvments #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ebotzol
Copy link

@ebotzol ebotzol commented Sep 5, 2018

The request contains one improvement for maas salt formula:

  1. Allow to configure multiple mac addresses in the machine definitions.

MAAS allow specifying multiple pxe mac addresses for a machine during
machine creation. This commit makes it possible to specify the mac
addresses that the server may use during pxe boot as a list in the
pillar data.
To be able to pass multiple mac addresses via the API, the way of
creating the multipart message in the REST POST call had to be changed
too. The old logic took key-value pairs assuming the value is scalar.
This commit changes this logic to accept list values and in that case
create multiple message parts with the same name.
Due to alowing multiple mac addresses, the logic in the machine update
had to be changed too. The old logic checked if the new single mac
address is among the mac addresses that the host has. The new logic
checks if there is intersection between the new mac addresses and the
ones the machine has. If intersection found, that is used as new mac
addresses, and forces recreation of the machine only if no intersection
is found.

Change-Id: I9f0bb5d1654f638ad5c09ce355699c2eb37f3404
_modules/maas.py Outdated
data = {
'name': name,
'name': fabric_name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is outdated module part. Please use new one :
https://github.com/salt-formulas/salt-formula-maas/blob/master/_modules/maasng.py#L960

Which calls' from
https://github.com/salt-formulas/salt-formula-maas/blob/master/_states/maasng.py#L584
<
https://github.com/salt-formulas/salt-formula-maas/blob/master/maas/region.sls#L299-L310
where such logic already exist

  {%- for _, fabric in region.fabrics.iteritems() %}
  {% set fabric_name=fabric.get('name', _) %}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,
thank you for the review.
I've dropped the "name attribute" commit, because as you mentioned the logic is already placed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants