Skip to content

Instantly share code, notes, and snippets.

@jolexa
Created June 21, 2014 23:23
Show Gist options
  • Save jolexa/2c385a814a427969e4e7 to your computer and use it in GitHub Desktop.
Save jolexa/2c385a814a427969e4e7 to your computer and use it in GitHub Desktop.
chef-rewind usage issue
How to unwind this template using chef-rewind?
https://github.com/opscode-cookbooks/tomcat/blob/master/providers/instance.rb#L157-L158
template "#{new_resource.config_dir}/server.xml" do
source 'server.xml.erb'
The chef-client run expands that to :
template[/etc/tomcat6/server.xml] action create
Following the chef-rewind docs, I assumed that this would work in my recipe:
chef_gem 'chef-rewind'
require 'chef/rewind'
include_recipe 'tomcat::default'
unwind "template[/etc/tomcat6/server.xml]"
But it does not:
Chef::Exceptions::ResourceNotFound
----------------------------------
Cannot find a resource matching template[/etc/tomcat6/server.xml] (did you define it first?)
@jolexa
Copy link
Author

jolexa commented Jun 22, 2014

chef:recipe > f = resources("tomcat_instance[base]")
<tomcat_instance[base] @name: "base" @noop: nil @before: nil @params: {} @provider: nil @allowed_actions: [:nothing, :configure, :configure] @action: :configure @updated: false @updated_by_last_action: false @supports: {} @ignore_failure: false @retries: 0 @retry_delay: 2 @source_line: "/var/chef/cache/cookbooks/tomcat/recipes/default.rb:72:in from_file'" @guard_interpreter: :default @elapsed_time: 0 @resource_name: :tomcat_instance @cookbook_name: "tomcat" @recipe_name: "default" @PORT: 8080 @proxy_port: nil @ssl_port: 8443 @ssl_proxy_port: nil @ajp_port: 8009 @shutdown_port: 8005>`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment