Skip to content

undefined method `[]' for nil:NilClass #2

@kamal2222ahmed

Description

@kamal2222ahmed

ran docker run --privileged -t --name chef-server -d -p 443:443 cbuisson/chef-server
then tail logs
docker logs -f chef-server
got
Recipe Compile Error in /opt/opscode-reporting/embedded/cookbooks/cache/cookbooks/opscode-reporting/recipes/default.rb

NoMethodError

undefined method `[]' for nil:NilClass

Cookbook Trace:

/opt/opscode-reporting/embedded/cookbooks/cache/cookbooks/opscode-reporting/recipes/default.rb:34:in from_file' /opt/opscode-reporting/embedded/cookbooks/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:347:in load_recipe'

Relevant File Content:

/opt/opscode-reporting/embedded/cookbooks/cache/cookbooks/opscode-reporting/recipes/default.rb:

27: action :nothing
28: end.run_action(:create)
29:
30: # We need to load the private chef configuration
31: if File.exists?("/etc/opscode/chef-server-running.json")
32: private_chef = JSON.parse(IO.read("/etc/opscode/chef-server-running.json"))
33: end
34>> node.consume_attributes({"private_chef" => private_chef['private_chef']})
35:
36: Reporting[:node] = node
37: if File.exists?("/etc/opscode-reporting/opscode-reporting.rb")
38: Reporting.from_file("/etc/opscode-reporting/opscode-reporting.rb")
39: end
40: node.consume_attributes(Reporting.generate_config(node['fqdn']))
41:
42: if File.exists?("/var/opt/opscode-reporting/bootstrapped")
43: node.normal['reporting']['bootstrap']['enable'] = false

Platform:

x86_64-linux

[2017-11-16T00:41:51+00:00] ERROR: Running exception handlers
[2017-11-16T00:41:51+00:00] ERROR: Exception handlers complete
[2017-11-16T00:41:51+00:00] FATAL: Stacktrace dumped to /opt/opscode-reporting/embedded/cookbooks/cache/chef-stacktrace.out
[2017-11-16T00:41:51+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-11-16T00:41:51+00:00] ERROR: undefined method `[]' for nil:NilClass
[2017-11-16T00:41:51+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
++ chef-server-ctl user-list
ERROR: CONFIGURATION ERROR:Specified config file /etc/opscode/pivotal.rb does not exist

  • [[ '' =~ admin ]]
  • chef-server-ctl user-create admin admin admin [email protected] admin123 --filename /etc/opscode/admin.pem
    ERROR: CONFIGURATION ERROR:Specified config file /etc/opscode/pivotal.rb does not exist
  • chef-server-ctl reconfigure

Error executing action delete on resource 'directory[/opt/opscode/embedded/service/oc_id/log]'

Errno::ENOTEMPTY

Directory not empty @ dir_s_rmdir - /opt/opscode/embedded/service/oc_id/log

Resource Declaration:

In /var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/oc_id.rb

70: directory full_dir do
71: action :delete
72: recursive true
73: not_if { File.symlink?(full_dir) }
74: end
75: end

Compiled Resource:

Declared in /var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/oc_id.rb:70:in `block in from_file'

directory("/opt/opscode/embedded/service/oc_id/log") do
action [:delete]
retries 0
retry_delay 2
default_guard_interpreter :default
path "/opt/opscode/embedded/service/oc_id/log"
recursive true
declared_type :directory
cookbook_name "private-chef"
recipe_name "oc_id"
owner nil
group nil
mode nil
not_if { #code block }
end

Platform:

x86_64-linux

[2017-11-16T00:42:32+00:00] FATAL: Stacktrace dumped to /var/opt/opscode/local-mode-cache/chef-stacktrace.out
[2017-11-16T00:42:32+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-11-16T00:42:32+00:00] FATAL: Errno::ENOTEMPTY: directory[/opt/opscode/embedded/service/oc_id/log] (private-chef::oc_id line 70) had an error: Errno::ENOTEMPTY: Directory not empty @ dir_s_rmdir - /opt/opscode/embedded/service/oc_id/log
++ dpkg-query -l
++ grep postfix
++ wc -l

  • [[ 0 < 1 ]]
  • apt-get update

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions