sous-chefs / mysql

Development repository for the mysql cookbook
https://supermarket.chef.io/cookbooks/mysql
Apache License 2.0
338 stars 690 forks source link

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

Open piloos opened 4 years ago

piloos commented 4 years ago

: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.

p8 commented 4 years ago

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

paul-krohn commented 4 years ago

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

axl89 commented 3 years ago

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