Update ark cookbook
This commit is contained in:
		
							parent
							
								
									943b4ace1f
								
							
						
					
					
						commit
						180b3f5df0
					
				
							
								
								
									
										2
									
								
								Batali
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Batali
									
									
									
									
									
								
							| @ -35,7 +35,7 @@ Batali.define do | ||||
|   cookbook 'chef_client_updater',   '~> 1.0.2' | ||||
|   cookbook 'timezone-ii' | ||||
|   cookbook 'nodejs',          '~> 3.0.0' | ||||
|   cookbook 'ark' | ||||
|   cookbook 'ark',             '~> 3.0.0' | ||||
|   cookbook 'logrotate' | ||||
|   cookbook 'openssl',         '~> 7.0.1' | ||||
| end | ||||
|  | ||||
| @ -1035,6 +1035,18 @@ | ||||
|         "version": "3.0.0" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "name": "homebrew", | ||||
|       "dependencies": [ | ||||
| 
 | ||||
|       ], | ||||
|       "version": "3.0.0", | ||||
|       "source": { | ||||
|         "type": "Batali::Source::Site", | ||||
|         "url": "https://supermarket.chef.io:443/api/v1/cookbooks/homebrew/versions/3.0.0/download", | ||||
|         "version": "3.0.0" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "name": "ark", | ||||
|       "dependencies": [ | ||||
| @ -1050,23 +1062,11 @@ | ||||
|           "seven_zip", | ||||
|           ">= 0.0.0" | ||||
|         ] | ||||
|       ], | ||||
|       "version": "2.2.1", | ||||
|       "source": { | ||||
|         "type": "Batali::Source::Site", | ||||
|         "url": "https://supermarket.chef.io:443/api/v1/cookbooks/ark/versions/2.2.1/download", | ||||
|         "version": "2.2.1" | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
|       "name": "homebrew", | ||||
|       "dependencies": [ | ||||
| 
 | ||||
|       ], | ||||
|       "version": "3.0.0", | ||||
|       "source": { | ||||
|         "type": "Batali::Source::Site", | ||||
|         "url": "https://supermarket.chef.io:443/api/v1/cookbooks/homebrew/versions/3.0.0/download", | ||||
|         "url": "https://supermarket.chef.io:443/api/v1/cookbooks/ark/versions/3.0.0/download", | ||||
|         "version": "3.0.0" | ||||
|       } | ||||
|     }, | ||||
|  | ||||
							
								
								
									
										1
									
								
								cookbooks/ark/.foodcritic
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cookbooks/ark/.foodcritic
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| ~FC016 | ||||
| @ -2,6 +2,11 @@ | ||||
| 
 | ||||
| This file is used to list changes made in each version of the ark cookbook. | ||||
| 
 | ||||
