Skip to content

Commit 60d01e0

Browse files
committed
avoid double execution of resources notified by or which subscribes other resources
Chef executes resources in the order they appear in a recipe. But also provide a way for: - resource to be notified by other resources - resource to subscribes other resources. The default action for a resource is "run", so it is executed sequentially as it appears in the recipe. If this resource subscribes another resource, it is also executed when the subscribed resource change its state. Same speech for the resource notified by another resource.
1 parent 80369aa commit 60d01e0

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

recipes/_master_base_config.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
block do
3939
wait_for_block_dev(dev_path)
4040
end
41+
action :nothing
4142
subscribes :run, "execute[attach_volume]", :immediately
4243
end
4344

@@ -47,6 +48,7 @@
4748
fs_type = setup_disk(dev_path)
4849
node.default['cfncluster']['cfn_volume_fs_type'] = fs_type
4950
end
51+
action :nothing
5052
subscribes :run, "ruby_block[sleeping_for_volume]", :immediately
5153
end
5254

recipes/torque_config.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
# Run ldconfig
2727
execute "run-ldconfig" do
2828
command 'ldconfig'
29+
action :nothing
2930
end
3031

3132
# Set toruqe server_name

0 commit comments

Comments
 (0)