chef

Is it possible to define what happens prior to vagrant destroy?

一个人想着一个人 提交于 2020-01-15 06:50:33
问题 I have a Vagrantfile that clones the required cookbook repos on vagrant up . The problem is, it also does this on vagrant destroy . Is there a way to define 'pre-construction' and 'pre-destruction' commands or does the Vagrantfile just get run in totality each time vagrant is invoked regardless of the parameters? 回答1: I don't know about a destroy hook, but you can detect first time and post-destoy actions in the Vagrantfile by checking the existence of the machine ID: File.exists?(".vagrant

Mount windows shares on a windows node with Chef

只谈情不闲聊 提交于 2020-01-15 04:41:27
问题 I'm trying to copy files from a windows share to my node's cache. Apparently there's no way to do that from remote_file so my alternative thought is to try and mount the windows share to a local drive and access the files I need via the file resource. However even though Chef is telling me the mount succeeded I'm unable to see the share and access it on the node. mount "H:" do device "\\\\ \\software" action :mount end Just like https://tickets.opscode.com/browse/CHEF-1267 suggests. However

Mount windows shares on a windows node with Chef

眉间皱痕 提交于 2020-01-15 04:41:05
问题 I'm trying to copy files from a windows share to my node's cache. Apparently there's no way to do that from remote_file so my alternative thought is to try and mount the windows share to a local drive and access the files I need via the file resource. However even though Chef is telling me the mount succeeded I'm unable to see the share and access it on the node. mount "H:" do device "\\\\ \\software" action :mount end Just like https://tickets.opscode.com/browse/CHEF-1267 suggests. However

Vagrant & Chef: uninitialized constant Chef::Resource::LWRPBase

落爺英雄遲暮 提交于 2020-01-15 04:39:08
问题 I get this error when i try to run "vagrant provision": Running chef-solo... stdin: is not a tty [2014-05-15T12:21:41+00:00] INFO: *** Chef 10.14.2 *** [2014-05-15T12:21:41+00:00] INFO: Setting the run_list to ["recipe[apt]", "recipe[build-essential]", "recipe[vim]", "recipe[git]", "recipe[mysql::server]", "recipe[apache2]", "recipe[php]", "recipe[vhosts]", "recipe[apache2::mod_php5]", "recipe[php::module_mysql]", "recipe[php::module_apc]", "recipe[php::module_curl]", "recipe[phpmyadmin]",

How do I get log output in test kitchen?

馋奶兔 提交于 2020-01-14 03:50:10
问题 I have this in my recipe: log mylog1 do level :info message 'WHY I NO SEE THIS?' end log mylog2 do level :info message 'WHY I NO SEE THIS?' end This is what I see when doing kitchen converge -l debug : ... Converging 3 resources Recipe: mybook::myrecipe * log[mylog1] action write * log[mylog1] action write ... 回答1: There are two parts of this question: First, The log level passed to kitchen with "-l debug" is for the kitchen executable and not for the provisioner , in this case " chef-solo ".

chef ruby gem installer failing

六月ゝ 毕业季﹏ 提交于 2020-01-13 10:39:28
问题 I am trying to setup cassandra on an CentOS VM via chef and it fails with the error below. I have tried clearing out bundle caches to no avail. The recipe works on another machine but a key difference is that I ran other recipes on that machine beforehand so I suspect I am missing a chef dependency (which is why I haven't tried just fixing the packages directly). I am also terribly new to ruby so sorry if this is an obvious question. Machine config Chef: 11.4.0 ruby 1.9.3p286 (2012-10-12

How to pass attributes in chef-client without JSON file?

非 Y 不嫁゛ 提交于 2020-01-12 01:50:16
问题 I know we can pass node attributes in chef-{client/solo} with --json-attributes(-j) flag. This flag always expect a JSON file as input. Is their any method I can directly pass the attributes as JSON objects. I tried doing it. For eg: chef-client -j {"attr":"value"} But it ends up with a failure message as: FATAL: I cannot find {"attr":"value"} As it expects a JSON file. I need to pass JSON objects as in our env I can't create a json file. I don't want to use attributes/role/environment files

【Codechef】Chef and Triangles -Problem Code: MAKETRI

时光毁灭记忆、已成空白 提交于 2020-01-10 19:30:27
题面:   小明已经厌倦了做菜,做菜对他来说太简单了。这天,他决定要挑战一下自己。 他已经选择了 N 根意大利面,准备做一道菜。他还需要选出 一根 意大利面,使得这根意大利面可以和已有的 N 根面中的 某两根构成一个三角形 。选出的意大利面的长度必须在 [L, R] 的范围内。 请你求出小明选择的 方案数 。 输入:   第一行给出N,L,R。 第二行给出N个数len1,len2,...,lenN,表示N个意大利面的长度。    2<=N<=1e6 1<=L,R<=1e18,1<=leni<=1e18 输出:   输出方案数。 样例: Input: 5 1 4 1 2 3 4 5 Output: 3这题卡了我很久。毕竟我之前没做过这一类的题目。题意还是较为简单,不过就是从[L,R]的范围内能选出多少条条边与给出数组中的数凑成三角形。看到数据规模自然是不能暴力的,毕竟O(n2)加上1e6的规模必然会炸。首先毕竟题目是要凑三角形,我们必然就能想到三角形的性质:1.任意两边之和大于第三边2.任意两边之差小于第三边我们假设我们在[L,R]内取了x长度的边,之后又从给出的长度数组A中取了Ai与Aj长度的边。易得到以下的式子:·x + Ai > Aj ——> x > Aj - Ai·x + Aj > Ai ——> x > Ai - Aj·Ai + Aj > x ——> x < Ai +

To setup chef workstation

两盒软妹~` 提交于 2020-01-09 11:59:08
问题 Trying to setup chef workstation knife configure -i previous it worked but now its not working i am unable to create knife.rb it says the following error: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.10.0/lib/chef/config_fetcher.rb:53:in `realpath': Not a directory - /home/ubuntu/.chef/knife.rb (Errno::ENOTDIR) from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.10.0/lib/chef/config_fetcher.rb:53:in `realpath' from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.10.0/lib/chef

10个java开发工具,所有java开发人员都应该了解的工具

末鹿安然 提交于 2020-01-08 19:44:10
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 10 个 java开发 工具 , 所有java开发人员都应该了解的工具 1、 Groovy Groovy 是 用于Java虚拟机的一种敏捷的动态语言,它是一种成熟的面向对象编程语言,既可以用于面向对象编程,又可以用作纯粹的脚本语言。 为Java开发者提供了 现代最流行的编程语言特性,而且学习成本很低,支持DSL和其它简洁的语法,让代码变得易于阅读和维护。 Groovy拥有处理原生类型,面向对象以及一个Ant DSL,使得创建Shell Scripts变得非常简单。 大大提高了开发者的效率。 2、 Rest-assured 是Java领域特定语言(DSL domain-specific language)用来测试REST服务,它简单易用易上手,甚至对于没有用过Java的开发者也是难以置信的强大。它提供先进的特性,比如细节配置、过滤器、定制分析、跨站请求伪造(CSRF)和OAuth 2.0。它提供非常简单的语法:given-when-then。 3、 Chef 这是基础架构自动化的另一个很棒的工具,例如构建新服务器和安装应用程序。Chef是一个用Ruby和Erlang 编写的配置管理工具。 它使用纯Ruby特定于域的语言来编写系统配置“recipes”。使用Chef,您可以轻松管理大量服务的服务器。 4、