Ubuntu Pastebin

Paste from ubuntu at Mon, 8 Feb 2016 16:03:17 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#!/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'])
Download as text