Wrapper cookbook requires template of wrapped cookbook


#1

I have created a simple wrapper cookbook called oracle-java for the opscode java cookbook, which can be found here: https://github.com/st-h/oracle-java

When I try to run that cookbook it fails since the oracle-java cookbook does not contain the template, which is referenced by the java cookbook. If I copy that template from the java cookbook to the oracle-java cookbook, it works fine. It doesn’t make much sense to me that a wrapper cookbook needs to include templates, that are already present in the wrapped cookbook. What is going on here?

[2013-11-23T11:41:05+00:00] INFO: Forking chef instance to converge…
[2013-11-23T11:41:05+00:00] INFO: *** Chef 11.8.0 ***
[2013-11-23T11:41:05+00:00] INFO: Chef-client pid: 2087
[2013-11-23T11:41:06+00:00] INFO: Setting the run_list to [“recipe[apt]”, “recipe[oracle-java::default]”] from JSON
[2013-11-23T11:41:06+00:00] INFO: Run List is [recipe[apt], recipe[oracle-java::default]]
[2013-11-23T11:41:06+00:00] INFO: Run List expands to [apt, oracle-java::default]
[2013-11-23T11:41:06+00:00] INFO: Starting Chef Run for oracle-java-berkshelf
[2013-11-23T11:41:06+00:00] INFO: Running start handlers
[2013-11-23T11:41:06+00:00] INFO: Start handlers complete.
[2013-11-23T11:41:06+00:00] INFO: Running queued delayed notifications before re-raising exception
[2013-11-23T11:41:06+00:00] ERROR: Running exception handlers
[2013-11-23T11:41:06+00:00] ERROR: Exception handlers complete
[2013-11-23T11:41:06+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2013-11-23T11:41:06+00:00] ERROR: template[/usr/local/java/.default.jinfo] (/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb line 179) had an error: Chef::Exceptions::FileNotFound: Cookbook ‘oracle-java’ (0.1.0) does not contain a file at any of these locations:
templates/ubuntu-12.04/oracle.jinfo.erb
templates/ubuntu/oracle.jinfo.erb
templates/default/oracle.jinfo.erb

================================================================================
Error executing action create on resource ‘template[/usr/local/java/.default.jinfo]’

Chef::Exceptions::FileNotFound

Cookbook ‘oracle-java’ (0.1.0) does not contain a file at any of these locations:
templates/ubuntu-12.04/oracle.jinfo.erb
templates/ubuntu/oracle.jinfo.erb
templates/default/oracle.jinfo.erb

Resource Declaration:

In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb

179: template jinfo_file do
180: source "oracle.jinfo.erb"
181: variables(
182: :priority => new_resource.alternatives_priority,
183: :bin_cmds => new_resource.bin_cmds,
184: :name => java_name,
185: :app_dir => app_home
186: )
187: action :create
188: end
189: end

