New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource ark -> attribute bin_cmds default value #189

Closed
laradji opened this Issue Jul 24, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@laradji

laradji commented Jul 24, 2014

Hi there,

I think the attribute bin_cmds should be a empty array as default value
https://github.com/agileorbit/java/blob/master/resources/ark.rb#L39

  * template[/opt/.java8_alt.jinfo] action create
    - create new file /opt/.java8_alt.jinfo
================================================================================
Error executing action `create` on resource 'template[/opt/.java8_alt.jinfo]'
================================================================================


Chef::Mixin::Template::TemplateError
------------------------------------
undefined method `each' for nil:NilClass


Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/java/providers/ark.rb

178:       template jinfo_file do
179:         cookbook "java"
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 /var/chef/cache/cookbooks/java/providers/ark.rb:178:in `block (2 levels) in class_from_file'

template("/opt/.java8_alt.jinfo") do
  provider Chef::Provider::Template
  action [:create]
  retries 0
  retry_delay 2
  guard_interpreter :default
  path "/opt/.java8_alt.jinfo"
  backup 5
  atomic_update true
  source "oracle.jinfo.erb"
  cookbook "java"
  variables {:priority=>1208, :bin_cmds=>nil, :name=>"java8_alt", :app_dir=>"/opt/java8_alt"}
  cookbook_name "fiduceo_java"
end



Template Context:
-----------------
on line #5
  3: section=main
  4:
  5: <% @bin_cmds.each do |cmd| -%>jdk <%= cmd %> <%= @app_dir %>/bin/<%= cmd %>
  6: <% end -%>


@erichelgeson

This comment has been minimized.

Collaborator

erichelgeson commented Jul 25, 2014

Are you using the LWRP directly? can you post a sample recipe that causes this error? I think you may be right, just want to reproduce you're use case.

@laradji

This comment has been minimized.

laradji commented Jul 28, 2014

Yes i'm using the lwrp :

java_ark "java#{java_version}" do
    url java_url
    app_home "/opt/java#{java_version}"
    action :install
    owner 'root'
    checksum java_sha256
    default false
    alternatives_priority node['company_java'][java_version]['alternatives_priority']
  end

@erichelgeson

This comment has been minimized.

Collaborator

erichelgeson commented Jul 29, 2014

I can reproduce. It only affects ubuntu. As a work around till next release you can pass bin_cmds [] in your java_ark resource.

Thanks for the report!

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