Skip to content

Commit

Permalink
Fix issue with notifying service to restart when its disabled!
Browse files Browse the repository at this point in the history
- Fixes #21
  • Loading branch information
brentm5 committed Apr 4, 2016
1 parent b66139a commit 1577932
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
source_url 'https://github.com/cvent/octopus-deploy-cookbook'
issues_url 'https://github.com/cvent/octopus-deploy-cookbook/issues'
version '0.5.0'
version '0.5.1'

depends 'windows', '~> 1.38'
supports 'windows'
Expand Down
2 changes: 1 addition & 1 deletion providers/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
#{catch_powershell_error('Create Service')}
EOH
sensitive true
notifies :restart, "windows_service[#{service_name}]", :delayed
notifies :restart, "windows_service[#{service_name}]", :delayed if start_service
not_if { ::Win32::Service.exists?(service_name) }
end

Expand Down
4 changes: 2 additions & 2 deletions test/cookbooks/verify-octo/recipes/audit_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
expect(service('OctopusDeploy')).to be_installed
end

it 'should have enabled the service' do
expect(service('OctopusDeploy')).to be_enabled
it 'should have disabled the service' do
expect(service('OctopusDeploy')).to have_start_mode('Disabled')
end

it 'should have created the configuration file' do
Expand Down
1 change: 1 addition & 0 deletions test/cookbooks/verify-octo/recipes/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
checksum node['verify-octo']['server']['checksum']
node_name 'octo-web-01'
connection_string 'Data Source=localhostdba;Initial Catalog=octo;Integrated Security=False;User ID=octo;Password=password'
start_service false
end

include_recipe 'verify-octo::audit_server'

0 comments on commit 1577932

Please sign in to comment.