| ## 3.0.0 (2017-04-05) | ||||
| - Rewrite of resource to custom resources. | ||||
| - Remove EOL platforms from testing. | ||||
| - Update zlib URL | ||||
| -  | ||||
| ## 2.2.1 (2016-12-16) | ||||
| - Use Ohai root_group attribute to avoid trying to set the group to root on BSD/macOS. | ||||
| - Add missing accessor for owner property | ||||
|  | ||||
| @ -16,7 +16,7 @@ ark 'pig' do | ||||
| end | ||||
| ``` | ||||
| 
 | ||||
| The provider will: | ||||
| The `ark` resource will: | ||||
| 
 | ||||
| - fetch it to to `/var/cache/chef/` | ||||
| - unpack it to the default path (`/usr/local/pig-0.8.0`) | ||||
| @ -44,7 +44,7 @@ Should work on common Unix/Linux systems with typical userland utilities like ta | ||||
| 
 | ||||
| ### Chef | ||||
| 
 | ||||
| - Chef 12.1+ | ||||
| - Chef 12.5+ | ||||
| 
 | ||||
| ### Cookbooks | ||||
| 
 | ||||
| @ -66,7 +66,7 @@ Customize the attributes to suit site specific conventions and defaults. | ||||
| 
 | ||||
| ## Resources | ||||
| 
 | ||||
| - `ark` - does the extract/build/configure dance | ||||
| - `ark` - does the extract/build/configure  | ||||
| 
 | ||||
| ### Actions | ||||
| 
 | ||||
| @ -281,7 +281,7 @@ You can also supply the file extension in case the file extension can not be det | ||||
| - Copyright: 2011, Philip (flip) Kromer - Infochimps, Inc | ||||
| - Copyright: 2012, Bryan W. Berry | ||||
| - Copyright: 2012, Denis Barishev | ||||
| - Copyright: 2013-2016, Chef Software, Inc | ||||
| - Copyright: 2013-2017, Chef Software, Inc | ||||
| - Copyright: 2014, Bloomberg L.P. | ||||
| 
 | ||||
| ``` | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| # | ||||
| # Cookbook Name:: ark | ||||
| # Cookbook:: ark | ||||
| # Attributes:: default | ||||
| # | ||||
| # | ||||
|  | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -1,503 +0,0 @@ | ||||
| # | ||||
| # Cookbook Name:: ark | ||||
| # Provider:: Ark | ||||
| # | ||||
| # Author:: Bryan W. Berry <bryan.berry@gmail.com> | ||||
| # Author:: Sean OMeara <someara@chef.io | ||||
| # Author:: John Bellone <jbellone@bloomberg.net> | ||||
| # Copyright 2012, Bryan W. Berry | ||||
| # Copyright 2013-2016, Chef Software, Inc. | ||||
| # Copyright 2014, Bloomberg L.P. | ||||
| # | ||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| # you may not use this file except in compliance with the License. | ||||
| # You may obtain a copy of the License at | ||||
| # | ||||
| #     http://www.apache.org/licenses/LICENSE-2.0 | ||||
| # | ||||
| # Unless required by applicable law or agreed to in writing, software | ||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| # See the License for the specific language governing permissions and | ||||
| # limitations under the License. | ||||
| # | ||||
| 
 | ||||
| use_inline_resources | ||||
| include ::Ark::ProviderHelpers | ||||
| 
 | ||||
| ################# | ||||
| # action :install | ||||
| ################# | ||||
| action :install do | ||||
|   show_deprecations | ||||
|   set_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug('DEBUG: new_resource.release_file') | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|     backup new_resource.backup | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # usually on windows there is no central directory with executables where the applications are linked | ||||
|   unless node['platform_family'] == 'windows' | ||||
|     # symlink binaries | ||||
|     new_resource.has_binaries.each do |bin| | ||||
|       link ::File.join(new_resource.prefix_bin, ::File.basename(bin)) do | ||||
|         to ::File.join(new_resource.path, bin) | ||||
|       end | ||||
|     end | ||||
| 
 | ||||
|     # action_link_paths | ||||
|     link new_resource.home_dir do | ||||
|       to new_resource.path | ||||
|     end | ||||
| 
 | ||||