Compiled Resource:

Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb:179:in `block (2 levels) in class_from_file’

template("/usr/local/java/.default.jinfo") do
provider Chef::Provider::Template
action [:create]
retries 0
retry_delay 2
path “/usr/local/java/.default.jinfo"
backup 5
atomic_update true
source “oracle.jinfo.erb"
variables {:priority=>1, :bin_cmds=>[“java”, “javac”], :name=>“default”, :app_dir=>”/usr/local/java/default”}
cookbook_name :"oracle-java"
end

[2013-11-23T11:41:05+00:00] INFO: Forking chef instance to converge…
[2013-11-23T11:41:06+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.


#2

Hm, probably I figured out what was going on:
I was using a wrapper recipe like this:

node.default[‘java’][‘oracle’][‘accept_oracle_download_terms’] = true
java_ark “jdk” do
url 'http://download.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.tar.gz
checksum 'bea330fcbcff77d31878f21753e09b30’
app_home '/usr/local/java/default’
bin_cmds [“java”, “javac”]
action :install
end

So, I was calling the java_ark LWRP and probably that’s why it was expecting to find the template in the cookbook from where the LWRP was called.

I suppose my wrapper recipe needs to look something like this then, or is there a better way to make this work?

node.default[‘java’][‘install_flavor’] = "oracle"
node.default[‘java’][‘jdk_version’] = '7’
node.default[‘java’][‘oracle’][‘accept_oracle_download_terms’] = true
node.default[‘java’][‘jdk’][‘7’][‘x86_64’][‘url’] = 'http://download.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.tar.gz
node.default[‘java’][‘jdk’][‘7’][‘x86_64’][‘checksum’] = 'bea330fcbcff77d31878f21753e09b30’
node.default[‘java’][‘java_home’] = “/usr/local/java/default”

include_recipe 'java::oracle’

On 23 Nov 2013, at 13:22, Steve Hummingbird steve.hummingbird@yandex.com wrote:

I have created a simple wrapper cookbook called oracle-java for the opscode java cookbook, which can be found here: https://github.com/st-h/oracle-java

When I try to run that cookbook it fails since the oracle-java cookbook does not contain the template, which is referenced by the java cookbook. If I copy that template from the java cookbook to the oracle-java cookbook, it works fine. It doesn’t make much sense to me that a wrapper cookbook needs to include templates, that are already present in the wrapped cookbook. What is going on here?

[2013-11-23T11:41:05+00:00] INFO: Forking chef instance to converge…
[2013-11-23T11:41:05+00:00] INFO: *** Chef 11.8.0 ***
[2013-11-23T11:41:05+00:00] INFO: Chef-client pid: 2087
[2013-11-23T11:41:06+00:00] INFO: Setting the run_list to [“recipe[apt]”, “recipe[oracle-java::default]”] from JSON
[2013-11-23T11:41:06+00:00] INFO: Run List is [recipe[apt], recipe[oracle-java::default]]
[2013-11-23T11:41:06+00:00] INFO: Run List expands to [apt, oracle-java::default]
[2013-11-23T11:41:06+00:00] INFO: Starting Chef Run for oracle-java-berkshelf
[2013-11-23T11:41:06+00:00] INFO: Running start handlers
[2013-11-23T11:41:06+00:00] INFO: Start handlers complete.
[2013-11-23T11:41:06+00:00] INFO: Running queued delayed notifications before re-raising exception
[2013-11-23T11:41:06+00:00] ERROR: Running exception handlers
[2013-11-23T11:41:06+00:00] ERROR: Exception handlers complete
[2013-11-23T11:41:06+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2013-11-23T11:41:06+00:00] ERROR: template[/usr/local/java/.default.jinfo] (/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb line 179) had an error: Chef::Exceptions::FileNotFound: Cookbook ‘oracle-java’ (0.1.0) does not contain a file at any of these locations:
templates/ubuntu-12.04/oracle.jinfo.erb
templates/ubuntu/oracle.jinfo.erb
templates/default/oracle.jinfo.erb

================================================================================
Error executing action create on resource ‘template[/usr/local/java/.default.jinfo]’

Chef::Exceptions::FileNotFound

Cookbook ‘oracle-java’ (0.1.0) does not contain a file at any of these locations:
templates/ubuntu-12.04/oracle.jinfo.erb
templates/ubuntu/oracle.jinfo.erb
templates/default/oracle.jinfo.erb

Resource Declaration:

In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb

179: template jinfo_file do
180: source "oracle.jinfo.erb"
181: variables(
182: :priority => new_resource.alternatives_priority,
183: :bin_cmds => new_resource.bin_cmds,
184: :name => java_name,
185: :app_dir => app_home
186: )
187: action :create
188: end
189: end

Compiled Resource:

Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb:179:in `block (2 levels) in class_from_file’

template("/usr/local/java/.default.jinfo") do
provider Chef::Provider::Template
action [:create]
retries 0
retry_delay 2
path “/usr/local/java/.default.jinfo"
backup 5
atomic_update true
source “oracle.jinfo.erb"
variables {:priority=>1, :bin_cmds=>[“java”, “javac”], :name=>“default”, :app_dir=>”/usr/local/java/default”}
cookbook_name :"oracle-java"
end

