Skip to content

Commit

Permalink
Resolve cookstyle and foodcritic warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed May 26, 2016
1 parent d4f1f47 commit 1cd4aab
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 22 deletions.
3 changes: 1 addition & 2 deletions .foodcritic
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
~FC005
~FC015
~FC016
2 changes: 1 addition & 1 deletion recipes/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#

if platform_family?('windows')
include_recipe "push-jobs::service_windows"
include_recipe 'push-jobs::service_windows'
elsif node['push_jobs']['init_style'] == 'runit'
push_jobs_service_runit 'push-jobs' do
action [:start, :enable]
Expand Down
5 changes: 2 additions & 3 deletions resources/service_runit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
runit_service 'chef-push-jobs-client' do
supports status: true
action :stop
only_if { ::File.exist?("/etc/sv/chef-push-jobs-client/run") }
only_if { ::File.exist?('/etc/sv/chef-push-jobs-client/run') }
end
end

Expand All @@ -59,11 +59,10 @@
runit_service 'chef-push-jobs-client' do
supports status: true
action :disable
only_if { ::File.exist?("/etc/sv/chef-push-jobs-client/run") }
only_if { ::File.exist?('/etc/sv/chef-push-jobs-client/run') }
end
end


action_class.class_eval do
def create_init
include_recipe 'runit'
Expand Down
14 changes: 6 additions & 8 deletions resources/service_systemd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
service 'chef-push-jobs-client' do
supports status: true
action :stop
only_if { ::File.exist?("/etc/systemd/system/chef-push-jobs.service") }
only_if { ::File.exist?('/etc/systemd/system/chef-push-jobs.service') }
end
end

Expand All @@ -61,7 +61,7 @@
service 'chef-push-jobs-client' do
supports status: true
action :disable
only_if { ::File.exist?("/etc/systemd/system/chef-push-jobs.service") }
only_if { ::File.exist?('/etc/systemd/system/chef-push-jobs.service') }
end
end

Expand All @@ -71,7 +71,7 @@
service 'chef-push-jobs-client' do
supports status: true
action :enable
only_if { ::File.exist?("/etc/systemd/system/chef-push-jobs.service") }
only_if { ::File.exist?('/etc/systemd/system/chef-push-jobs.service') }
subscribes :restart, "template[#{PushJobsHelper.config_path}]"
end
end
Expand All @@ -85,14 +85,12 @@ def create_init
action :nothing
end

template "/etc/systemd/system/chef-push-jobs-client.service" do
template '/etc/systemd/system/chef-push-jobs-client.service' do
source 'init_systemd.erb'
cookbook 'push-jobs'
variables ({
:cli_command => PushJobsHelper.cli_command(node)
})
variables cli_command: PushJobsHelper.cli_command(node)
notifies :run, 'execute[reload_unit_file]', :immediately
notifies :restart, "service[chef-push-jobs-client]", :immediately
notifies :restart, 'service[chef-push-jobs-client]', :immediately
end

# systemd is cool like this
Expand Down
14 changes: 6 additions & 8 deletions resources/service_upstart.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
service 'chef-push-jobs' do
supports status: true
action :stop
only_if { ::File.exist?("/etc/init/chef-push-jobs.conf") }
only_if { ::File.exist?('/etc/init/chef-push-jobs.conf') }
end
end

Expand All @@ -55,7 +55,7 @@
service 'chef-push-jobs' do
supports status: true
action :enable
only_if { ::File.exist?("/etc/init/chef-push-jobs.conf") }
only_if { ::File.exist?('/etc/init/chef-push-jobs.conf') }
subscribes :restart, "template[#{PushJobsHelper.config_path}]"
end
end
Expand All @@ -64,7 +64,7 @@
service 'chef-push-jobs' do
supports status: true
action :disable
only_if { ::File.exist?("/etc/init/chef-push-jobs.conf") }
only_if { ::File.exist?('/etc/init/chef-push-jobs.conf') }
end
end

Expand All @@ -77,13 +77,11 @@ def create_init
action :nothing
end

template "/etc/init/chef-push-jobs.conf" do
template '/etc/init/chef-push-jobs.conf' do
source 'init_upstart.erb'
cookbook 'push-jobs'
variables ({
:cli_command => PushJobsHelper.cli_command(node)
})
notifies :restart, "service[chef-push-jobs]", :immediately
variables cli_command: PushJobsHelper.cli_command(node)
notifies :restart, 'service[chef-push-jobs]', :immediately
end
end
end

0 comments on commit 1cd4aab

Please sign in to comment.