Convert fabric MTU to string for API call
Change-Id: I8cda30d1f26624533d6adda02158d605bf1e76e8
diff --git a/_modules/maasng.py b/_modules/maasng.py
index a96a4e4..c08d5db 100644
--- a/_modules/maasng.py
+++ b/_modules/maasng.py
@@ -1095,10 +1095,11 @@
data = {
"name": name,
"dhcp_on": str(dhcp_on),
- "mtu": mtu,
"description": description,
"primary_rack": list_racks()[primary_rack]['system_id'],
}
+ if mtu:
+ data['mtu'] = str(mtu)
vlan = str(vlan)
maas = _create_maas_client()
fabric_id = get_fabricid(fabric)
diff --git a/_states/maasng.py b/_states/maasng.py
index c574f22..b71c9d9 100644
--- a/_states/maasng.py
+++ b/_states/maasng.py
@@ -365,7 +365,7 @@
description=description,
primary_rack=primary_rack,
dhcp_on=dhcp_on)
- ret['comment'] = 'Vlan {0} has' \
+ ret['comment'] = 'Vlan {0} has ' \
'been created for {1}'.format(name, fabric)
elif _rez == 'update':
_id = __salt__['maasng.list_vlans'](fabric)[vlan]['id']
@@ -378,7 +378,7 @@
dhcp_on=dhcp_on,
update=True,
vlan_id=_id)
- ret['comment'] = 'Vlan {0} has been' \
+ ret['comment'] = 'Vlan {0} has been ' \
'updated for {1}'.format(name, fabric)
ret['changes'] = changes
diff --git a/maas/region.sls b/maas/region.sls
index 04e2a1b..684fda4 100644
--- a/maas/region.sls
+++ b/maas/region.sls
@@ -314,7 +314,7 @@
maas_vlan{{ vlan_n }}_present_for_{{ fabric_name }}:
maasng.vlan_present_in_fabric:
- vlan: {{ vlan_n }}
- - mtu: {{ data.get('mtu','') }}
+ - mtu: {{ data.get('mtu', '') }}
- fabric: {{ fabric_name }}
- name: {{ data.get('name','') }}
- description: {{ data.description }}
@@ -362,7 +362,7 @@
maas_vlan{{ vlan_n }}_present_for_{{ fabric_name }}_dhcp:
maasng.vlan_present_in_fabric:
- vlan: {{ vlan_n }}
- - mtu: {{ data.get('mtu','') }}
+ - mtu: {{ data.get('mtu', '') }}
- fabric: {{ fabric_name }}
- name: {{ data.get('name','') }}
- description: {{ data.description }}