[2013-11-23T11:41:05+00:00] INFO: Forking chef instance to converge…
[2013-11-23T11:41:06+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.


#3

I would interpret this as a bug in the wrapped cookbook’s provider.
Probably worth a ticket at tickets.opscode.com.

It’s best practice for providers to hardcode the “cookbook” attribute
in the inline “template” resource, otherwise when people try to wrap
that cookbook, the cookbook that’s searched is the caller’s rather
than the callee’s.

  • Julian

On Sat, Nov 23, 2013 at 7:22 AM, Steve Hummingbird
Steve.Hummingbird@yandex.com wrote:

I have created a simple wrapper cookbook called oracle-java for the opscode
java cookbook, which can be found here: https://github.com/st-h/oracle-java

When I try to run that cookbook it fails since the oracle-java cookbook does
not contain the template, which is referenced by the java cookbook. If I
copy that template from the java cookbook to the oracle-java cookbook, it
works fine. It doesn’t make much sense to me that a wrapper cookbook needs
to include templates, that are already present in the wrapped cookbook.
What is going on here?

[2013-11-23T11:41:05+00:00] INFO: Forking chef instance to converge…
[2013-11-23T11:41:05+00:00] INFO: *** Chef 11.8.0 ***
[2013-11-23T11:41:05+00:00] INFO: Chef-client pid: 2087
[2013-11-23T11:41:06+00:00] INFO: Setting the run_list to [“recipe[apt]”,
“recipe[oracle-java::default]”] from JSON
[2013-11-23T11:41:06+00:00] INFO: Run List is [recipe[apt],
recipe[oracle-java::default]]
[2013-11-23T11:41:06+00:00] INFO: Run List expands to [apt,
oracle-java::default]
[2013-11-23T11:41:06+00:00] INFO: Starting Chef Run for
oracle-java-berkshelf
[2013-11-23T11:41:06+00:00] INFO: Running start handlers
[2013-11-23T11:41:06+00:00] INFO: Start handlers complete.
[2013-11-23T11:41:06+00:00] INFO: Running queued delayed notifications
before re-raising exception
[2013-11-23T11:41:06+00:00] ERROR: Running exception handlers
[2013-11-23T11:41:06+00:00] ERROR: Exception handlers complete
[2013-11-23T11:41:06+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2013-11-23T11:41:06+00:00] ERROR: template[/usr/local/java/.default.jinfo]
(/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb line 179)
had an error: Chef::Exceptions::FileNotFound: Cookbook ‘oracle-java’ (0.1.0)
does not contain a file at any of these locations:
templates/ubuntu-12.04/oracle.jinfo.erb
templates/ubuntu/oracle.jinfo.erb
templates/default/oracle.jinfo.erb

================================================================================
Error executing action create on resource
’template[/usr/local/java/.default.jinfo]’

Chef::Exceptions::FileNotFound

Cookbook ‘oracle-java’ (0.1.0) does not contain a file at any of these
locations:
templates/ubuntu-12.04/oracle.jinfo.erb
templates/ubuntu/oracle.jinfo.erb
templates/default/oracle.jinfo.erb

Resource Declaration:

In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb

179: template jinfo_file do
180: source "oracle.jinfo.erb"
181: variables(
182: :priority => new_resource.alternatives_priority,
183: :bin_cmds => new_resource.bin_cmds,
184: :name => java_name,
185: :app_dir => app_home
186: )
187: action :create
188: end
189: end

Compiled Resource:

Declared in

/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb:179:in
`block (2 levels) in class_from_file’

template("/usr/local/java/.default.jinfo") do
provider Chef::Provider::Template
action [:create]
retries 0
retry_delay 2
path “/usr/local/java/.default.jinfo"
backup 5
atomic_update true
source “oracle.jinfo.erb"
variables {:priority=>1, :bin_cmds=>[“java”, “javac”], :name=>“default”,
:app_dir=>”/usr/local/java/default”}
cookbook_name :"oracle-java"
end

[2013-11-23T11:41:05+00:00] INFO: Forking chef instance to converge…
[2013-11-23T11:41:06+00:00] FATAL: Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]


#4

Thanks,
probably I don’t understand your proposal for a fix correctly. The relevant part of the java provider looks like this:

template jinfo_file do
source "oracle.jinfo.erb"
variables(
:priority => new_resource.alternatives_priority,
:bin_cmds => new_resource.bin_cmds,
:name => java_name,
:app_dir => app_home
)
action :create
end

To me that looks hardcoded, but probably you are referring a completely different part. Could you please clarify that?

On 23 Nov 2013, at 18:37, Julian C. Dunn jdunn@aquezada.com wrote:

I would interpret this as a bug in the wrapped cookbook’s provider.
Probably worth a ticket at tickets.opscode.com.

It’s best practice for providers to hardcode the “cookbook” attribute
in the inline “template” resource, otherwise when people try to wrap
that cookbook, the cookbook that’s searched is the caller’s rather
than the callee’s.

  • Julian

On Sat, Nov 23, 2013 at 7:22 AM, Steve Hummingbird
Steve.Hummingbird@yandex.com wrote:

I have created a simple wrapper cookbook called oracle-java for the opscode
java cookbook, which can be found here: https://github.com/st-h/oracle-java

When I try to run that cookbook it fails since the oracle-java cookbook does
not contain the template, which is referenced by the java cookbook. If I
copy that template from the java cookbook to the oracle-java cookbook, it
works fine. It doesn’t make much sense to me that a wrapper cookbook needs
to include templates, that are already present in the wrapped cookbook.
What is going on here?

[2013-11-23T11:41:05+00:00] INFO: Forking chef instance to converge…
[2013-11-23T11:41:05+00:00] INFO: *** Chef 11.8.0 ***
[2013-11-23T11:41:05+00:00] INFO: Chef-client pid: 2087
[2013-11-23T11:41:06+00:00] INFO: Setting the run_list to [“recipe[apt]”,
“recipe[oracle-java::default]”] from JSON
[2013-11-23T11:41:06+00:00] INFO: Run List is [recipe[apt],
recipe[oracle-java::default]]
[2013-11-23T11:41:06+00:00] INFO: Run List expands to [apt,
oracle-java::default]
[2013-11-23T11:41:06+00:00] INFO: Starting Chef Run for
oracle-java-berkshelf
[2013-11-23T11:41:06+00:00] INFO: Running start handlers
[2013-11-23T11:41:06+00:00] INFO: Start handlers complete.
[2013-11-23T11:41:06+00:00] INFO: Running queued delayed notifications
before re-raising exception
[2013-11-23T11:41:06+00:00] ERROR: Running exception handlers
[2013-11-23T11:41:06+00:00] ERROR: Exception handlers complete
[2013-11-23T11:41:06+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2013-11-23T11:41:06+00:00] ERROR: template[/usr/local/java/.default.jinfo]
(/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb line 179)
had an error: Chef::Exceptions::FileNotFound: Cookbook ‘oracle-java’ (0.1.0)
does not contain a file at any of these locations:
templates/ubuntu-12.04/oracle.jinfo.erb
templates/ubuntu/oracle.jinfo.erb
templates/default/oracle.jinfo.erb

================================================================================
Error executing action create on resource
’template[/usr/local/java/.default.jinfo]’

Chef::Exceptions::FileNotFound

Cookbook ‘oracle-java’ (0.1.0) does not contain a file at any of these
locations:
templates/ubuntu-12.04/oracle.jinfo.erb
templates/ubuntu/oracle.jinfo.erb
templates/default/oracle.jinfo.erb

Resource Declaration:

In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb

179: template jinfo_file do
180: source "oracle.jinfo.erb"
181: variables(
182: :priority => new_resource.alternatives_priority,
183: :bin_cmds => new_resource.bin_cmds,
184: :name => java_name,
185: :app_dir => app_home
186: )
187: action :create
188: end
189: end

Compiled Resource:

Declared in

/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb:179:in
`block (2 levels) in class_from_file’

template("/usr/local/java/.default.jinfo") do
provider Chef::Provider::Template
action [:create]
retries 0
retry_delay 2
path “/usr/local/java/.default.jinfo"
backup 5
atomic_update true
source “oracle.jinfo.erb"
variables {:priority=>1, :bin_cmds=>[“java”, “javac”], :name=>“default”,
:app_dir=>”/usr/local/java/default”}
cookbook_name :"oracle-java"
end

[2013-11-23T11:41:05+00:00] INFO: Forking chef instance to converge…
[2013-11-23T11:41:06+00:00] FATAL: Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]


