我有两个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
在vagrant、macosx10.7.2上运行Ubuntu11.04。运行Chef服务器。尝试安装postgresql社区ChefRecipe时,我收到以下错误,即使我的基本角色看起来像这样(我添加了aptRecipe以尝试更新apt-get):name"base"description"Thebaseroleforsystems"run_list("recipe[apt]","recipe[vim]")尝试运行Chef:$vagrantreloaddb1dev[db1dev]Attemptinggracefulshutdownoflinux...[db1dev]Preparingh
我正在尝试创建一个LWRP,它将调用在其自身中定义的资源。我的Recipe结构如下:在机器Recipe的提供者中,我有如下代码片段:require'chef/provisioning'#driverforcreatingmachinesrequire'::File'defget_environment_json@@environment_template=JSON.parse(File::read(new_resource.template_path+"environment.json"))return@@environment_templateend代码只是试图读取一个json文件,
首先,我的问题是关于使用我的Rails4.2应用程序获取googledrive_v2身份验证并创建新文件等。我有带有devise/omniauth2和google的Rails应用程序工作正常。我已经在googledevconsole中激活了webauth和googleAPIauth。两个客户端key均已下载并正常工作。话虽如此。我需要离线访问我的Rails应用程序才能使用、创建和删除goole文档和电子表格。我已经设置了.drive的范围,设置了离线访问等。我什至编写了代码,如果我去googleplayground并获得一个新的访问token来使用,它就可以正常工作。我的第一个问题是获
我正在尝试使用restAPI下载文件,它似乎可以工作,但实际上我没有下载文件。我假设它是因为它进入内存,而不是我的文件系统。下面是负责的代码部分。在下面粘贴时,我的URL稍作编辑,我的authToken有效。backup_url="#{proto}://#{my_host}/applications/ws/migration/export?noaudit=#{include_audit}&includebackup=#{include_backup_zips}&authToken=#{my_token}"resource=RestClient::Resource.new(backup_