github.com/go-chef/chef@v0.30.1/test_chef_server/recipes/chef_objects.rb (about) 1 # Add chef objects to the server for testing 2 3 # Create an organization 4 execute 'create test organization' do 5 command '/opt/opscode/bin/chef-server-ctl org-create test test_org' 6 ignore_failure true 7 not_if '/opt/opscode/bin/chef-server-ctl org-list | grep test' 8 end 9 10 execute 'get the ssl certificate for the chef server' do 11 command '/opt/opscode/bin/knife ssl fetch' 12 ignore_failure true 13 not_if { ::File.exist? '/root/.chef/trusted_certs/localhost' } 14 end 15 16 # Register this node with the server 17 directory '/etc/chef' 18 file '/etc/chef/client.rb' do 19 content ' 20 chef_server_url "https://localhost/organizations/test" 21 client_fork true 22 file_backup_path "/var/chef/backup" 23 file_cache_path "/var/chef/cache" 24 log_location "/var/log/chef/client.log" 25 nodename "localhost" 26 validation_client_name "pivotal" 27 validation_key "/etc/opscode/pivotal.pem" 28 trusted_certs_dir "/root/.chef/trusted_certs" 29 ohai.disabled_plugins = [:C,:Cloud,:Rackspace,:Eucalyptus,:Command,:DMI,:Erlang,:Groovy,:IpScopes,:Java,:Lua,:Mono,:NetworkListeners,:Passwd,:Perl,:PHP,:Python] 30 ' 31 end 32 33 directory '/fixtures/bin' do 34 recursive true 35 end 36 37 directory '/fixtures/chef/cookbooks' do 38 recursive true 39 end 40 41 cookbook_file '/fixtures/bin/chef_objects.sh' do 42 source 'chef_objects.sh' 43 mode '0755' 44 end 45 46 remote_directory '/fixtures/chef/cb' do 47 source 'cb' 48 end 49 50 directory '/var/log/chef' do 51 recursive true 52 end 53 54 directory '/var/chef' do 55 recursive true 56 end 57 58 file '/etc/opscode/required' do 59 content "file '/tmp/required'" 60 mode '0600' 61 end 62 63 replace_or_add 'rr turn it on' do 64 path '/etc/opscode/chef-server.rb' 65 pattern "required_recipe['enable']" 66 line "required_recipe['enable'] = true" 67 end 68 69 replace_or_add 'rr set path' do 70 path '/etc/opscode/chef-server.rb' 71 pattern "required_recipe['path']" 72 line "required_recipe['path'] = '/etc/opscode/required'" 73 end 74 75 execute 'Change the chef options' do 76 command 'chef-server-ctl reconfigure' 77 end