#5

It should say

template jinfo_file do
cookbook "java"
source “oracle.jinfo.erb”
.
.
.
end

  • Julian

On Sun, Nov 24, 2013 at 7:24 AM, Steve Hummingbird
Steve.Hummingbird@yandex.com wrote:

Thanks,
probably I don’t understand your proposal for a fix correctly. The relevant part of the java provider looks like this:

template jinfo_file do
source "oracle.jinfo.erb"
variables(
:priority => new_resource.alternatives_priority,
:bin_cmds => new_resource.bin_cmds,
:name => java_name,
:app_dir => app_home
)
action :create
end

To me that looks hardcoded, but probably you are referring a completely different part. Could you please clarify that?

On 23 Nov 2013, at 18:37, Julian C. Dunn jdunn@aquezada.com wrote:

I would interpret this as a bug in the wrapped cookbook’s provider.
Probably worth a ticket at tickets.opscode.com.

It’s best practice for providers to hardcode the “cookbook” attribute
in the inline “template” resource, otherwise when people try to wrap
that cookbook, the cookbook that’s searched is the caller’s rather
than the callee’s.

  • Julian

On Sat, Nov 23, 2013 at 7:22 AM, Steve Hummingbird
Steve.Hummingbird@yandex.com wrote:

I have created a simple wrapper cookbook called oracle-java for the opscode
java cookbook, which can be found here: https://github.com/st-h/oracle-java

