title: Supplying a name when declaring a package resource - Chef
body: <p>I have the following <code>Chef</code> recipe (<code>web.rb</code>):</p>
  
  <pre><code># Install Apache and start the service.
  httpd_service 'customers' do
    mpm 'prefork'
    action [:create, :start]
  end
  
  # Add the site configuration.
  httpd_config 'customers' do
    instance 'customers'
    source 'customers.conf.erb'
    notifies :restart, 'httpd_service[customers]'
  end
  
  # Create the document root directory.
  directory node['awesome_customers_ubuntu']['document_root'] do
    recursive true
  end
  
  # Write the home page.
  file "#{node['awesome_customers_ubuntu']['document_root']}/index.html" do
    content '&lt;html&gt;This is a placeholder&lt;/html&gt;'
    mode '0644'
    owner node['awesome_customers_ubuntu']['user']
    group node['awesome_customers_ubuntu']['group']
  end
  </code></pre>
  
  <p>My <code>default.rb</code> recipe looks like:</p>
  
  <pre><code>include_recipe 'apt::default'
  include_recipe 'awesome_customers_ubuntu::firewall'
  include_recipe 'awesome_customers_ubuntu::web_user'
  include_recipe 'awesome_customers_ubuntu::web'
  </code></pre>
  
  <p>and <code>attributes/default.rb</code>:</p>
  
  <pre><code>default['firewall']['allow_ssh'] = true
  default['awesome_customers_ubuntu']['open_ports'] = 80
  
  default['awesome_customers_ubuntu']['user'] = 'web_admin'
  default['awesome_customers_ubuntu']['group'] = 'web_admin'
  default['awesome_customers_ubuntu']['document_root'] = '/var/www/customers/public_html'
  </code></pre>
  
  <p>When I execute <code>kitchen converge</code> I'm getting the following error:</p>
  
  <pre><code>Recipe: awesome_customers_ubuntu::web
           * httpd_service_debian_sysvinit[customers] action create[2016-09-13T02:40:18+00:00] WARN: Default value nil is invalid for property version of resource . Possible fixes: 1. Remove 'default: nil' if nil means 'undefined'. 2. Set a valid default value if there is a reasonable one. 3. Allow nil as a valid value of your property (for example, 'property :version, [ String, nil ], default: nil'). Error: Property version must be one of: String!  You passed nil. at /tmp/kitchen/cache/cookbooks/httpd/libraries/helpers.rb:101:in `default_package_name'
         [2016-09-13T02:40:18+00:00] WARN: Default value nil is invalid for property package_name of resource . Possible fixes: 1. Remove 'default: nil' if nil means 'undefined'. 2. Set a valid default value if there is a reasonable one. 3. Allow nil as a valid value of your property (for example, 'property :package_name, [ String, nil ], default: nil'). Error: Property package_name must be one of: String!  You passed nil. at /tmp/kitchen/cache/cookbooks/httpd/libraries/httpd_service_debian.rb:8:in `block in &lt;class:HttpdServiceDebian&gt;'
  
  
             ================================================================================
             Error executing action `create` on resource 'httpd_service_debian_sysvinit[customers]'
             ================================================================================
  
             ArgumentError
             -------------
             You must supply a name when declaring a package resource
  
             Cookbook Trace:
             ---------------
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb:302:in `build_resource'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb:259:in `declare_resource'
             /tmp/kitchen/cache/cookbooks/httpd/libraries/httpd_service_debian.rb:8:in `block in &lt;class:HttpdServiceDebian&gt;'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider.rb:132:in `instance_eval'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider.rb:132:in `compile_and_converge_action'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'
  
             Resource Declaration:
             ---------------------
             # In /tmp/kitchen/cache/cookbooks/awesome_customers_ubuntu/recipes/web.rb
  
               8: httpd_service "customers" do
               9:     mpm "prefork"
              10:     action [:create, :start]
              11: end
              12: 
  
             Compiled Resource:
             ------------------
             # Declared in /tmp/kitchen/cache/cookbooks/awesome_customers_ubuntu/recipes/web.rb:8:in `from_file'
  
             httpd_service_debian_sysvinit("customers") do
               action [:create, :start]
               retries 0
               retry_delay 2
               default_guard_interpreter :default
               declared_type :httpd_service
               cookbook_name "awesome_customers_ubuntu"
               recipe_name "web"
               mpm "prefork"
             end
  
             Platform:
             ---------
             x86_64-linux
  
         Recipe: firewall::default
           * firewall[default] action restart
              (skipped due to only_if)
            (skipped due to only_if)
          (skipped due to only_if)
         * file[/etc/default/ufw-chef.rules] action create (up to date)
          (up to date)
  
         Running handlers:
         [2016-09-13T02:40:18+00:00] ERROR: Running exception handlers
         Running handlers complete
         [2016-09-13T02:40:18+00:00] ERROR: Exception handlers complete
         Chef Client failed. 3 resources updated in 06 seconds
         [2016-09-13T02:40:18+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
         [2016-09-13T02:40:18+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
         [2016-09-13T02:40:18+00:00] ERROR: httpd_service_debian_sysvinit[customers] (awesome_customers_ubuntu::web line 8) had an error: ArgumentError: You must supply a name when declaring a package resource
         [2016-09-13T02:40:19+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
  </code></pre>
  
  <p>How can I fix this problem?</p>