[chef] Re: Re: Environment - No resource or method named `template'


Chronological Thread 
  • From: Douglas Garstang < >
  • To:
  • Subject: [chef] Re: Re: Environment - No resource or method named `template'
  • Date: Fri, 14 Feb 2014 12:52:49 -0800

Daniel.

Thanks for the reply. I took a look at the bug, and I think I see what it's saying. However, my template code has:

template '/etc/server.yaml' do
    source 'etc/server.yaml.erb'
    owner 'root'
    group 'root'
    mode 00644
    variables({
        :env            => node['bitcasa_env'],
        :cluster        => node['cluster'],
        :hostname       => node['hostname'],
        :storage_region => node['bc-xxx-osg']['storage_region'],
        :session_region => node['bc-xxx-osg']['session_region'],
        :db_host        => node['bc-xxx-osg']['mysql']['host'],
        :redis_master   => node['bc-xxx-osg']['redis']['master']['host'],
        :redis_slave    => node['bc-xxx-osg']['redis']['slave']['host'],
        :rabbit_master  => node['bc-xxx-osg']['rabbitmq']['host'],
        :rabbit_port    => node['bc-xxx-osg']['rabbitmq']['port']
    })
end

I'm pretty sure there's no undefined methods in there. It worked fine in vagrant. When I comment the whole thing out though, the recipe runs without errors. It has to be somehow related to the use of environments?

Doug.



On Fri, Feb 14, 2014 at 12:45 PM, Daniel DeLeo < " target="_blank"> > wrote:
You’re hitting this bug: https://tickets.opscode.com/browse/CHEF-5011

Which means you have code like:

template “path” do
  # correct code
  something_that_raises_no_method_error
end

Though this bug does not impact any correct chef code, it makes debugging difficult so we’re going to release an update to fix it soon.

--
Daniel DeLeo


On Friday, February 14, 2014 at 12:40 PM, Douglas Garstang wrote:

> I've just started trying to use environments in chef. Everything worked find locally with vagrant, but after uploading the cookbook to the target machine, and attempting to do a chef client run, I am seeing this error:
>
> NoMethodError
> -------------
> No resource or method named `template' for `Chef::Recipe "default"'
>
> I have no idea what is going on here. If chef can't find it's own template resource, then something is seriously wrong. This is a fresh instance.
>
> I can confirm my environment is there...
>
> (xxx-prod) Douglass-Mac-mini: knife-eu2 environment show eu2-prod
> chef_type: environment
> cookbook_versions:
> default_attributes:
> description:
> json_class: Chef::Environment
> name: eu2-prod
> override_attributes:
>
> I can also confirm that the node belongs to the environment:
>
> (xxx-prod) Douglass-Mac-mini: knife-eu2 node show osg04-eu2.xxx.net (http://osg04-eu2.xxx.net)
> Node Name: osg04-eu2.xxx.net (http://osg04-eu2.xxx.net)
> Environment: eu2-prod
> FQDN:
> IP:
> Run List: role[location_eu2_prod], role[role_base], role[role_osg]
> Roles:
> Recipes:
> Platform:
> Tags:
>
> What gives?
>
> Doug.





--
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: ">
Cell: +1-805-340-5627



Archive powered by MHonArc 2.6.16.

§