我有安装了ruby1.9.1的chef11.4.4。我想安装berkshelf,但它需要ruby1.9.2或更高版本。我用rvm安装了ruby2.0.0-p247(最新稳定版)。当我运行knife命令时,我得到...#knifehelp/opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in`to_specs':Couldnotfindchef(>=0)amongst[rake-10.1.0,rvm-1.11.3.8](Gem::LoadError)from/opt/chef/embe
我正在尝试通过chef_handlerlwrp安装一个chefhandler。此处理程序(chef-handler-email)捆绑在一个gem中。我正在尝试安装gem,然后从如下所示的单个配方中打开处理程序:chef_gem"chef-handler-mail"chef_handler"MailHandler"dosource'chef/handler/mail'arguments:to_address=>"root"action:nothingsupports:exception=>true,:report=>falseend.run_action(:enable)如果gem已经安
是否可以在另一个Recipe提供者/库中重用Recipe库中的代码?cookbook1/libraries/lib.rb...defvery_useful_checktrueend...cookbook2/libraries(providers?)/foo.rb...myvar=very_useful_check...谢谢 最佳答案 可以使用ChefLibraries.确保函数是通过ruby模块在您的命名空间中定义的:moduleFoodefvery_useful_checktrueendendclassChef::Recipe
我有两个execute资源,名为command_1和command_2。如果command_1失败,我想运行command_2然后重新运行command_1。差不多是这样的:execute'command_1'docommand"ipahost-del#{machine_name}"action:runignore_failuretrueon_failure{notifies:run,'execute['command_2']',:immediately}endexecute'command_2'docommand"ipahost-mod--certificate#{machine_n
场景:方法1:下载文件,解压它们。提供一个CLI,它还定义了一个Ruby库。秘诀2:利用上述库中的RubyAPI。在recipe1/recipes/default.rb中:..doworknode[:recipe1][:filePath]=".."#pathtofile在recipe2/recipes/default.rb中:requirenode[:recipe1][:filePath]/lib/Library..dowork但是,当加载Recipe时,Chef宣布:[Wed,17Aug201119:32:23+0800]DEBUG:Loadingcookbookapache2'sd
我正在编写使用chef-solo安装jsk的练习方法,我需要更新.bashrc文件以设置JAVA_HOME和PATH变量。我不知道该怎么做。谁能告诉我该怎么做。我的一些代码是..file"/home/user/.bashrc"doowner"root"#somethinggoeshere....idon'tknowwhat.butiwrite#%{bash-i-c"source/etc/bash/bashrc&&bashrcupdate"}content"JAVA_HOME=/usr/java/jdk1.1.0.05"content"PATH=$PATH:JAVA_HOME/bin"e
我希望能够使用比方说3个参数来定义轻量级资源,其中两个是基本/基本参数,第三个是这两个参数的组合。我还想提供定制第三个参数的可能性。例如:如何修改以下代码以实现full_name属性的上述行为:资源定义:actions:installattribute:name,:kind_of=>String,:name_attribute=>trueattribute:version,:kind_of=>Stringattribute:full_name,:kind_of=>String提供商定义:action:installdoChef::Log.info"#{new_resource.full
我在Chef中使用环境,我想使用每个环境的运行列表。问题是我不想重复自己(就像我现在做的那样)。示例:{"name":"myapp","default_attributes":{},"json_class":"Chef::Role","env_run_lists":{"production":[#Haslesspackagesbecauseservicesarespreadacrossspecializednodes"role[base]","recipe[mysql::client]","recipe[myapp]"],"staging":[#Haslesspackagesbecau
我正在尝试将要部署的git分支传递给Chef部署资源,但它不起作用,我猜这是因为资源是单独编译然后才执行的?但我对Ruby的理解可能是有限的。所以我正在尝试这样做:ruby_block'revision'doblockdo#Somecodedeterminesthebranchtobedeployedbranch='master'node.run_state['branch']=branchendenddeploy"#{node['path']['web']}"doaction:deployrepository"#{node['git']['repository']}"revision
在osx10.9mavericks上运行geminstallnokogiri-v'1.6.1'获得:make"DESTDIR="cleanmake"DESTDIR="compilinghtml_document.ccc1:error:unrecognizedcommandlineoption"-Wdivision-by-zero"make:***[html_document.o]Error1makefailed,exitcode2 最佳答案 当我尝试在Mac10.9上安装nokogiri1.6.6.2时遇到了这个错误,我是这样修复的