Bug #7223
closed
service_check_started_at_boot throws error on service boot status check
Added by Tomas Corej about 9 years ago.
Updated over 2 years ago.
Description
On fresh CentOS 7 install with systemd I found this possible bug in bundle service_check_started_at_boot. mariadb was disabled :
2015-09-22T14:09:40+0200 error:
/default/dispatcher/methods/'monitor'/default/caller/methods/'monitor'/default/monitor/methods/'mysql'/default/mysql_server/methods/'boot'/default/service_check_started_at_boot/methods/'check_run'/default/command_execution/commands/'/bin/systemctl is-enabled mariadb.service'[0]: Finished command related to promiser '/bin/systemctl is-enabled mariadb.service' -- an error occurred, returned 1
2015-09-22T14:09:40+0200 notice:
/default/dispatcher/methods/'monitor'/default/caller/methods/'monitor'/default/monitor/methods/'mysql'/default/mysql_server/methods/'boot'/default/service_check_started_at_boot/methods/'check_run'/default/command_execution/commands/'/bin/systemctl is-enabled mariadb.service'[0]: Q: ".../systemctl is-e": disabled
R: [ERROR] Promise could not be repaired, error encountered: Execute the command /bin/systemctl is-enabled mariadb.service
2015-09-22T14:09:40+0200 error:
/default/dispatcher/methods/'monitor'/default/caller/methods/'monitor'/default/monitor/methods/'mysql'/default/mysql_server/methods/'boot'/default/service_check_started_at_boot/methods/'check_run'[0]: Method 'command_execution' failed in some repairs
R: [ERROR] Promise could not be repaired, error encountered: Ensure that service mariadb is defined at boot
2015-09-22T14:09:40+0200 error: /default/dispatcher/methods/'monitor'/default/caller/methods/'monitor'/default/monitor/methods/'mysql'/default/mysql_server/methods/'boot'[0]: Method
'service_check_started_at_boot' failed in some repairs
error: /default/dispatcher/methods/'monitor'/default/caller/methods/'monitor'/default/monitor/methods/'mysql'[0]: Method 'mysql_server' failed in some repairs
in my policy file, bundle was called as follows:
"boot" usebundle => service_check_started_at_boot("mariadb");
Command "/bin/systemctl is-enabled mariadb.service" returns code 1 because service mariadb is not enabled, but no action is taken to fix it.
- Status changed from New to Discussion
- Assignee set to Tomas Corej
- Target version set to 0.x
In fact, the generic method you are using only check that the service is enabled at boot and does nothing ! to make it enable at boot, you should use 'service_ensure_started_at_boot' method.
Is it working for you with using that other method ?
Hi Thomas,
Is the above answer good for you ?
- Related to Bug #7475: Ensure service at boot doesn't work on ncf 201511051154 added
- Status changed from Discussion to In progress
- Assignee changed from Tomas Corej to Jonathan CLARKE
- Related to deleted (Bug #7475: Ensure service at boot doesn't work on ncf 201511051154)
- Has duplicate Bug #7475: Ensure service at boot doesn't work on ncf 201511051154 added
I have reproduced this, and while the result is as expected (error if the service is not set at boot, success if it is), the output is very alarming:
rudder info: Executing 'no timeout' ... '/bin/systemctl is-enabled postfix.service'
error: Finished command related to promiser '/bin/systemctl is-enabled postfix.service' -- an error occurred, returned 1
notice: Q: ".../systemctl is-e": disabled
rudder info: Last 1 quoted lines were generated by promiser '/bin/systemctl is-enabled postfix.service'
rudder info: Completed execution of '/bin/systemctl is-enabled postfix.service'
R: [DEBUG] Promise called ${promisers} with /bin/systemctl is-enabled postfix.service
R: [ERROR] Promise could not be repaired, error encountered: Execute the command /bin/systemctl is-enabled postfix.service
error: Method 'command_execution' failed in some repairs
R: [DEBUG] Promise called ${promisers} with postfix
R: [ERROR] Promise could not be repaired, error encountered: Ensure that service postfix is defined at boot
R: @@test_service_check_started_at_boot@@result_error@@32377fd7-02fd-43d0-aab7-28460a91347b@@a3d571d3-578b-42b4-8fb3-2f22aa12973f@@3@@Service check at boot@@postfix@@2015-12-03 00:23:46+00:00##root@#Ensure that service postfix is defined at boot could not be repaired
error: Method 'service_check_started_at_boot' failed in some repairs
error: Method 'test_service_check_started_at_boot' failed in some repairs
(note also that the error: lines are displayed in red...)
My conclusion is that we should not be using command_execution* methods to test conditions, but rather rely on the builtin functions "returnszero" and "execresult" to avoid so much worrysome output on the console.
- Status changed from In progress to Pending technical review
- Assignee changed from Jonathan CLARKE to Benoît PECCATTE
- Pull Request set to https://github.com/Normation/ncf/pull/281
- Assignee changed from Benoît PECCATTE to Tomas Corej
- Assignee changed from Tomas Corej to Benoît PECCATTE
- Assignee changed from Benoît PECCATTE to Tomas Corej
- Assignee changed from Tomas Corej to Benoît PECCATTE
- Assignee changed from Benoît PECCATTE to Tomas Corej
- Status changed from Pending technical review to Pending release
- % Done changed from 0 to 100
- Status changed from Pending release to Released
- Target version changed from 0.x to ncf-0.x
- Priority set to 0
- Project changed from 41 to Rudder
- Category set to Generic methods
Also available in: Atom
PDF