Skip to content

Commit

Permalink
add primary_rack param for maasng.update_vlan
Browse files Browse the repository at this point in the history
Change-Id: Ibde5d729cf4da6acd8e22f41aaaf28574a104d4e
  • Loading branch information
LotharKAtt committed May 25, 2018
1 parent 0052f1a commit 864a329
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion _modules/maasng.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ def get_fabric(fabric):
return {"error": "Frabic not found on MaaS server"}


def update_vlan(name, fabric, vid, description, dhcp_on=False):
def update_vlan(name, fabric, vid, description, primary_rack, dhcp_on=False):
'''
Update vlan
Expand All @@ -886,6 +886,7 @@ def update_vlan(name, fabric, vid, description, dhcp_on=False):
"name": name,
"dhcp_on": str(dhcp_on),
"description": description,
"primary_rack": primary_rack,
}
maas = _create_maas_client()
fabric_id = get_fabric(fabric)
Expand Down
5 changes: 3 additions & 2 deletions _states/maasng.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,15 @@ def select_boot_disk(hostname, name):
return ret


def update_vlan(name, fabric, vid, description, dhcp_on=False):
def update_vlan(name, fabric, vid, description, primary_rack, dhcp_on=False):
'''
:param name: Name of vlan
:param fabric: Name of fabric
:param vid: Vlan id
:param description: Description of vlan
:param dhcp_on: State of dhcp
:param primary_rack: primary_rack
'''

Expand All @@ -342,7 +343,7 @@ def update_vlan(name, fabric, vid, description, dhcp_on=False):
'comment': 'Module function maasng.update_vlan executed'}

ret["changes"] = __salt__['maasng.update_vlan'](
name=name, fabric=fabric, vid=vid, description=description, dhcp_on=dhcp_on)
name=name, fabric=fabric, vid=vid, description=description, primary_rack=primary_rack, dhcp_on=dhcp_on)

if "error" in fabric:
ret['comment'] = "State execution failed for fabric {0}".format(fabric)
Expand Down
1 change: 1 addition & 0 deletions maas/region.sls
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ maas_update_vlan_for_{{ fabric_name }}_{{ vid }}:
- fabric: {{ fabric_name }}
- name: {{ vlan.get('name','') }}
- description: {{ vlan.description }}
- primary_rack: {{ region.maas_config.maas_name }}
- dhcp_on: {{ vlan.get('dhcp','False') }}
{%- endfor %}
{%- endfor %}
Expand Down

0 comments on commit 864a329

Please sign in to comment.