summaryrefslogtreecommitdiffstats
path: root/lib/sunhpc/modules/kickstart/15-network.py
blob: 22e3ccab52c8acc3aeff1f3339df95b35626f38f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#coding:utf-8
import textwrap
class Modules(object):
    """
    Configure node networks.
    """
    def __init__(self, command):
        self.cmd = command

    @property
    def __help__(self):
        info = """
        #==============================================================
        # %s
        #
        # module_path: %s
        # module_name: %s
        #==============================================================
        """ % (self.__doc__.strip(), self.__module__.strip(), self.__repr__())
        return info
        
    def run(self, args):

        # network   --bootproto=static 
        #           --device=eth0 
        #           --gateway=192.168.199.1 
        #           --ip=192.168.199.155 
        #           --nameserver=192.168.199.1 
        #           --netmask=255.255.255.0 
        #           --ipv6=auto --activate
        #           --hostname=cluster

        network = []
        network.append(self.__help__)
        #network.append('network --bootproto=static --hostname=%s --activate' % args)
        network.append('network --hostname=%s' % args)
        self.cmd.ks.addMain(network)

    def __repr__(self):
        return "kickstart-network"