#!/usr/bin/python
import subprocess
import json
nodes = json.loads(subprocess.check_output(['maas', 'churel', 'nodes', 'list']))
for node in nodes:
system_id = str(node['system_id'])
interfaces = json.loads(subprocess.check_output(['maas', 'churel', 'interfaces', 'read', system_id]))
for interface in interfaces:
name = str(interface['name'])
interface = str(interface['id'])
print("Setting mtu for interface %s on system %s" % (name, system_id))
subprocess.check_call(['maas', 'churel', 'interface', 'update', system_id, interface, 'mtu=9000'])