ruby – Chef执行非顺序配方执行
发布时间:2020-12-17 03:37:45 所属栏目:百科 来源:网络整理
导读:我按照教程 http://gettingstartedwithchef.com/,第1章. 我的运行列表是 "run_list": [ "recipe[apt]","recipe[phpap]" ] 我的phpap cookbook的默认食谱 include_recipe "apache2"include_recipe "build-essential"include_recipe "openssl"include_recipe "
我按照教程
http://gettingstartedwithchef.com/,第1章.
我的运行列表是 "run_list": [ "recipe[apt]","recipe[phpap]" ] 我的phpap cookbook的默认食谱 include_recipe "apache2" include_recipe "build-essential" include_recipe "openssl" include_recipe "mysql::client" include_recipe "mysql::server" include_recipe "php" include_recipe "php::module_mysql" include_recipe "apache2::mod_php5" include_recipe "mysql::ruby" 我的食谱的依赖性 depends "apache2" depends "mysql" depends "php" depends "database" 我的回购已经下载了下载的食谱 apache2 aws database openssl phpap xml apt build-essential mysql php postgresql xfs 我用厨师独奏.我的主人已经过时了回购信息. 见日志 dan@mywp3:~/chef-repo$sudo chef-solo -c solo.rb -j web.json Starting Chef Client,version 11.6.2 Compiling Cookbooks... [2013-10-27T00:59:28+04:00] WARN: Cloning resource attributes for service[apache2] from prior resource (CHEF-3694) [2013-10-27T00:59:28+04:00] WARN: Previous service[apache2]: /home/dan/chef-repo/cookbooks/apache2/recipes/default.rb:24:in `from_file' [2013-10-27T00:59:28+04:00] WARN: Current service[apache2]: /home/dan/chef-repo/cookbooks/apache2/recipes/default.rb:210:in `from_file' [2013-10-27T00:59:28+04:00] WARN: Cloning resource attributes for directory[/var/cache/local/preseeding] from prior resource (CHEF-3694) [2013-10-27T00:59:28+04:00] WARN: Previous directory[/var/cache/local/preseeding]: /home/dan/chef-repo/cookbooks/apt/recipes/default.rb:76:in `block in from_file' [2013-10-27T00:59:28+04:00] WARN: Current directory[/var/cache/local/preseeding]: /home/dan/chef-repo/cookbooks/mysql/recipes/server.rb:44:in `from_file' [2013-10-27T00:59:28+04:00] WARN: Cloning resource attributes for directory[/var/lib/mysql] from prior resource (CHEF-3694) [2013-10-27T00:59:28+04:00] WARN: Previous directory[/var/lib/mysql]: /home/dan/chef-repo/cookbooks/mysql/recipes/server.rb:117:in `block in from_file' [2013-10-27T00:59:28+04:00] WARN: Current directory[/var/lib/mysql]: /home/dan/chef-repo/cookbooks/mysql/recipes/server.rb:117:in `block in from_file' [2013-10-27T00:59:28+04:00] WARN: Cloning resource attributes for template[/etc/mysql/my.cnf] from prior resource (CHEF-3694) [2013-10-27T00:59:28+04:00] WARN: Previous template[/etc/mysql/my.cnf]: /home/dan/chef-repo/cookbooks/mysql/recipes/server.rb:134:in `from_file' [2013-10-27T00:59:28+04:00] WARN: Current template[/etc/mysql/my.cnf]: /home/dan/chef-repo/cookbooks/mysql/recipes/server.rb:194:in `from_file' Recipe: mysql::client * package[mysql-client] action install ================================================================================ Error executing action `install` on resource 'package[mysql-client]' ================================================================================ Chef::Exceptions::Exec ---------------------- apt-get -q -y install mysql-client=5.5.32-0ubuntu0.12.04.1 returned 100,expected 0 Cookbook Trace: --------------- /home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:44:in `block in from_file' /home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:43:in `each' /home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:43:in `from_file' /home/dan/chef-repo/cookbooks/phpap/recipes/default.rb:20:in `from_file' Resource Declaration: --------------------- # In /home/dan/chef-repo/cookbooks/mysql/recipes/client.rb 46: package name 47: end Compiled Resource: ------------------ # Declared in /home/dan/chef-repo/cookbooks/mysql/recipes/client.rb:46:in `block in from_file' package("mysql-client") do action :install retries 0 retry_delay 2 package_name "mysql-client" version "5.5.32-0ubuntu0.12.04.1" cookbook_name :mysql recipe_name "client" end ================================================================================ Recipe Compile Error in /home/dan/chef-repo/cookbooks/phpap/recipes/default.rb ================================================================================ Chef::Exceptions::Exec ---------------------- package[mysql-client] (mysql::client line 46) had an error: Chef::Exceptions::Exec: apt-get -q -y install mysql-client=5.5.32-0ubuntu0.12.04.1 returned 100,expected 0 Cookbook Trace: --------------- /home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:44:in `block in from_file' /home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:43:in `each' /home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb:43:in `from_file' /home/dan/chef-repo/cookbooks/phpap/recipes/default.rb:20:in `from_file' Relevant File Content: ---------------------- /home/dan/chef-repo/cookbooks/mysql/recipes/ruby.rb: 37: when 'rhel' 38: resources('yum_key[RPM-GPG-KEY-percona]').run_action(:add) 39: resources('yum_repository[percona]').run_action(:add) 40: end 41: end 42: 43: node['mysql']['client']['packages'].each do |name| 44>> resources("package[#{name}]").run_action(:install) 45: end 46: 47: chef_gem 'mysql' 48: [2013-10-27T00:59:30+04:00] ERROR: Running exception handlers [2013-10-27T00:59:30+04:00] ERROR: Exception handlers complete [2013-10-27T00:59:30+04:00] FATAL: Stacktrace dumped to /home/dan/chef-solo/chef-stacktrace.out Chef Client failed. 0 resources updated [2013-10-27T00:59:30+04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) 主机运行ubuntu 12.04. 我可以在chef-solo之前手动在bash脚本中放置apt-get update来解决这个问题. 是mysql cookbook这么糟糕吗?据我所知,厨师总是沿着奔跑的海峡前进. 解决方法
总的来说,厨师将始终尊重运行列表.但是,有时您可能希望在任何其他资源之前运行资源(比如配置包管理器,apt / yum / etc). mysql ruby??配方中似乎发生的事情是配方在编译时显式运行一些软件包安装(在厨师开始执行资源之前).它们失败了,因为apt配方还没有运行(没有).
有一个很好的opscode帖子解释编译/执行阶段here. mysql :: ruby??中的违规代码是 node['mysql']['client']['packages'].each do |name| resources("package[#{name}]").run_action(:install) end run_action(:install)告诉大厨现在运行它(在编译时). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- postgresql 加解密
- ruby-on-rails – 为什么Rails模型关联结果不是自然的Activ
- swift 4:模式匹配元组对象元组(元组模式不能匹配非元组类型
- 解决vue项目使用font-awesome,build后路径的问题
- 是否有可能在Swift中捕获NSInternalInconsistencyException
- WPF - 使用XML作为datagrid数据源进行binding
- ios – Xcode ui测试:staticTexts以
- 翻译:PostgreSql数据库的日常Vacuuming-未完待续
- 外设位宽为8、16、32时,CPU与外设之间地址线的连接方法
- c# – 如何在没有Visual Studio的情况下进行调试?