When I try to run that cookbook it fails since the oracle-java cookbook does
not contain the template, which is referenced by the java cookbook. If I
copy that template from the java cookbook to the oracle-java cookbook, it
works fine. It doesn’t make much sense to me that a wrapper cookbook needs
to include templates, that are already present in the wrapped cookbook.
What is going on here?

[2013-11-23T11:41:05+00:00] INFO: Forking chef instance to converge…
[2013-11-23T11:41:05+00:00] INFO: *** Chef 11.8.0 ***
[2013-11-23T11:41:05+00:00] INFO: Chef-client pid: 2087
[2013-11-23T11:41:06+00:00] INFO: Setting the run_list to [“recipe[apt]”,
“recipe[oracle-java::default]”] from JSON
[2013-11-23T11:41:06+00:00] INFO: Run List is [recipe[apt],
recipe[oracle-java::default]]
[2013-11-23T11:41:06+00:00] INFO: Run List expands to [apt,
oracle-java::default]
[2013-11-23T11:41:06+00:00] INFO: Starting Chef Run for
oracle-java-berkshelf
[2013-11-23T11:41:06+00:00] INFO: Running start handlers
[2013-11-23T11:41:06+00:00] INFO: Start handlers complete.
[2013-11-23T11:41:06+00:00] INFO: Running queued delayed notifications
before re-raising exception
[2013-11-23T11:41:06+00:00] ERROR: Running exception handlers
[2013-11-23T11:41:06+00:00] ERROR: Exception handlers complete
[2013-11-23T11:41:06+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2013-11-23T11:41:06+00:00] ERROR: template[/usr/local/java/.default.jinfo]
(/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb line 179)
had an error: Chef::Exceptions::FileNotFound: Cookbook ‘oracle-java’ (0.1.0)
does not contain a file at any of these locations:
templates/ubuntu-12.04/oracle.jinfo.erb
templates/ubuntu/oracle.jinfo.erb
templates/default/oracle.jinfo.erb

================================================================================
Error executing action create on resource
’template[/usr/local/java/.default.jinfo]’

Chef::Exceptions::FileNotFound

Cookbook ‘oracle-java’ (0.1.0) does not contain a file at any of these
locations:
templates/ubuntu-12.04/oracle.jinfo.erb
templates/ubuntu/oracle.jinfo.erb
templates/default/oracle.jinfo.erb

Resource Declaration:

In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb

179: template jinfo_file do
180: source "oracle.jinfo.erb"
181: variables(
182: :priority => new_resource.alternatives_priority,
183: :bin_cmds => new_resource.bin_cmds,
184: :name => java_name,
185: :app_dir => app_home
186: )
187: action :create
188: end
189: end

Compiled Resource:

Declared in

