orenoblog

エンジニアになりたいExcel方眼紙erの物語

redisio cookbooksでハマった

chef-client 11.10.4が動作するサーバをターゲットに

berks updateしないでredis使ってたら突然

ここのissueと同じようなものが発生。

  • 回避策

redisioのcookbookバージョンを1.7.1以上にすると回避できますよ。

cookbook "redisio", "~> 1.7.1"
  • エラー
Recipe: redisio::install
  * redisio_install[redis-servers] action run
================================================================================
Error executing action `run` on resource 'redisio_install[redis-servers]'
================================================================================


ArgumentError
-------------
You must supply a name when declaring a file resource


Cookbook Trace:
---------------
/root/chef-solo/cookbooks-3/redisio/providers/install.rb:138:in `block (2 levels) in configure'
/root/chef-solo/cookbooks-3/redisio/providers/install.rb:90:in `block in configure'
/root/chef-solo/cookbooks-3/redisio/providers/install.rb:66:in `each'
/root/chef-solo/cookbooks-3/redisio/providers/install.rb:66:in `configure'
/root/chef-solo/cookbooks-3/redisio/providers/install.rb:30:in `block in class_from_file'


Resource Declaration:
---------------------
# In /root/chef-solo/cookbooks-3/redisio/recipes/install.rb

 30: redisio_install "redis-servers" do
 31:   version redis['version']
 32:   download_url location
 33:   default_settings redis['default_settings']
 34:   servers redis_instances
 35:   safe_install redis['safe_install']
 36:   base_piddir redis['base_piddir']
 37:   install_dir redis['install_dir']
 38: end
 39:
 40: # Create a service resource for each redis instance, named for the port it runs on.
 41: redis_instances.each do |current_server|
 42:   server_name = current_server['name'] || current_server['port']
 43:   job_control = current_server['job_control'] || redis['default_settings']['job_control']
 44:
 45:   if job_control == 'initd'
 46:    service "redis#{server_name}" do
 47:       start_command "/etc/init.d/redis#{server_name} start"
 48:       stop_command "/etc/init.d/redis#{server_name} stop"
 49:       status_command "pgrep -lf 'redis.*#{server_name}' | grep -v 'sh'"
 50:       restart_command "/etc/init.d/redis#{server_name} stop && /etc/init.d/redis#{server_name} start"
 51:       supports :start => true, :stop => true, :restart => true, :status => false
 52:    end
 53:   elsif job_control == 'upstart'
 54:    service "redis#{server_name}" do
 55:      provider Chef::Provider::Service::Upstart
 56:       start_command "start redis#{server_name}"
 57:       stop_command "stop redis#{server_name}"
 58:       status_command "pgrep -lf 'redis.*#{server_name}' | grep -v 'sh'"
 59:       restart_command "restart redis#{server_name}"
 60:       supports :start => true, :stop => true, :restart => true, :status => false
 61:    end
 62:   else
 63:     Chef::Log.error("Unknown job control type, no service resource created!")
 64:   end
 65:
 66: end
 67:



Compiled Resource:
------------------
# Declared in /root/chef-solo/cookbooks-3/redisio/recipes/install.rb:30:in `from_file'

redisio_install("redis-servers") do
  action :run
  updated true
  updated_by_last_action true
  retries 0
  retry_delay 2
  cookbook_name :redisio
  recipe_name "install"
  version "2.6.14"
  download_url "https://redis.googlecode.com/files/redis-2.6.14.tar.gz"
  default_settings {"user"=>"redis", "group"=>"redis", "homedir"=>"/var/lib/redis", "shell"=>"/bin/sh", "systemuser"=>true, "ulimit"=>0, "configdir"=>"/etc/redis", "name"=>nil, "address"=>nil, "databases"=>"16", "backuptype"=>"rdb", "datadir"=>"/var/lib/redis", "unixsocket"=>nil, "unixsocketperm"=>nil, "timeout"=>"0", "loglevel"=>"verbose", "logfile"=>nil, "syslogenabled"=>"yes", "syslogfacility"=>"local0", "shutdown_save"=>false, "save"=>nil, "slaveof"=>nil, "job_control"=>"initd", "masterauth"=>nil, "slaveservestaledata"=>"yes", "replpingslaveperiod"=>"10", "repltimeout"=>"60", "requirepass"=>nil, "maxclients"=>10000, "maxmemory"=>nil, "maxmemorypolicy"=>"volatile-lru", "maxmemorysamples"=>"3", "appendfsync"=>"everysec", "noappendfsynconrewrite"=>"no", "aofrewritepercentage"=>"100", "aofrewriteminsize"=>"64mb", "cluster-enabled"=>"no", "cluster-config-file"=>nil, "cluster-node-timeout"=>5, "includes"=>nil}
  servers [{"port"=>6379}]
  safe_install true
  base_piddir "/var/run/redis"
  base_name "redis-"
  artifact_type "tar.gz"
  download_dir "/var/chef/cache"
end




Running handlers:
[2014-03-26T01:38:34+09:00] ERROR: Running exception handlers
Running handlers complete

[2014-03-26T01:38:34+09:00] ERROR: Exception handlers complete
[2014-03-26T01:38:34+09:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 22.319939289 seconds
[2014-03-26T01:38:34+09:00] ERROR: redisio_install[redis-servers] (redisio::install line 30) had an error: ArgumentError: You must supply a name when declaring a file resource
[2014-03-26T01:38:34+09:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.

shell returned 100