[Spacewalk-list] rhncfg-client exit values

Giovanni Torres giovtorres at hotmail.com
Mon Nov 12 15:47:18 UTC 2012


I think rhncfg-client should exit with a non-zero status in the following scenarios=> when `rhncfg-client get` fails to get all files successfully=> when `rhncfg-client get filename` doesn't find "filename" in a subscribed configuration channel=> when `rhncfg-client verify` finds that one or more files differ in some way (modifided, mode, user, group, selinux, etc.)
For example, when I run the following command, I want to be able to restart the ntpd service only if the client successfully retrieved the ntp.conf file from the configuration channel.  WIthout a non-zero return value, it is not as straightforward and adding an "if [ "$?" == 0 ] statement.
[root at server1 ~]# rhncfg-client get /etc/ntp.confUsing server name spacewalk.example.comNot found on server: /etc/ntp.conf[root at server1 ~]# echo $?0
In this case, if I run the following remote command on a subscribed system, the Spacewalk Web UI will say that it ran successfully, even though ntp.conf is not a managed configuration file.  Additionally, ntpd will be restarted regardless, which is not the desired effect:
#!/bin/bash/usr/bin/rhncfg-client get /etc/ntp.conf/sbin/service ntpd restart
I would like to run the following and have it work:#!/bin/bash/usr/bin/rhncfg-client get /etc/ntp.confif [ "$?" == 0 ]; then    /sbin/service ntpd restartfi
I think the code for this part is in the HandlerBase class inside /usr/share/rhn/config_client/handler_base.py.
Is there a design reason why rhncfg-client doesn't return non-zero values in these instances?
Thanks. 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20121112/2b4fea1c/attachment.htm>


More information about the Spacewalk-list mailing list