# Getting error while runnung chef-client.

**URL:** <https://discourse.chef.io/t/getting-error-while-runnung-chef-client/18065>\
**Category:** Chef Infra (archive)\
**Created:** [December 30, 2020, 8:25pm UTC](https://discourse.chef.io/t/getting-error-while-runnung-chef-client/18065 "2020-12-30T20:25:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Faizan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/faizan/32/2671_2.png) [@Faizan](https://discourse.chef.io/u/Faizan)\
**Post date:** [December 30, 2020, 8:25pm UTC](https://discourse.chef.io/t/getting-error-while-runnung-chef-client/18065/1 "2020-12-30T20:25:14Z")

</div>

template[/etc/sysconfig/network-scripts/ifcfg-bond0] action create  
Error executing action `create` on resource 'template[/etc/sysconfig/network-scripts/ifcfg-bond0]'  
Chef::Mixin::Template::TemplateError  
------------------------------------  
undefined method `' for nil:NilClass

```
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/bonding_config/recipes/default.rb

 64: template "/etc/sysconfig/network-scripts/ifcfg-#{node['bonding_config']['interface']}" do
 65: source 'ifcfg-bond.erb'
 66: mode '0644'
 67: backup 1
 68: variables(
 69: ifcfg: node['bonding_config']['ifcfg_bond'].to_hash,
 70: slaves: node['bonding_config']['slaves'].to_a
 71: )
 72: helpers(BondUtils)
 73: notifies :restart, 'service[network]', :delayed
 74: end
 75:

Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/bonding_config/recipes/default.rb:64:in `from_file'

template("/etc/sysconfig/network-scripts/ifcfg-bond0") do
  action [:create]
  default_guard_interpreter :default
  source "ifcfg-bond.erb"
  helper_modules [BondUtils]
  declared_type :template
  cookbook_name "bonding_config"
  recipe_name "default"
  mode "0644"
  owner nil
  group nil
  variables {:ifcfg=>{"TYPE"=>"Ethernet", "DEVICE"=>"bond0", "BOOTPROTO"=>"none", "ONBOOT"=>"yes", "USERCTL"=>"no", "BONDING_MASTER"=>"yes", "IPADDR"=>"104.170.209.71", "NETMASK"=>"255.255.255.128", "GATEWAY"=>"104.170.209.1", "MTU"=>1500, "BONDING_OPTS"=>{"miimon"=>"100", "use_carrier"=>"1", "downdelay"=>"0", "updelay"=>"60000"}}, :slaves=>["eno49", "eno50"]}
  backup 1
  path "/etc/sysconfig/network-scripts/ifcfg-bond0"
  verifications []
end

Template Context:
-----------------
on line #6
  4: ifcfg = {}
  5:
  6: mode = bond_mode(node, @slaves)
  7: @ifcfg['BONDING_OPTS']['mode'] ||= mode
  8: @ifcfg['BONDING_OPTS'].merge!(bonding_opts_for_mode(mode, @slaves))
```
