chef

Mock Chef::ReservedNames::Win32::Version.new in Chef unit/rspec test? [continued]

心不动则不痛 提交于 2019-12-11 05:57:55
问题 Assuming, I have the following recipe: install_iis: require 'chef/win32/version' windows_version = Chef::ReservedNames::Win32::Version.new node.set['iis']['components'] = [ 'IIS-HttpErrors', 'IIS-HttpRedirect', 'IIS-HttpLogging', 'IIS-LoggingLibraries', 'IIS-RequestMonitor', 'WAS-WindowsActivationService', 'WAS-ProcessModel', 'IIS-StaticContent', 'IIS-DefaultDocument', 'IIS-DirectoryBrowsing' ] include_recipe 'iis::default' include_recipe 'iis::mod_aspnet' include_recipe 'iis::mod_auth_basic'

Infrastructure Compliance via Inspec

独自空忆成欢 提交于 2019-12-11 05:39:25
问题 I am describing in brief the CHEF usage in our env and what we wish to accomplish from Inspec. • We have two generic cookbooks available for Windows and Unix • These generic cookbooks have individual recipes, each of which has the logic defining one specific chef resource, e.g. directory creation, package install, etc. • Then; an application specific wrapper cookbook is created which consumes the generic cookbook. • The properties of the chef resources(ones which are defined in generic

Detect the Chef Client version in a Chef recipe

故事扮演 提交于 2019-12-11 04:28:23
问题 I am upgrading my cookbooks from Chef version 12.11.18 to 13.6.4. Some version 13 specific instructions do not work in Chef version 12 and vice versa. My existing servers still use Chef Client 12, but the new servers will launch with Chef version 13 in the same environment, so the same cookbook version should work with both versions of Chef. I need to detect the version of the Chef Client in a recipe and select the version specific code with an "if" statement. How can I read the version of

How to extend chef resource?

早过忘川 提交于 2019-12-11 04:09:57
问题 I'm trying to extend Bash resource, so that when I invoke shm_wbash , the command's output is placed in a log file as it runs. Since I don't want to copy all the available parameters to LWRP resource definition, I've tried to extend the original chef Bash resource like this (I'll be omitting the actual payload since that doesn't matter here): class Chef class Resource class WBash < Resource::Bash def initialize(name, run_context=nil) super puts 123 end end end end I've put that to cookbooks

Automate VIM EDITOR and update values using shell script (similar to editing crontab via shell script)

我怕爱的太早我们不能终老 提交于 2019-12-11 04:02:41
问题 I am trying to automate a VI edit for a command similar to crontab editing via Shell script but not working for me so far. Here is the final json with admin as true: '{"name":"SQLSRVR","admin":"true","json_class":"Chef::ApiClient","chef_type":"client"}' As you can see the EDITOR environment variable has to be set or passed as command line option -e [root@vrhost user]# knife client edit SQLSRVR ERROR: RuntimeError: Please set EDITOR environment variable [root@vrhost user]# knife client edit

OpsWorks - what to include in custom cookbook

∥☆過路亽.° 提交于 2019-12-11 04:01:19
问题 I'm new to chef and AWS OpsWorks. I want to create a custom cookbook in order to precompile assets in production and set cron jobs with the whenever gem. I found something about precompiling assets and I'll figure the cron part out as well, but I am confused how my custom chef project should look like. Is it a full chef solo project that will replace the standard cookbook(s) of AWS OpsWorks, thus I'll have to copy stuff from their github repo? Or will our and their cookbooks be merged? If so,

Installing SQL Server 2014 using chef community cookbook (sql_server)

◇◆丶佛笑我妖孽 提交于 2019-12-11 04:00:02
问题 I've had a look at the chef community cookbook for installing sql server and it appears that it's tailored for installing SQL express, but I can't seem to work out how to install a standard or developer edition. The README on the GitHub page (https://github.com/chef-cookbooks/sql_server) says you can just point it to any installation package, however I can't see how you would do this for an ISO (or even the extracted contents of an ISO) given that there's no single EXE package on the ISO

Issue with installing Postgres on Vagrant VM using Chef: undefined method `ruby' for Config:Module

谁都会走 提交于 2019-12-11 03:40:26
问题 That's how my Vagrantfile looks : config.vm.provision :chef_solo do |chef| chef.cookbooks_path = "cookbooks" chef.json = { postgresql: { password: { postgres: 'password' } }, database: { create: ['mydb'] }, 'build-essential' => { compiletime: true } } chef.run_list = ['recipe[build-essential]', 'recipe[openssl]', 'recipe[postgresql::server]', 'recipe[database::postgresql]'] end Also I used precise32 box. And while my VM starts after vagrant up , I get very long traceback with error message:

Cookbook name prefix when calling LWRP

五迷三道 提交于 2019-12-11 03:01:35
问题 Summary Can I use an LWRP from an external cookbook without prefixing the cookbooks name? For example, if mycookbook contains the mylwrp resource how can I do this? include_recipe 'mycookbook' # Contains "mylwrp" mylwrp "frobulator" do frobulations 42 end Details I have written an LWRP that gets the name mycookbook_mylwrp since the library cookbook uses the normal resources/provider layout as follows mycookbook/ ├── providers │ └── mylwrp.rb └── resources └── mylwrp.rb Would it be possible to

weblogic.Server to create domain but don't start it (Chef cookbook)

天大地大妈咪最大 提交于 2019-12-11 02:25:31
问题 As i'm working with Chef for automation, i'm required to create a cookbook for weblogic. The thing is that, when the cookbook is executed it hangs at the final step, and that's totally normal since that step runs weblogic.Server Java Class to create a new domain and then it runs the server. So, i want to run weblogic.Server to only create the domain and keep going with the last steps. Is there a way to do that? I have tried with the argument weblogic.management.startupMode = SHUTDOWN but it