Bug #7223
closedservice_check_started_at_boot throws error on service boot status check
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.
Updated by Vincent MEMBRÉ about 9 years ago
- 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 ?
Updated by Benoît PECCATTE about 9 years ago
Hi Thomas,
Is the above answer good for you ?
Updated by Jonathan CLARKE about 9 years ago
- Related to Bug #7475: Ensure service at boot doesn't work on ncf 201511051154 added
Updated by Jonathan CLARKE about 9 years ago
- Status changed from Discussion to In progress
- Assignee changed from Tomas Corej to Jonathan CLARKE
Updated by Jonathan CLARKE about 9 years ago
- Related to deleted (Bug #7475: Ensure service at boot doesn't work on ncf 201511051154)
Updated by Jonathan CLARKE about 9 years ago
- Has duplicate Bug #7475: Ensure service at boot doesn't work on ncf 201511051154 added
Updated by Jonathan CLARKE about 9 years ago
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.
Updated by Jonathan CLARKE about 9 years ago
- 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
Updated by Jonathan CLARKE about 9 years ago
- Assignee changed from Benoît PECCATTE to Tomas Corej
Updated by Jonathan CLARKE about 9 years ago
- Assignee changed from Tomas Corej to Benoît PECCATTE
Updated by Jonathan CLARKE about 9 years ago
- Assignee changed from Benoît PECCATTE to Tomas Corej
Updated by Jonathan CLARKE about 9 years ago
- Assignee changed from Tomas Corej to Benoît PECCATTE
Updated by Jonathan CLARKE about 9 years ago
- Assignee changed from Benoît PECCATTE to Tomas Corej
Updated by Jonathan CLARKE about 9 years ago
- Status changed from Pending technical review to Pending release
- % Done changed from 0 to 100
Applied in changeset 9d72df480ef60fc427020c6c19431bf6bd5a089a.
Updated by Benoît PECCATTE about 9 years ago
Applied in changeset 3af7983c34081c6190c9a0a90c9dac17cd40ebfe.
Updated by Vincent MEMBRÉ over 8 years ago
- Status changed from Pending release to Released
Updated by Alexis Mousset over 2 years ago
- Target version changed from 0.x to ncf-0.x
- Priority set to 0
Updated by Alexis Mousset over 2 years ago
- Project changed from 41 to Rudder
- Category set to Generic methods