chef / omnibus-ctl

Provides service control for omnibus packages
Apache License 2.0
23 stars 24 forks source link

omnibus-ctl should cleanup systemd unit file #26

Closed lebrinkma closed 9 years ago

lebrinkma commented 9 years ago

Systemd support was added to the enterprise-chef-common cookbook, see opscode-cookbooks/enterprise-chef-common#25.

omnibus-ctl uninstall and omnibus-ctl cleanse should remove the unit file the same as it removes the upstart job or the line from inittab, see https://github.com/chef/omnibus-ctl/blob/4db616fa59007fd446d53af95c61ebb475e54e60/lib/omnibus-ctl.rb#L223

Adding a line like

FileUtils.rm_f("/usr/lib/systemd/system/#{package_name}-runsvdir-start.service") if File.exists?("/usr/lib/systemd/system/#{package_name}-runsvdir-start.service")

would work for opscode-manage.

For chef server a change in enterprise-chef-common/recipes/runit_systemd.rb like in enterprise-chef-common/recipes/runit_upstart.rb is required:

project_name = node['enterprise']['name'].clone
project_name.gsub!(/_/, '-') if project_name == 'private_chef'

I can provide the PRs if you think this is the right way to solve this problem.

From looking at the code I think removing the upstart job file is currently broken as well. It should be #{package_name} instead of #{name}.

smith commented 9 years ago

@lebrinkma I think the right way to solve this is to deprecate omnibus-ctl uninstall entirely. The Enterprise cookbook creates these files and services, so it makes a lot more sense if the same thing is responsible for deleting them.

I've created a component_runit_supervisor resource (see https://github.com/opscode-cookbooks/enterprise-chef-common/tree/master/libraries and https://github.com/opscode-cookbooks/enterprise-chef-common/pull/32 for the latest) that has a :create action that does what that cookbook did before, but now I'm working on a :delete action which should be the inverse.

Users of the cookbook and ctl command wuold have to create a ctl-command that ran a recipe that ran said delete action, but I believe the tradeoff for having everything in one place make more sense.

Let me know what thoughts you have on that and whether or not we should leave this issue open.

Thanks!

lebrinkma commented 9 years ago

@smith I agree that it makes more sense to have everything in one place. Feel free to close this issue if there is an issue for the migration of the :delete code.

smith commented 9 years ago

Thanks. This work is in progress on opscode-cookbooks/enterprise-chef-common#34.