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

Commit 8cb482f

Browse files
committed
#59 better to check if script is provisioned already in not_if
file does not exist at all on first chef run so bash did not execute
1 parent 9e6d608 commit 8cb482f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

providers/agent.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
cp /etc/init.d/go-agent /etc/init.d/#{agent_name}
2424
sed -i 's/# Provides: go-agent$/# Provides: #{agent_name}/g' /etc/init.d/#{agent_name}
2525
EOH
26-
only_if "grep -q '# Provides: go-agent$' /etc/init.d/#{agent_name}"
27-
not_if { agent_name == 'go-agent' }
26+
not_if "grep -q '# Provides: #{agent_name}$' /etc/init.d/#{agent_name}"
27+
only_if { agent_name != 'go-agent' }
2828
end
2929
link "/usr/share/#{agent_name}" do
3030
to "/usr/share/go-agent"

spec/go_agent_lwrp_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
end
1313
before do
1414
stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent").and_return(false)
15-
stub_command("grep -q '# Provides: go-agent$' /etc/init.d/my-go-agent").and_return(false)
15+
stub_command("grep -q '# Provides: my-go-agent$' /etc/init.d/my-go-agent").and_return(false)
1616
end
1717

1818
it_behaves_like :agent_linux_install

spec/go_agent_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
end
9999
before do
100100
stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent").and_return(false)
101-
stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent-1").and_return(true)
101+
stub_command("grep -q '# Provides: go-agent-1$' /etc/init.d/go-agent-1").and_return(false)
102102
end
103103
it_behaves_like :agent_recipe
104104
it_behaves_like :apt_repository_recipe

0 commit comments

Comments
 (0)