-
Type:
Bug
-
Status: Done
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 3.6.0
-
Component/s: Evaluation
-
Labels:None
I have the following bundle:
<pre>
194 bundle agent enable_runit_service(runit_service)
195
</pre>
This invokes standard_services.cf via the services promise. Here's an example of a single service, bittorrent_tracker.
<pre>
bundle agent standard_services(service, state)
{
vars:
any::
"cm_conf" string => "/etc/cm.conf";
"sv" string => "/sbin/sv";
"servicedir" string => "/export/service";
linux::
"initdir" string => "/etc/init.d/";
"chkconfig" string => "/sbin/chkconfig";
"startcommand[bittorrent_tracker]" string => "$(sv) up $(servicedir)/bittorrent_tracker";
"stopcommand[bittorrent_tracker]" string => "$(sv) down $(servicedir)/bittorrent_tracker";
"processname[bittorrent_tracker]" string => "bttrack.py --dfile /export/content/bittorrent/bittorrent_tracker/data --port 6889 --logfile -";
classes:
any::
"start" expression => strcmp("start","$(state)");
"stop" expression => strcmp("stop","$(state)");
linux.start::
"$(service)_chkconfig_on" expression =>
returnszero("$(chkconfig) $(chkconfig_name[$(service)]) --list | cut -f5 | grep off > /dev/null 2>&1","useshell");
linux.stop::
"$(service)_chkconfig_off" expression =>
returnszero("$(chkconfig) $(chkconfig_name[$(service)]) --list | cut -f5 | grep on > /dev/null 2>&1","useshell");
redhat_6::
"mcelogd_lock_file_exists" expression => fileexists("/var/lock/subsys/mcelogd");
processes:
start::
".$(processname[$(service)])."
comment => "standard_services.cf Verify that the service appears in the process table",
restart_class => "restart_$(service)";
stop::
".$(processname[$(service)])."
comment => "standard_services.cf Verify that the service does not appear in the process table",
process_stop => "$(stopcommand[$(service)])",
signals =>
;
commands:
any::
"$(startcommand[$(service)])"
comment => "standard_services.cf Execute command to restart the $(service) service",
ifvarclass => "restart_$(service)";
linux::
"$(chkconfig) $(chkconfig_name[$(service)]) on"
comment => "standard_services.cf Execute chkconfig on to enable service on bootstart",
ifvarclass => "$(service)_chkconfig_on";
linux::
"$(chkconfig) $(chkconfig_name[$(service)]) off"
comment => "standard_services.cf Execute chkconfig off to disable service on bootstart",
ifvarclass => "$(service)_chkconfig_off";
files:
any::
"$(cm_conf)"
handle => "insert_service_started_cm_conf",
edit_line => append_if_no_line("$(sys.cdate):$(service) offline. Cfengine starting process."),
ifvarclass => "restart_$(service)";
any::
"$(cm_conf)"
handle => "insert_chkconfig_enabled_cm_conf",
edit_line => append_if_no_line("$(sys.cdate):$(service) disabled on bootstart. Cfengine enabling."),
ifvarclass => "$(service)_chkconfig_on";
any::
"$(cm_conf)"
handle => "insert_chkconfig_disabled_cm_conf",
edit_line => append_if_no_line("$(sys.cdate):$(service) enabled on bootstart. Cfengine disabling."),
ifvarclass => "$(service)_chkconfig_off";
- mcelogd doesn't clean up its lock file very well. If we see that we have to restart the daemon because its not running
- but the lock file exists, then clean up the file. This will allow mcelog to actually start.
restart_mcelog.mcelogd_lock_file_exists::
"/var/lock/subsys/mcelogd"
handle => "purge_mcelogd_lock_file",
delete => tidy;
reports:
cfengine_3::
"cf3: Service $(service) started on $(sys.host)"
ifvarclass => "restart_$(service)";
cfengine_3::
"cf3: Service $(service) found disabled on bootstart when it should be enabled. Executing $(chkconfig) $(chkconfig_name[$(service)]) on"
ifvarclass => "$(service)_chkconfig_on";
cfengine_3::
"cf3: Service $(service) found enabled on bootstart when it should be disabled. Executing $(chkconfig) $(chkconfig_name[$(service)]) off"
ifvarclass => "$(service)_chkconfig_off";
}
</pre>
Every time this policy fires, its raising the class "bittorrent_tracker_service_modified" on line 251 in the policy enable_runit_services. This causes the service to be restarted every execution.
<pre>
[root@esv4-cfe-test msvoboda]# /var/cfengine/bin/cf-agent -I -K -b mps_bittorrent_tracker
2014-03-27T08:25:35-0700 info: Using command line specified bundlesequence
R: cf3: The service /export/service/bittorrent_tracker was modified on esv4-cfe-test.corp
R: cf3: The service /export/service/bittorrent_solaris_seeder was modified on esv4-cfe-test.corp
R: cf3: The service /export/service/bittorrent_linux_seeder was modified on esv4-cfe-test.corp
2014-03-27T08:25:45-0700 info: /default/mps_bittorrent_tracker/commands/'/sbin/sv restart /export/service/bittorrent_tracker'[0]: Executing 'no timeout' ... '/sbin/sv restart /export/service/bittorrent_tracker'
2014-03-27T08:25:47-0700 notice: /default/mps_bittorrent_tracker/commands/'/sbin/sv restart /export/service/bittorrent_tracker'[0]: Q: ".../sbin/sv restar": ok: run: /export/service/bittorrent_tracker: (pid 11328) 0s
2014-03-27T08:25:47-0700 info: /default/mps_bittorrent_tracker/commands/'/sbin/sv restart /export/service/bittorrent_tracker'[0]: Last 1 quoted lines were generated by promiser '/sbin/sv restart /export/service/bittorrent_tracker'
2014-03-27T08:25:47-0700 info: /default/mps_bittorrent_tracker/commands/'/sbin/sv restart /export/service/bittorrent_tracker'[0]: Completed execution of '/sbin/sv restart /export/service/bittorrent_tracker'
2014-03-27T08:25:47-0700 info: /default/mps_bittorrent_tracker/commands/'/var/cfengine/modules/master_policy_servers/mps_usr_local_linkedin_crawler.py'[0]: Executing 'no timeout' ... '/var/cfengine/modules/master_policy_servers/mps_usr_local_linkedin_crawler.py'
2014-03-27T08:25:48-0700 info: /default/mps_bittorrent_tracker/commands/'/var/cfengine/modules/master_policy_servers/mps_usr_local_linkedin_crawler.py'[0]: Completed execution of '/var/cfengine/modules/master_policy_servers/mps_usr_local_linkedin_crawler.py'
[root@esv4-cfe-test msvoboda]#
[root@esv4-cfe-test msvoboda]#
[root@esv4-cfe-test msvoboda]#
[root@esv4-cfe-test msvoboda]#
[root@esv4-cfe-test msvoboda]#
[root@esv4-cfe-test msvoboda]#
[root@esv4-cfe-test msvoboda]# /var/cfengine/bin/cf-agent -I -K -b mps_bittorrent_tracker
2014-03-27T08:25:53-0700 info: Using command line specified bundlesequence
R: cf3: The service /export/service/bittorrent_tracker was modified on esv4-cfe-test.corp
R: cf3: The service /export/service/bittorrent_solaris_seeder was modified on esv4-cfe-test.corp
R: cf3: The service /export/service/bittorrent_linux_seeder was modified on esv4-cfe-test.corp
2014-03-27T08:26:02-0700 info: /default/mps_bittorrent_tracker/commands/'/sbin/sv restart /export/service/bittorrent_tracker'[0]: Executing 'no timeout' ... '/sbin/sv restart /export/service/bittorrent_tracker'
2014-03-27T08:26:04-0700 notice: /default/mps_bittorrent_tracker/commands/'/sbin/sv restart /export/service/bittorrent_tracker'[0]: Q: ".../sbin/sv restar": ok: run: /export/service/bittorrent_tracker: (pid 11588) 0s
2014-03-27T08:26:04-0700 info: /default/mps_bittorrent_tracker/commands/'/sbin/sv restart /export/service/bittorrent_tracker'[0]: Last 1 quoted lines were generated by promiser '/sbin/sv restart /export/service/bittorrent_tracker'
2014-03-27T08:26:04-0700 info: /default/mps_bittorrent_tracker/commands/'/sbin/sv restart /export/service/bittorrent_tracker'[0]: Completed execution of '/sbin/sv restart /export/service/bittorrent_tracker'
2014-03-27T08:26:04-0700 info: /default/mps_bittorrent_tracker/commands/'/var/cfengine/modules/master_policy_servers/mps_usr_local_linkedin_crawler.py'[0]: Executing 'no timeout' ... '/var/cfengine/modules/master_policy_servers/mps_usr_local_linkedin_crawler.py'
2014-03-27T08:26:06-0700 info: /default/mps_bittorrent_tracker/commands/'/var/cfengine/modules/master_policy_servers/mps_usr_local_linkedin_crawler.py'[0]: Completed execution of '/var/cfengine/modules/master_policy_servers/mps_usr_local_linkedin_crawler.py'
</pre>
Putting this into verbose mode:
<pre>
Evaluating promise 'cf3: Service $(service) started on $(sys.host)'
Service bittorrent_tracker started on esv4-cfe-test.corp'[0]: . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Service bittorrent_tracker started on esv4-cfe-test.corp'[0]: Skipping whole next promise (cf3: Service $(service) started on $(sys#host)), as ifvarclass restart_bittorrent_tracker is not relevant
Service bittorrent_tracker started on esv4-cfe-test.corp'[0]: . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Evaluating promise 'cf3: Service $(service) found disabled on bootstart when it should be enabled. Executing $(chkconfig) $(chkconfig_name[$(service)]) on'
Service bittorrent_tracker found disabled on bootstart when it should be enabled. Executing /sbin/chkconfig $(chkconfig_name[bittorrent_tracker]) on'[0]: . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Service bittorrent_tracker found disabled on bootstart when it should be enabled. Executing /sbin/chkconfig $(chkconfig_name[bittorrent_tracker]) on'[0]: Skipping whole next promise (cf3: Service $(service) found disabled on bootstart when it should be enabled. Executing $(chkconfig) $(chkconfig_name[$(service)]) on), as ifvarclass bittorrent_tracker_chkconfig_on is not relevant
Service bittorrent_tracker found disabled on bootstart when it should be enabled. Executing /sbin/chkconfig $(chkconfig_name[bittorrent_tracker]) on'[0]: . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Evaluating promise 'cf3: Service $(service) found enabled on bootstart when it should be disabled. Executing $(chkconfig) $(chkconfig_name[$(service)]) off'
Service bittorrent_tracker found enabled on bootstart when it should be disabled. Executing /sbin/chkconfig $(chkconfig_name[bittorrent_tracker]) off'[0]: . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Service bittorrent_tracker found enabled on bootstart when it should be disabled. Executing /sbin/chkconfig $(chkconfig_name[bittorrent_tracker]) off'[0]: Skipping whole next promise (cf3: Service $(service) found enabled on bootstart when it should be disabled. Executing $(chkconfig) $(chkconfig_name[$(service)]) off), as ifvarclass bittorrent_tracker_chkconfig_off is not relevant
Service bittorrent_tracker found enabled on bootstart when it should be disabled. Executing /sbin/chkconfig $(chkconfig_name[bittorrent_tracker]) off'[0]: . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bundle Accounting Summary for 'standard_services'
Promises kept in 'standard_services' = 1
Promises not kept in 'standard_services' = 0
Promises repaired in 'standard_services' = 0
Aggregate compliance (promises kept/repaired) for bundle 'standard_services' = 100.0%
Additional promise info: handle 'runit_services_administration_start_runit_service' source path '/var/cfengine/inputs/runit_services_administration.cf' at line 243
Method 'standard_services' invoked repairs
Defining promise result class 'bittorrent_tracker_service_modified'
</pre>