Skip to content
This repository has been archived by the owner on Feb 18, 2020. It is now read-only.

Commit

Permalink
#59 better to check if script is provisioned already in not_if
Browse files Browse the repository at this point in the history
file does not exist at all on first chef run so bash did not execute
  • Loading branch information
tomzo committed Dec 21, 2015
1 parent 9e6d608 commit 8cb482f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions providers/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
cp /etc/init.d/go-agent /etc/init.d/#{agent_name}
sed -i 's/# Provides: go-agent$/# Provides: #{agent_name}/g' /etc/init.d/#{agent_name}
EOH
only_if "grep -q '# Provides: go-agent$' /etc/init.d/#{agent_name}"
not_if { agent_name == 'go-agent' }
not_if "grep -q '# Provides: #{agent_name}$' /etc/init.d/#{agent_name}"
only_if { agent_name != 'go-agent' }
end
link "/usr/share/#{agent_name}" do
to "/usr/share/go-agent"
Expand Down
2 changes: 1 addition & 1 deletion spec/go_agent_lwrp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end
before do
stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent").and_return(false)
stub_command("grep -q '# Provides: go-agent$' /etc/init.d/my-go-agent").and_return(false)
stub_command("grep -q '# Provides: my-go-agent$' /etc/init.d/my-go-agent").and_return(false)
end

it_behaves_like :agent_linux_install
Expand Down
2 changes: 1 addition & 1 deletion spec/go_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
end
before do
stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent").and_return(false)
stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent-1").and_return(true)
stub_command("grep -q '# Provides: go-agent-1$' /etc/init.d/go-agent-1").and_return(false)
end
it_behaves_like :agent_recipe
it_behaves_like :apt_repository_recipe
Expand Down

0 comments on commit 8cb482f

Please sign in to comment.