|     # Add to path for interactive bash sessions | ||||
|     template "/etc/profile.d/#{new_resource.name}.sh" do | ||||
|       cookbook 'ark' | ||||
|       source 'add_to_path.sh.erb' | ||||
|       owner 'root' | ||||
|       group node['root_group'] | ||||
|       mode '0755' | ||||
|       cookbook 'ark' | ||||
|       variables(directory: "#{new_resource.path}/bin") | ||||
|       only_if { new_resource.append_env_path } | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   # Add to path for the current chef-client converge. | ||||
|   bin_path = ::File.join(new_resource.path, 'bin') | ||||
|   ruby_block "adding '#{bin_path}' to chef-client ENV['PATH']" do | ||||
|     block do | ||||
|       ENV['PATH'] = bin_path + ':' + ENV['PATH'] | ||||
|     end | ||||
|     only_if do | ||||
|       new_resource.append_env_path && ENV['PATH'].scan(bin_path).empty? | ||||
|     end | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| ############## | ||||
| # action :put | ||||
| ############## | ||||
| action :put do | ||||
|   show_deprecations | ||||
|   set_put_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # download | ||||
|   remote_file new_resource.release_file do | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|     backup new_resource.backup | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| ########################### | ||||
| # action :dump | ||||
| ########################### | ||||
| action :dump do | ||||
|   show_deprecations | ||||
|   set_dump_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # download | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug("DEBUG: new_resource.release_file #{new_resource.release_file}") | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command dump_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| ########################### | ||||
| # action :unzip | ||||
| ########################### | ||||
| action :unzip do | ||||
|   show_deprecations | ||||
|   set_dump_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # download | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug("DEBUG: new_resource.release_file #{new_resource.release_file}") | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unzip_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| ##################### | ||||
| # action :cherry_pick | ||||
| ##################### | ||||
| action :cherry_pick do | ||||
|   show_deprecations | ||||
|   set_dump_paths | ||||
|   Chef::Log.debug("DEBUG: new_resource.creates #{new_resource.creates}") | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[cherry_pick #{new_resource.creates} from #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # download | ||||
|   remote_file new_resource.release_file do | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[cherry_pick #{new_resource.creates} from #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   execute "cherry_pick #{new_resource.creates} from #{new_resource.release_file}" do | ||||
|     command cherry_pick_command | ||||
|     creates "#{new_resource.path}/#{new_resource.creates}" | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| ########################### | ||||
| # action :install_with_make | ||||
| ########################### | ||||
| action :install_with_make do | ||||
|   show_deprecations | ||||
|   set_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug('DEBUG: new_resource.release_file') | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     notifies :run, "execute[autogen #{new_resource.path}]" | ||||
|     notifies :run, "execute[configure #{new_resource.path}]" | ||||
|     notifies :run, "execute[make #{new_resource.path}]" | ||||
|     notifies :run, "execute[make install #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "autogen #{new_resource.path}" do | ||||
|     command './autogen.sh' | ||||
|     only_if { ::File.exist? "#{new_resource.path}/autogen.sh" } | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|     ignore_failure true | ||||
|   end | ||||
| 
 | ||||
|   execute "configure #{new_resource.path}" do | ||||
|     command "./configure #{new_resource.autoconf_opts.join(' ')}" | ||||
|     only_if { ::File.exist? "#{new_resource.path}/configure" } | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "make #{new_resource.path}" do | ||||
|     command "make #{new_resource.make_opts.join(' ')}" | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "make install #{new_resource.path}" do | ||||
|     command "make install #{new_resource.make_opts.join(' ')}" | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| action :setup_py_build do | ||||
|   show_deprecations | ||||
|   set_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug('DEBUG: new_resource.release_file') | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     notifies :run, "execute[python setup.py build #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "python setup.py build #{new_resource.path}" do | ||||
|     command "python setup.py build #{new_resource.make_opts.join(' ')}" | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| action :setup_py_install do | ||||
|   show_deprecations | ||||
|   set_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug('DEBUG: new_resource.release_file') | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     notifies :run, "execute[python setup.py install #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "python setup.py install #{new_resource.path}" do | ||||
|     command "python setup.py install #{new_resource.make_opts.join(' ')}" | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| action :setup_py do | ||||
|   show_deprecations | ||||
|   set_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug('DEBUG: new_resource.release_file') | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     notifies :run, "execute[python setup.py #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "python setup.py #{new_resource.path}" do | ||||
|     command "python setup.py #{new_resource.make_opts.join(' ')}" | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| action :configure do | ||||
|   show_deprecations | ||||
|   set_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug('DEBUG: new_resource.release_file') | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     notifies :run, "execute[autogen #{new_resource.path}]" | ||||
|     notifies :run, "execute[configure #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "autogen #{new_resource.path}" do | ||||
|     command './autogen.sh' | ||||
|     only_if { ::File.exist? "#{new_resource.path}/autogen.sh" } | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|     ignore_failure true | ||||
|   end | ||||
| 
 | ||||
|   execute "configure #{new_resource.path}" do | ||||
|     command "./configure #{new_resource.autoconf_opts.join(' ')}" | ||||
|     only_if { ::File.exist? "#{new_resource.path}/configure" } | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| @ -1,9 +1,9 @@ | ||||
| # | ||||
| # Cookbook Name:: ark | ||||
| # Cookbook:: ark | ||||
| # Recipe:: default | ||||
| # | ||||
| # Author:: Bryan W. Berry <bryan.berry@gmail.com> | ||||
| # Copyright 2012, Bryan W. Berry | ||||
| # Copyright:: 2012-2017, Bryan W. Berry | ||||
| # | ||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| # you may not use this file except in compliance with the License. | ||||
|  | ||||
| @ -1,9 +1,10 @@ | ||||
| # | ||||
| # Cookbook Name:: ark | ||||
| # Cookbook:: ark | ||||
| # Resource:: Ark | ||||
| # | ||||
| # Author:: Bryan W. Berry <bryan.berry@gmail.com> | ||||
| # Copyright 2012, Bryan W. Berry | ||||
| # Copyright:: 2012-2017, Bryan W. Berry | ||||
| # Copyright:: 2016-2017, Chef Software Inc. | ||||
| # | ||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| # you may not use this file except in compliance with the License. | ||||
| @ -18,53 +19,510 @@ | ||||
| # limitations under the License. | ||||
| # | ||||
| 
 | ||||
| actions( | ||||
|   :cherry_pick, | ||||
|   :configure, | ||||
|   :dump, | ||||
|   :install, | ||||
|   :install_with_make, | ||||
|   :put, | ||||
|   :setup_py, | ||||
|   :setup_py_build, | ||||
|   :setup_py_install, | ||||
|   :unzip | ||||
| ) | ||||
| property :owner, String | ||||
| property :group, [String, Integer], default: 0 | ||||
| property :url, String, required: true | ||||
| property :path, String | ||||
| property :full_path, String | ||||
| property :append_env_path, [true, false], default: false | ||||
| property :checksum, regex: /^[a-zA-Z0-9]{64}$/, default: nil | ||||
| property :has_binaries, Array, default: [] | ||||
| property :creates, String | ||||
| property :release_file, String, default: '' | ||||
| property :strip_leading_dir, [true, false, NilClass] | ||||
| property :strip_components, Integer, default: 1 | ||||
| property :mode, [Integer, String], default: 0755 | ||||
| property :prefix_root, String | ||||
| property :prefix_home, String | ||||
| property :prefix_bin, String | ||||
| property :version, String | ||||
| property :home_dir, String | ||||
| property :win_install_dir, String | ||||
| property :environment, Hash, default: {} | ||||
| property :autoconf_opts, Array, default: [] | ||||
| property :make_opts, Array, default: [] | ||||
| property :home_dir, String | ||||
| property :autoconf_opts, Array, default: [] | ||||
| property :extension, String | ||||
| property :backup, [FalseClass, Integer], default: 5 | ||||
| 
 | ||||
| default_action :install | ||||
| ################# | ||||
| # action :install | ||||
| ################# | ||||
| action :install do | ||||
|   show_deprecations | ||||
|   set_paths | ||||
| 
 | ||||
| attr_accessor :extension, | ||||
|   :home_dir, | ||||
|   :owner, | ||||
|   :path, | ||||
|   :prefix_bin, | ||||
|   :prefix_root, | ||||
|   :release_file, | ||||
|   :version | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
| attribute :owner, kind_of: String, default: nil | ||||
| attribute :group, kind_of: [String, Integer], default: 0 | ||||
| attribute :url, kind_of: String, required: true | ||||
| attribute :path, kind_of: String, default: nil | ||||
| attribute :full_path, kind_of: String, default: nil | ||||
| attribute :append_env_path, kind_of: [TrueClass, FalseClass], default: false | ||||
| attribute :checksum, regex: /^[a-zA-Z0-9]{64}$/, default: nil | ||||
| attribute :has_binaries, kind_of: Array, default: [] | ||||
| attribute :creates, kind_of: String, default: nil | ||||
| attribute :release_file, kind_of: String, default: '' | ||||
| attribute :strip_leading_dir, kind_of: [TrueClass, FalseClass, NilClass] | ||||
| attribute :strip_components, kind_of: Integer, default: 1 | ||||
| attribute :mode, kind_of: Integer, default: 0755 | ||||
| attribute :prefix_root, kind_of: String, default: nil | ||||
| attribute :prefix_home, kind_of: String, default: nil | ||||
| attribute :prefix_bin, kind_of: String, default: nil | ||||
| attribute :version, kind_of: String, default: nil | ||||
| attribute :home_dir, kind_of: String, default: nil | ||||
| attribute :win_install_dir, kind_of: String, default: nil | ||||
| attribute :environment, kind_of: Hash, default: {} | ||||
| attribute :autoconf_opts, kind_of: Array, default: [] | ||||
| attribute :make_opts, kind_of: Array, default: [] | ||||
| attribute :home_dir, kind_of: String, default: nil | ||||
| attribute :autoconf_opts, kind_of: Array, default: [] | ||||
| attribute :extension, kind_of: String | ||||
| attribute :backup, kind_of: [FalseClass, Integer], default: 5 | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug('DEBUG: new_resource.release_file') | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|     backup new_resource.backup | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # usually on windows there is no central directory with executables where the applications are linked | ||||
|   unless node['platform_family'] == 'windows' | ||||
|     # symlink binaries | ||||
|     new_resource.has_binaries.each do |bin| | ||||
|       link ::File.join(new_resource.prefix_bin, ::File.basename(bin)) do | ||||
|         to ::File.join(new_resource.path, bin) | ||||
|       end | ||||
|     end | ||||
| 
 | ||||
|     # action_link_paths | ||||
|     link new_resource.home_dir do | ||||
|       to new_resource.path | ||||
|     end | ||||
| 
 | ||||
|     # Add to path for interactive bash sessions | ||||
|     template "/etc/profile.d/#{new_resource.name}.sh" do | ||||
|       cookbook 'ark' | ||||
|       source 'add_to_path.sh.erb' | ||||
|       owner 'root' | ||||
|       group node['root_group'] | ||||
|       mode '0755' | ||||
|       cookbook 'ark' | ||||
|       variables(directory: "#{new_resource.path}/bin") | ||||
|       only_if { new_resource.append_env_path } | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   # Add to path for the current chef-client converge. | ||||
|   bin_path = ::File.join(new_resource.path, 'bin') | ||||
|   ruby_block "adding '#{bin_path}' to chef-client ENV['PATH']" do | ||||
|     block do | ||||
|       ENV['PATH'] = bin_path + ':' + ENV['PATH'] | ||||
|     end | ||||
|     only_if do | ||||
|       new_resource.append_env_path && ENV['PATH'].scan(bin_path).empty? | ||||
|     end | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| ############## | ||||
| # action :put | ||||
| ############## | ||||
| action :put do | ||||
|   show_deprecations | ||||
|   set_put_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # download | ||||
|   remote_file new_resource.release_file do | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|     backup new_resource.backup | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| ########################### | ||||
| # action :dump | ||||
| ########################### | ||||
| action :dump do | ||||
|   show_deprecations | ||||
|   set_dump_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # download | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug("DEBUG: new_resource.release_file #{new_resource.release_file}") | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command dump_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| ########################### | ||||
| # action :unzip | ||||
| ########################### | ||||
| action :unzip do | ||||
|   show_deprecations | ||||
|   set_dump_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # download | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug("DEBUG: new_resource.release_file #{new_resource.release_file}") | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unzip_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| ##################### | ||||
| # action :cherry_pick | ||||
| ##################### | ||||
| action :cherry_pick do | ||||
|   show_deprecations | ||||
|   set_dump_paths | ||||
|   Chef::Log.debug("DEBUG: new_resource.creates #{new_resource.creates}") | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[cherry_pick #{new_resource.creates} from #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # download | ||||
|   remote_file new_resource.release_file do | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[cherry_pick #{new_resource.creates} from #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   execute "cherry_pick #{new_resource.creates} from #{new_resource.release_file}" do | ||||
|     command cherry_pick_command | ||||
|     creates "#{new_resource.path}/#{new_resource.creates}" | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| ########################### | ||||
| # action :install_with_make | ||||
| ########################### | ||||
| action :install_with_make do | ||||
|   show_deprecations | ||||
|   set_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug('DEBUG: new_resource.release_file') | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     notifies :run, "execute[autogen #{new_resource.path}]" | ||||
|     notifies :run, "execute[configure #{new_resource.path}]" | ||||
|     notifies :run, "execute[make #{new_resource.path}]" | ||||
|     notifies :run, "execute[make install #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "autogen #{new_resource.path}" do | ||||
|     command './autogen.sh' | ||||
|     only_if { ::File.exist? "#{new_resource.path}/autogen.sh" } | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|     ignore_failure true | ||||
|   end | ||||
| 
 | ||||
|   execute "configure #{new_resource.path}" do | ||||
|     command "./configure #{new_resource.autoconf_opts.join(' ')}" | ||||
|     only_if { ::File.exist? "#{new_resource.path}/configure" } | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "make #{new_resource.path}" do | ||||
|     command "make #{new_resource.make_opts.join(' ')}" | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "make install #{new_resource.path}" do | ||||
|     command "make install #{new_resource.make_opts.join(' ')}" | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| action :setup_py_build do | ||||
|   show_deprecations | ||||
|   set_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug('DEBUG: new_resource.release_file') | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     notifies :run, "execute[python setup.py build #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "python setup.py build #{new_resource.path}" do | ||||
|     command "python setup.py build #{new_resource.make_opts.join(' ')}" | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| action :setup_py_install do | ||||
|   show_deprecations | ||||
|   set_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug('DEBUG: new_resource.release_file') | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     notifies :run, "execute[python setup.py install #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "python setup.py install #{new_resource.path}" do | ||||
|     command "python setup.py install #{new_resource.make_opts.join(' ')}" | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| action :setup_py do | ||||
|   show_deprecations | ||||
|   set_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug('DEBUG: new_resource.release_file') | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     notifies :run, "execute[python setup.py #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "python setup.py #{new_resource.path}" do | ||||
|     command "python setup.py #{new_resource.make_opts.join(' ')}" | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| action :configure do | ||||
|   show_deprecations | ||||
|   set_paths | ||||
| 
 | ||||
|   directory new_resource.path do | ||||
|     recursive true | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   remote_file new_resource.release_file do | ||||
|     Chef::Log.debug('DEBUG: new_resource.release_file') | ||||
|     source new_resource.url | ||||
|     checksum new_resource.checksum if new_resource.checksum | ||||
|     action :create | ||||
|     notifies :run, "execute[unpack #{new_resource.release_file}]" | ||||
|   end | ||||
| 
 | ||||
|   # unpack based on file extension | ||||
|   execute "unpack #{new_resource.release_file}" do | ||||
|     command unpack_command | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     notifies :run, "execute[set owner on #{new_resource.path}]" | ||||
|     notifies :run, "execute[autogen #{new_resource.path}]" | ||||
|     notifies :run, "execute[configure #{new_resource.path}]" | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   # set_owner | ||||
|   execute "set owner on #{new_resource.path}" do | ||||
|     command owner_command | ||||
|     action :nothing | ||||
|   end | ||||
| 
 | ||||
|   execute "autogen #{new_resource.path}" do | ||||
|     command './autogen.sh' | ||||
|     only_if { ::File.exist? "#{new_resource.path}/autogen.sh" } | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|     ignore_failure true | ||||
|   end | ||||
| 
 | ||||
|   execute "configure #{new_resource.path}" do | ||||
|     command "./configure #{new_resource.autoconf_opts.join(' ')}" | ||||
|     only_if { ::File.exist? "#{new_resource.path}/configure" } | ||||
|     cwd new_resource.path | ||||
|     environment new_resource.environment | ||||
|     action :nothing | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| action_class.class_eval do | ||||
|   include ::Ark::ProviderHelpers | ||||
| end | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user