示例#1
0
文件: test_net.py 项目: Nemie/syco
 def test_general(self):
     self.assertEqual(net.get_all_interfaces(), {'sit0': None, 'lo': '127.0.0.1', 'eth0': '10.100.100.231'})
     self.assertEqual(net.get_interface_ip("eth0"), "10.100.100.231")
     self.assertEqual(net.get_lan_ip(), "10.100.100.231")
     self.assertEqual(net.reverse_ip("1.2.3.4"), "4.3.2.1")
     self.assertEqual(net.get_ip_class_c("1.2.3.4"), "1.2.3")
     self.assertEqual(net.num_of_eth_interfaces(), 1)
     self.assertEqual(net.get_hostname(), "fo-tp-dalitst")
示例#2
0
 def test_general(self):
     self.assertEqual(net.get_all_interfaces(), {
         'sit0': None,
         'lo': '127.0.0.1',
         'eth0': '10.100.100.231'
     })
     self.assertEqual(net.get_interface_ip("eth0"), "10.100.100.231")
     self.assertEqual(net.get_lan_ip(), "10.100.100.231")
     self.assertEqual(net.reverse_ip("1.2.3.4"), "4.3.2.1")
     self.assertEqual(net.get_ip_class_c("1.2.3.4"), "1.2.3")
     self.assertEqual(net.num_of_eth_interfaces(), 1)
     self.assertEqual(net.get_hostname(), "fo-tp-dalitst")
  def init_host_options_from_config(self):
    '''
    Initialize all used options from install.cfg.

    If the options are invalid, app and config will throw exceptions,
    that will be forwarded to the starter app.

    '''
    # The ip connected to the admin net, from which the nfs
    # export is done.
    self.kvm_host_back_ip = net.get_lan_ip()

    self.ram = str(config.host(self.hostname).get_ram())
    self.cpu = str(config.host(self.hostname).get_cpu())

    self.set_kickstart_options()
示例#4
0
    def init_host_options_from_config(self):
        '''
    Initialize all used options from install.cfg.

    If the options are invalid, app and config will throw exceptions,
    that will be forwarded to the starter app.

    '''
        # The ip connected to the admin net, from which the nfs
        # export is done.
        self.kvm_host_back_ip = net.get_lan_ip()

        self.ram = str(config.host(self.hostname).get_ram())
        self.cpu = str(config.host(self.hostname).get_cpu())

        self.set_kickstart_options()
示例#5
0
def install_dhcp(args):
    '''
    Install a dhcp server on the current server.

    '''
    app.print_verbose("Install DHCP-Server version: %d" % SCRIPT_VERSION)
    version_obj = version.Version("InstallDHCPServer", SCRIPT_VERSION)
    version_obj.check_executed()

    general.shell_exec("yum -y install dhcp")
    general.shell_exec("/sbin/chkconfig dhcpd on")
    shutil.copyfile(app.SYCO_PATH + "/var/dhcp/dhcp3.conf", "/etc/dhcp/dhcpd.conf")
    general.set_config_property("/etc/dhcp/dhcpd.conf", "\$\{IP\}", net.get_ip_class_c(net.get_lan_ip()))
    general.set_config_property("/etc/sysconfig/dhcpd", ".*DHCPDARGS.*", "DHCPDARGS=%s" % get_back_interface())
    general.shell_exec("service dhcpd restart")

    version_obj.mark_executed()
示例#6
0
文件: installDHCP.py 项目: Nemie/syco
def install_dhcp(args):
    """
    Install a dhcp server on the current server.

    """
    app.print_verbose("Install DHCP-Server version: %d" % SCRIPT_VERSION)
    version_obj = version.Version("InstallDHCPServer", SCRIPT_VERSION)
    version_obj.check_executed()

    general.shell_exec("yum -y install dhcp")
    general.shell_exec("/sbin/chkconfig dhcpd on")
    shutil.copyfile(app.SYCO_PATH + "/var/dhcp/dhcp3.conf", "/etc/dhcp/dhcpd.conf")
    general.set_config_property("/etc/dhcp/dhcpd.conf", "\$\{IP\}", net.get_ip_class_c(net.get_lan_ip()))
    general.set_config_property("/etc/sysconfig/dhcpd", ".*DHCPDARGS.*", "DHCPDARGS=%s" % get_back_interface())
    general.shell_exec("service dhcpd restart")

    version_obj.mark_executed()