/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb:179:in
`block (2 levels) in class_from_file’

template("/usr/local/java/.default.jinfo") do
provider Chef::Provider::Template
action [:create]
retries 0
retry_delay 2
path “/usr/local/java/.default.jinfo"
backup 5
atomic_update true
source “oracle.jinfo.erb"
variables {:priority=>1, :bin_cmds=>[“java”, “javac”], :name=>“default”,
:app_dir=>”/usr/local/java/default”}
cookbook_name :"oracle-java"
end

[2013-11-23T11:41:05+00:00] INFO: Forking chef instance to converge…
[2013-11-23T11:41:06+00:00] FATAL: Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]


#6

ah, I see. thanks for clarifying.

  • Steve

On 25 Nov 2013, at 00:56, Julian C. Dunn jdunn@aquezada.com wrote:

It should say

template jinfo_file do
cookbook "java"
source “oracle.jinfo.erb”
.
.
.
end

  • Julian

On Sun, Nov 24, 2013 at 7:24 AM, Steve Hummingbird
Steve.Hummingbird@yandex.com wrote:

Thanks,
probably I don’t understand your proposal for a fix correctly. The relevant part of the java provider looks like this:

template jinfo_file do
source "oracle.jinfo.erb"
variables(
:priority => new_resource.alternatives_priority,
:bin_cmds => new_resource.bin_cmds,
:name => java_name,
:app_dir => app_home
)
action :create
end

To me that looks hardcoded, but probably you are referring a completely different part. Could you please clarify that?

On 23 Nov 2013, at 18:37, Julian C. Dunn jdunn@aquezada.com wrote:

I would interpret this as a bug in the wrapped cookbook’s provider.
Probably worth a ticket at tickets.opscode.com.

It’s best practice for providers to hardcode the “cookbook” attribute
in the inline “template” resource, otherwise when people try to wrap
that cookbook, the cookbook that’s searched is the caller’s rather
than the callee’s.

  • Julian

On Sat, Nov 23, 2013 at 7:22 AM, Steve Hummingbird
Steve.Hummingbird@yandex.com wrote:

I have created a simple wrapper cookbook called oracle-java for the opscode
java cookbook, which can be found here: https://github.com/st-h/oracle-java

When I try to run that cookbook it fails since the oracle-java cookbook does
not contain the template, which is referenced by the java cookbook. If I
copy that template from the java cookbook to the oracle-java cookbook, it
works fine. It doesn’t make much sense to me that a wrapper cookbook needs
to include templates, that are already present in the wrapped cookbook.
What is going on here?

[2013-11-23T11:41:05+00:00] INFO: Forking chef instance to converge…
[2013-11-23T11:41:05+00:00] INFO: *** Chef 11.8.0 ***
[2013-11-23T11:41:05+00:00] INFO: Chef-client pid: 2087
[2013-11-23T11:41:06+00:00] INFO: Setting the run_list to [“recipe[apt]”,
“recipe[oracle-java::default]”] from JSON
[2013-11-23T11:41:06+00:00] INFO: Run List is [recipe[apt],
recipe[oracle-java::default]]
[2013-11-23T11:41:06+00:00] INFO: Run List expands to [apt,
oracle-java::default]
[2013-11-23T11:41:06+00:00] INFO: Starting Chef Run for
oracle-java-berkshelf
[2013-11-23T11:41:06+00:00] INFO: Running start handlers
[2013-11-23T11:41:06+00:00] INFO: Start handlers complete.
[2013-11-23T11:41:06+00:00] INFO: Running queued delayed notifications
before re-raising exception
[2013-11-23T11:41:06+00:00] ERROR: Running exception handlers
[2013-11-23T11:41:06+00:00] ERROR: Exception handlers complete
[2013-11-23T11:41:06+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2013-11-23T11:41:06+00:00] ERROR: template[/usr/local/java/.default.jinfo]
(/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb line 179)
had an error: Chef::Exceptions::FileNotFound: Cookbook ‘oracle-java’ (0.1.0)
does not contain a file at any of these locations:
templates/ubuntu-12.04/oracle.jinfo.erb
templates/ubuntu/oracle.jinfo.erb
templates/default/oracle.jinfo.erb

================================================================================
Error executing action create on resource
’template[/usr/local/java/.default.jinfo]’

Chef::Exceptions::FileNotFound

Cookbook ‘oracle-java’ (0.1.0) does not contain a file at any of these
locations:
templates/ubuntu-12.04/oracle.jinfo.erb
templates/ubuntu/oracle.jinfo.erb
templates/default/oracle.jinfo.erb

Resource Declaration:

In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb

179: template jinfo_file do
180: source "oracle.jinfo.erb"
181: variables(
182: :priority => new_resource.alternatives_priority,
183: :bin_cmds => new_resource.bin_cmds,
184: :name => java_name,
185: :app_dir => app_home
186: )
187: action :create
188: end
189: end

Compiled Resource:

Declared in

/tmp/vagrant-chef-1/chef-solo-1/cookbooks/java/providers/ark.rb:179:in
`block (2 levels) in class_from_file’

template("/usr/local/java/.default.jinfo") do
provider Chef::Provider::Template
action [:create]
retries 0
retry_delay 2
path “/usr/local/java/.default.jinfo"
backup 5
atomic_update true
source “oracle.jinfo.erb"
variables {:priority=>1, :bin_cmds=>[“java”, “javac”], :name=>“default”,
:app_dir=>”/usr/local/java/default”}
cookbook_name :"oracle-java"
end

[2013-11-23T11:41:05+00:00] INFO: Forking chef instance to converge…
[2013-11-23T11:41:06+00:00] FATAL: Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]