Revision 9ab91008 ganeti/hooks.py

b/ganeti/hooks.py
35 35
    """
36 36
    nics = {}
37 37

  
38
    key_to_attr = { 'IP': 'ip', 'MAC': 'mac', 'BRIDGE': 'link' }
39

  
38 40
    for env in environ.keys():
39 41
        if env.startswith("GANETI_INSTANCE_NIC"):
40 42
            s = env.replace("GANETI_INSTANCE_NIC", "").split('_', 1)
41
            if len(s) == 2 and s[0].isdigit() and s[1] in ('MAC', 'IP'):
43
            if len(s) == 2 and s[0].isdigit() and s[1] in ('MAC', 'IP', 'BRIDGE'):
42 44
                index = int(s[0])
43
                key = s[1].lower()
45
                key = key_to_attr[s[1]]
44 46

  
45 47
                if nics.has_key(index):
46 48
                    nics[index][key] = environ[env]

Also available in: Unified diff