mysql icon indicating copy to clipboard operation
mysql copied to clipboard

Using service name 'default' results in stop/disable/enable/start actions on every run

Open piloos opened this issue 5 years ago • 3 comments

:ghost: Brief Description

When using mysql_service 'default' do ... action [:create, :start] ... end, the service mysql is stopped, disabled, enabled and started on every run even if no configuration changes are required.

:pancakes: Cookbook version

8.6.0

:woman_cook: Chef-Infra Version

15.6.10

:tophat: Platform details

Ubuntu 16.04

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create a recipe with a mysql_service 'default' do ... end

:police_car: Expected behavior

On subsequent Chef runs, I expect nothing to happen to the state of the mysql service.

:heavy_plus_sign: Additional context

Issue is probably caused by the fact that default will result in the service name mysql. The resource first tries to disable the system service, which is also called mysql and then enables his own service which is again called myqsl. This statement is confirmed by the fact that selecting another service name does not cause the faulty behavior.

piloos avatar Jan 23 '20 13:01 piloos

Hmm, I had the same issue but didn't think it had anything to do with default service name. stop_system_service should probably not be called when the service name is default. https://github.com/sous-chefs/mysql/blob/d53a05ff2a76bab260e105fd4846d6d4191f4772/libraries/mysql_service_manager_systemd.rb#L120-L130

p8 avatar Jan 30 '20 19:01 p8

I can confirm I see this same behavior on: Chef 16.1.16-1, Ubuntu 18.04.3 LTS, cookbook version 8.7.2.

paul-krohn avatar Jun 13 '20 19:06 paul-krohn

I can also confirm this issue on Ubuntu 18.04.5 LTS and cookbook version 10.1.1.

axl89 avatar Mar 21 '21 12:03 axl89