Skip to content

Instantly share code, notes, and snippets.

@jacoelho
Created July 12, 2016 19:05
Show Gist options
  • Save jacoelho/35d9c2e91f4771e7f760d5cd1721c926 to your computer and use it in GitHub Desktop.
Save jacoelho/35d9c2e91f4771e7f760d5cd1721c926 to your computer and use it in GitHub Desktop.
custom resource create improved
action :create do
# calls the block if current_resource does not exist
# or values are different from current_resource
converge_if_changed do
if current_resource
action_update
else
converge_by "Create topic #{new_resource.topic}" do
create! new_resource.directory,
new_resource.zookeeper,
new_resource.topic,
new_resource.partitions,
new_resource.replicas
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment