Cobbler安装报错--dhcpd -t failed Exception occured: <class 'cobbler.cexceptions.CX'>

最近想玩一下自动化安装,就研究了一下cobbler,测试环境本来是想用CentOS6.X的,但是后来一想,还是想用CentOS7.X。然后就碰到坑了。

在同步cobbler配置的时候,发现了以下错误:

cobbler  sync

dhcpd -t failed
Exception occured: <class ‘cobbler.cexceptions.CX‘>
Exception value: ‘cobbler trigger failed: cobbler.modules.sync_post_restart_services‘
Exception Info:
File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 82, in run
rc = self._run(self)
File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 181, in runner
return self.remote.api.sync(self.options.get("verbose",False),logger=self.logger)
File "/usr/lib/python2.7/site-packages/cobbler/api.py", line 763, in sync
return sync.run()
File "/usr/lib/python2.7/site-packages/cobbler/action_sync.py", line 144, in run
utils.run_triggers(self.api, None, "/var/lib/cobbler/triggers/sync/post/*", logger=self.logger)
File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 928, in run_triggers
raise CX("cobbler trigger failed: %s" % m.__name__)

!!! TASK FAILED !!!

看报错是跟DHCP服务有关系,

查看dhcp的模板:

subnet 192.168.100.0 netmask 255.255.255.0 {
option routers 192.168.100.254;
option domain-name-servers 192.168.100.254;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.10 192.168.1.200;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;

发现配置有问题,犯这么低级的错误。太狗血了

修改过配置之后,再执行:

发现还是报这个错误。

只好求助Google大神了。

发现竟然是cobbler的Python源码在CentOS7上面有点问题:

cd /usr/lib/python2.7/site-packages/cobbler/modules

cat -n sync_post_restart_services.py

35                  dhcp_restart_command = "service %s restart" % dhcp_service_name

发现第35行,重启dhcp的命令还是使用的CentOS6的

拷贝出去,修改代码:

cp sync_post_restart_services.py /tmp/

然后备份老的代码:

mv sync_post_restart_services.py{,.ori}

mv sync_post_restart_services.pyc{,.ori}

mv sync_post_restart_services.pyo{,.ori}

然后对拷贝的文件进行修改:

cd /tmp/

vim sync_post_restart_services.py

把 35 行:dhcp_restart_command = "service %s restart" % dhcp_service_name

修改为:dhcp_restart_command = "/usr/bin/systemctl restart %s " % dhcp_service_name

然后编译Python文件

python -m compileall  sync_post_restart_services.py

python -O -m compileall  sync_post_restart_services.py

把编译后的文件拷贝回原目录:

cp sync_post_restart_services.py*  /usr/lib/python2.7/site-packages/cobbler/modules

最后重启:cobbler

systemctl  restart  cobbler

引用:https://bugzilla.redhat.com/show_bug.cgi?id=709151

Cobbler安装报错--dhcpd -t failed Exception occured: <class 'cobbler.cexceptions.CX'>

原文地址:https://www.cnblogs.com/guoyishen/p/9210929.html

时间: 2024-10-18 05:21:16

Cobbler安装报错--dhcpd -t failed Exception occured: <class 'cobbler.cexceptions.CX'>的相关文章

【翻译自mos文章】windows下 11gR2 安装报错:&quot;PRKN-1019 : Failed to create directory&quot;

来源于: 11gR2 Installation on Windows fails with "PRKN-1019 : Failed to create directory" (文档 ID 1669683.1) 适用于: Oracle Database - Enterprise Edition - Version 11.2.0.3 and later Microsoft Windows x64 (64-bit) - Version: 2008 R2 症状: 在windows下安装 11.

MBG逆向工程报错:generate failed: Exception getting JDBC Driver: com.mysql.jdbc.Driver

修改pom文件,逆向工程如下: <!-- 逆向工程 --> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.7</version> <dependencies> <dependency> <gr

关于spring-data-mongodb用户名密码登录报错问题:Failed to authenticate to database

一.问题 1.spring-data-mongodb用户名密码登录报错问题:Failed to authenticate to database  org.springframework.data.mongodb.CannotGetMongoDbConnectionException: Failed to authenticate to database [ashop], username = [ashop], password = [g***********4] org.springframe

Redis 2.8.18 安装报错 error: jemalloc/jemalloc.h: No such file or directory

Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API. 本文为大家讲解的是Redis 2.8.18 安装报错 error: jemalloc/jemalloc.h: No such file or directory解决方法,感兴趣的同学参考下. 错误描述 安装Redis 2.8.18时报错: zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or

解决SCCM 2016客户端安装报错一例

解决SCCM 2016客户端安装报错一例 使用SCCM 2016推送SCCM Client时遇到如下问题: 以下是客户端计算机的Log: GetHttpRequestObjects failed for verb: 'CCM_POST', url: 'HTTPS://YAN-CM-CM.CONTOSO.COM/ccm_system/request' ccmsetup 2017/3/23 16:58:11 1672 (0x0688) GetDPLocations failed with error

remi源安装报错

问题: remi源 安装报错 rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-6.rpm Retrieving http://rpms.remirepo.net/enterprise/remi-release-6.rpm warning: /var/tmp/rpm-tmp.yZ1q8y: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY error: Failed depe

MSSQL 2012安装报错之0x858C001B

之前安装 Microsoft Sql Server 2012 R2 的时候总是报这样的错误: SQL Server Setup has encountered the following error: The SQL Server license agreement cannot be located for the selected edition, enterprise. This could be a result of corrupted media or the edition bei

mysql安装报错

如果编译时出现了以下错误:checking for tgetent in -ltermcap- nochecking for termcap functions library- configure: error: No curses/termcap library found说明 curses/termcap 库没有安装去下载一个ncurses-5.6.tar.gz,wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gztar zx

rlwrap安装报错You need the GNU readline 解决方法

首先大家肯定知道rlwrap是干什么的? 在linux以及unix中,sqlplus的上下左右.回退无法使用,会出现乱码情况.而rlwrap这个软件就是用来解决这个的. 这个错误曾经困扰我很久很久!下载readline 安装,安装好readline 还是无法运行rlwrap的安装程序 在网上搜寻很久才找到一个靠谱的解决方法 原来rlwrap这个程序的安装,需要依赖两个包, 一个是readline,这个readline在RHEL中已经集成了.不需要去专门下载 另外一个包 libtermcap-de