Return-Path: X-Original-To: apmail-climate-commits-archive@minotaur.apache.org Delivered-To: apmail-climate-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9C71310F01 for ; Thu, 31 Oct 2013 15:02:58 +0000 (UTC) Received: (qmail 28190 invoked by uid 500); 31 Oct 2013 15:01:51 -0000 Delivered-To: apmail-climate-commits-archive@climate.apache.org Received: (qmail 28092 invoked by uid 500); 31 Oct 2013 15:01:46 -0000 Mailing-List: contact commits-help@climate.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@climate.incubator.apache.org Delivered-To: mailing list commits@climate.incubator.apache.org Received: (qmail 27872 invoked by uid 99); 31 Oct 2013 15:01:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Oct 2013 15:01:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_FILL_THIS_FORM_SHORT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Oct 2013 15:01:26 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 721BD2388C9B; Thu, 31 Oct 2013 15:00:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1537520 [26/34] - in /incubator/climate/branches/rcmet-2.1.2: ./ src/ src/main/ src/main/python/ src/main/python/bin/ src/main/python/docs/ src/main/python/docs/_static/ src/main/python/docs/_templates/ src/main/python/rcmes/ src/main/pyth... Date: Thu, 31 Oct 2013 14:59:54 -0000 To: commits@climate.incubator.apache.org From: pramirez@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131031150009.721BD2388C9B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apache2/templates/default/security.erb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apache2/templates/default/security.erb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apache2/templates/default/security.erb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apache2/templates/default/security.erb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,50 @@ +# +# Disable access to the entire file system except for the directories that +# are explicitly allowed later. +# +# This currently breaks the configurations that come with some web application +# Debian packages. It will be made the default for the release after lenny. +# +# +# AllowOverride None +# Order Deny,Allow +# Deny from all +# + + +# Changing the following options will not really affect the security of the +# server, but might make attacks slightly more difficult in some cases. + +# +# ServerTokens +# This directive configures what you return as the Server HTTP response +# Header. The default is 'Full' which sends information about the OS-Type +# and compiled in modules. +# Set to one of: Full | OS | Minimal | Minor | Major | Prod +# where Full conveys the most information, and Prod the least. +# +#ServerTokens Minimal +ServerTokens <%= node[:apache][:servertokens] %> + +# +# Optionally add a line containing the server version and virtual host +# name to server-generated pages (internal error documents, FTP directory +# listings, mod_status and mod_info output etc., but not CGI generated +# documents or custom error documents). +# Set to "EMail" to also include a mailto: link to the ServerAdmin. +# Set to one of: On | Off | EMail +# +#ServerSignature Off +ServerSignature <%= node[:apache][:serversignature] %> + +# +# Allow TRACE method +# +# Set to "extended" to also reflect the request body (only for testing and +# diagnostic purposes). +# +# Set to one of: On | Off | extended +# +#TraceEnable Off +TraceEnable <%= node[:apache][:traceenable] %> + Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apache2/templates/default/security.erb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apache2/templates/default/web_app.conf.erb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apache2/templates/default/web_app.conf.erb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apache2/templates/default/web_app.conf.erb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apache2/templates/default/web_app.conf.erb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,43 @@ + + ServerName <%= @params[:server_name] %> + ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %> + DocumentRoot <%= @params[:docroot] %> + RewriteEngine On + + > + Options FollowSymLinks + AllowOverride None + Order allow,deny + Allow from all + + + + Options FollowSymLinks + AllowOverride None + + + + SetHandler server-status + + Order Deny,Allow + Deny from all + Allow from 127.0.0.1 + + + LogLevel info + ErrorLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-error.log + CustomLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-access.log combined + + RewriteEngine On + RewriteLog <%= node[:apache][:log_dir] %>/<%= @application_name %>-rewrite.log + RewriteLogLevel 0 + + # Canonical host, <%= @params[:server_name] %> + RewriteCond %{HTTP_HOST} !^<%= @params[:server_name] %> [NC] + RewriteCond %{HTTP_HOST} !^$ + RewriteRule ^/(.*)$ http://<%= @params[:server_name] %>/$1 [L,R=301] + + RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f + RewriteCond %{SCRIPT_FILENAME} !maintenance.html + RewriteRule ^.*$ /system/maintenance.html [L] + \ No newline at end of file Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apache2/templates/default/web_app.conf.erb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-cacher URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-cacher?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-cacher (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-cacher Thu Oct 31 14:59:48 2013 @@ -0,0 +1,9 @@ +# apt-cacher startup configuration file + +# IMPORTANT: check the apt-cacher.conf file before using apt-cacher as daemon. + +# set to 1 to start the daemon at boot time +AUTOSTART=1 + +# extra settings to override the ones in apt-cacher.conf +# EXTRAOPT=" daemon_port=3142 limit=30 " Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-cacher ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-cacher.conf URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-cacher.conf?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-cacher.conf (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-cacher.conf Thu Oct 31 14:59:48 2013 @@ -0,0 +1,144 @@ +# This file has been modified by ./apt-proxy-to-apt-cacher +# Some lines may have been appended at the bottom of this file +# This file has been modified by /usr/share/apt-cacher/apt-proxy-to-apt-cacher +# Some lines may have been appended at the bottom of this file +################################################################# +# This is the config file for apt-cacher. On most Debian systems +# you can safely leave the defaults alone. +################################################################# + +# cache_dir is used to set the location of the local cache. This can +# become quite large, so make sure it is somewhere with plenty of space. +cache_dir=/var/cache/apt-cacher + +# The email address of the administrator is displayed in the info page +# and traffic reports. +admin_email=root@localhost + +# For the daemon startup settings please edit the file /etc/default/apt-cacher. + +# Daemon port setting, only useful in stand-alone mode. You need to run the +# daemon as root to use privileged ports (<1024). +daemon_port = 3142 + +# optional settings, user and group to run the daemon as. Make sure they have +# sufficient permissions on the cache and log directories. Comment the settings +# to run apt-cacher as the native user. +group=www-data +user=www-data + +# optional setting, binds the listening daemon to one specified IP. Use IP +# ranges for more advanced configuration, see below. +# daemon_addr=localhost + +# If your apt-cacher machine is directly exposed to the Internet and you are +# worried about unauthorised machines fetching packages through it, you can +# specify a list of IPv4 addresses which are allowed to use it and another +# list of IPv4 addresses which aren't. +# Localhost (127.0.0.1) is always allowed. Other addresses must be matched +# by allowed_hosts and not by denied_hosts to be permitted to use the cache. +# Setting allowed_hosts to "*" means "allow all". +# Otherwise the format is a comma-separated list containing addresses, +# optionally with masks (like 10.0.0.0/22), or ranges of addresses (two +# addresses separated by a hyphen, no masks, like '192.168.0.3-192.168.0.56'). +allowed_hosts=* +denied_hosts= + +# And similiarly for IPv6 with allowed_hosts_6 and denied_hosts_6. +# Note that IPv4-mapped IPv6 addresses (::ffff:w.x.y.z) are truncated to +# w.x.y.z and are handled as IPv4. +allowed_hosts_6=fec0::/16 +denied_hosts_6= + +# This thing can be done by Apache but is much simplier here - limit access to +# Debian mirrors based on server names in the URLs +#allowed_locations=ftp.uni-kl.de,ftp.nerim.net,debian.tu-bs.de + +# Apt-cacher can generate usage reports every 24 hours if you set this +# directive to 1. You can view the reports in a web browser by pointing +# to your cache machine with '/apt-cacher/report' on the end, like this: +# http://yourcache.example.com/apt-cacher/report +# Generating reports is very fast even with many thousands of logfile +# lines, so you can safely turn this on without creating much +# additional system load. +generate_reports=1 + +# Apt-cacher can clean up its cache directory every 24 hours if you set +# this directive to 1. Cleaning the cache can take some time to run +# (generally in the order of a few minutes) and removes all package +# files that are not mentioned in any existing 'Packages' lists. This +# has the effect of deleting packages that have been superseded by an +# updated 'Packages' list. +clean_cache=1 + +# The directory to use for apt-cacher access and error logs. +# The access log records every request in the format: +# date-time|client ip address|HIT/MISS/EXPIRED|object size|object name +# The error log is slightly more free-form, and is also used for debug +# messages if debug mode is turned on. +# Note that the old 'logfile' and 'errorfile' directives are +# deprecated: if you set them explicitly they will be honoured, but it's +# better to just get rid of them from old config files. +logdir=/var/log/apt-cacher + +# apt-cacher can use different methods to decide whether package lists need to +# be updated, +# A) looking at the age of the cached files +# B) getting HTTP header from server and comparing that with cached data. This +# method is more reliable and avoids desynchronisation of data and index files +# but needs to transfer few bytes from the server every time somebody requests +# the files ("apt-get update") +# Set the following value to the maximum age (in hours) for method A or to 0 +# for method B +expire_hours=0 + +# Apt-cacher can pass all its requests to an external http proxy like +# Squid, which could be very useful if you are using an ISP that blocks +# port 80 and requires all web traffic to go through its proxy. The +# format is 'hostname:port', eg: 'proxy.example.com:8080'. +http_proxy=proxy.example.com:8080 + +# Use of an external proxy can be turned on or off with this flag. +# Value should be either 0 (off) or 1 (on). +use_proxy=0 + +# External http proxy sometimes need authentication to get full access. The +# format is 'username:password'. +http_proxy_auth=proxyuser:proxypass + +# Use of external proxy authentication can be turned on or off with this flag. +# Value should be either 0 (off) or 1 (on). +use_proxy_auth=0 + +# Rate limiting sets the maximum bandwidth in bytes per second to use +# for fetching packages. Syntax is fully defined in 'man wget'. +# Use 'k' or 'm' to use kilobits or megabits / second: eg, 'limit=25k'. +# Use 0 or a negative value for no rate limiting. +limit=0 + +# Debug mode makes apt-cacher spew a lot of extra debug junk to the +# error log (whose location is defined with the 'logdir' directive). +# Leave this off unless you need it, or your error log will get very +# big. Acceptable values are 0 or 1. +debug=0 + +# Adapt the line in the usage info web page to match your server configuration +# example_sources_line=deb http://my.cacher.server:3142/ftp.au.debian.org/debian unstable main contrib non-free + +# Print a 410 (Gone) HTTP message with the specified text when accessed via +# CGI. Useful to tell users to adapt their sources.list files when the +# apt-cacher server is beeing relocated (via apt-get's error messages while +# running "update") +#cgi_advise_to_use = Please use http://cacheserver:3142/ as apt-cacher access URL +#cgi_advise_to_use = Server relocated. To change sources.list, run perl -pe "s,/apt-cacher\??,:3142," -i /etc/apt/sources.list + +# Server mapping - this allows to hide real server names behind virtual paths +# that appear in the access URL. This method is known from apt-proxy. This is +# also the only method to use FTP access to the target hosts. The syntax is simple, the part of the beginning to replace, followed by a list of mirror urls, all space separated. Multiple profile are separated by semicolons +# path_map = debian ftp.uni-kl.de/pub/linux/debian ftp2.de.debian.org/debian ; ubuntu archive.ubuntu.com/ubuntu ; security security.debian.org/debian-security ftp2.de.debian.org/debian-security +# Note that you need to specify all target servers in the allowed_locations +# options if you make use of it. Also note that the paths should not overlap +# each other. FTP access method not supported yet, maybe in the future. + +# extra setting from apt-proxy configuration +path_map = ubuntu us.archive.ubuntu.com/ubuntu ; ubuntu-security security.ubuntu.com/ubuntu ; debian debian.osuosl.org/debian/ ; security security.debian.org/debian-security Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-cacher.conf ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-proxy-v2.conf URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-proxy-v2.conf?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-proxy-v2.conf (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-proxy-v2.conf Thu Oct 31 14:59:48 2013 @@ -0,0 +1,50 @@ +[DEFAULT] +;; All times are in seconds, but you can add a suffix +;; for minutes(m), hours(h) or days(d) + +;; commented out address so apt-proxy will listen on all IPs +;; address = 127.0.0.1 +port = 9999 +cache_dir = /var/cache/apt-proxy + +;; Control files (Packages/Sources/Contents) refresh rate +min_refresh_delay = 1s +complete_clientless_downloads = 1 + +;; Debugging settings. +debug = all:4 db:0 + +time = 30 +passive_ftp = on + +;;-------------------------------------------------------------- +;; Cache housekeeping + +cleanup_freq = 1d +max_age = 120d +max_versions = 3 + +;;--------------------------------------------------------------- +;; Backend servers +;; +;; Place each server in its own [section] + +[ubuntu] +; Ubuntu archive +backends = + http://us.archive.ubuntu.com/ubuntu + +[ubuntu-security] +; Ubuntu security updates +backends = http://security.ubuntu.com/ubuntu + +[debian] +;; Backend servers, in order of preference +backends = + http://debian.osuosl.org/debian/ + +[security] +;; Debian security archive +backends = + http://security.debian.org/debian-security + http://ftp2.de.debian.org/debian-security Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/files/default/apt-proxy-v2.conf ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/metadata.json URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/metadata.json?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/metadata.json (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/metadata.json Thu Oct 31 14:59:48 2013 @@ -0,0 +1,37 @@ +{ + "dependencies": { + }, + "replacing": { + }, + "description": "Configures apt and apt services", + "groupings": { + }, + "platforms": { + "ubuntu": [ + + ], + "debian": [ + + ] + }, + "version": "0.8.0", + "recommendations": { + }, + "name": "apt", + "maintainer": "Opscode, Inc.", + "long_description": "", + "recipes": { + "apt::proxy": "Set up an APT proxy", + "apt::cacher": "Set up an APT cache" + }, + "suggestions": { + }, + "maintainer_email": "cookbooks@opscode.com", + "attributes": { + }, + "conflicting": { + }, + "license": "Apache 2.0", + "providing": { + } + } \ No newline at end of file Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/metadata.json ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/metadata.rb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/metadata.rb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/metadata.rb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/metadata.rb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,11 @@ +maintainer "Opscode, Inc." +maintainer_email "cookbooks@opscode.com" +license "Apache 2.0" +description "Configures apt and apt services" +version "0.8" +recipe "apt::cacher", "Set up an APT cache" +recipe "apt::proxy", "Set up an APT proxy" + +%w{ ubuntu debian }.each do |os| + supports os +end Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/metadata.rb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/cacher.rb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/cacher.rb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/cacher.rb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/cacher.rb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,42 @@ +# +# Cookbook Name:: apt +# Recipe:: cacher +# +# Copyright 2008-2009, Opscode, Inc. +# +# 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. +# +package "apt-cacher" do + action :install +end + +service "apt-cacher" do + supports :restart => true, :status => false + action [ :enable, :start ] +end + +remote_file "/etc/apt-cacher/apt-cacher.conf" do + source "apt-cacher.conf" + owner "root" + group "root" + mode 0644 + notifies :restart, resources(:service => "apt-cacher") +end + +remote_file "/etc/default/apt-cacher" do + source "apt-cacher" + owner "root" + group "root" + mode 0644 + notifies :restart, resources(:service => "apt-cacher") +end Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/cacher.rb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/default.rb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/default.rb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/default.rb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/default.rb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,33 @@ +# +# Cookbook Name:: apt +# Recipe:: default +# +# Copyright 2008-2009, Opscode, Inc. +# +# 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. +# + +e = execute "apt-get update" do + action :nothing +end + +e.run_action(:run) + +%w{/var/cache/local /var/cache/local/preseeding}.each do |dirname| + directory dirname do + owner "root" + group "root" + mode 0755 + action :create + end +end Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/default.rb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/proxy.rb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/proxy.rb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/proxy.rb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/proxy.rb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,34 @@ +# +# Cookbook Name:: apt +# Recipe:: proxy +# +# Copyright 2008-2009, Opscode, Inc. +# +# 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. +# +package "apt-proxy" do + action :install +end + +service "apt-proxy" do + supports :restart => true, :status => false + action [ :enable, :start ] +end + +remote_file "/etc/apt-proxy/apt-proxy-v2.conf" do + source "apt-proxy-v2.conf" + owner "root" + group "root" + mode 0644 + notifies :restart, resources(:service => "apt-proxy") +end Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/apt/recipes/proxy.rb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/CHANGELOG.md URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/CHANGELOG.md?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/CHANGELOG.md (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/CHANGELOG.md Thu Oct 31 14:59:48 2013 @@ -0,0 +1,15 @@ +## v1.1.2: + +* [COOK-1620] - support OS X 10.8 + +## v1.1.0: + +* [COOK-1098] - support amazon linux +* [COOK-1149] - support Mac OS X +* [COOK-1296] - allow for compile-time installation of packages + through an attribute (see README) + +## v1.0.2: + +* [COOK-1098] - Add Amazon Linux platform support +* [COOK-1149] - Add OS X platform support Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/CHANGELOG.md ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/CONTRIBUTING URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/CONTRIBUTING?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/CONTRIBUTING (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/CONTRIBUTING Thu Oct 31 14:59:48 2013 @@ -0,0 +1,29 @@ +If you would like to contribute, please open a ticket in JIRA: + +* http://tickets.opscode.com + +Create the ticket in the COOK project and use the cookbook name as the +component. + +For all code contributions, we ask that contributors sign a +contributor license agreement (CLA). Instructions may be found here: + +* http://wiki.opscode.com/display/chef/How+to+Contribute + +When contributing changes to individual cookbooks, please do not +modify the version number in the metadata.rb. Also please do not +update the CHANGELOG.md for a new version. Not all changes to a +cookbook may be merged and released in the same versions. Opscode will +handle the version updates during the release process. You are welcome +to correct typos or otherwise make updates to documentation in the +README. + +If a contribution adds new platforms or platform versions, indicate +such in the body of the commit message(s), and update the relevant +COOK ticket. When writing commit messages, it is helpful for others if +you indicate the COOK ticket. For example: + + git commit -m '[COOK-1041] Updated pool resource to correctly delete.' + +In the ticket itself, it is also helpful if you include log output of +a successful Chef run, but this is not absolutely required. Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/CONTRIBUTING ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/LICENSE URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/LICENSE?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/LICENSE (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/LICENSE Thu Oct 31 14:59:48 2013 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/LICENSE ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/README.md URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/README.md?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/README.md (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/README.md Thu Oct 31 14:59:48 2013 @@ -0,0 +1,124 @@ +Description +=========== + +Installs packages required for compiling C software from source. Use +this cookbook if you wish to compile C programs, or install RubyGems +with native extensions. + +Requirements +============ + +## Platform + +Supported platforms by platform family: + +* Linux (debian, rhel, fedora) +* Darwin (`mac_os_x` 10.6+) + +Attributes +========== + +* `node['build_essential']['compiletime']` - Whether the resources in +the default recipe should be configured at the "Compile" phase of the +Chef run. Defaults to false, see __Usage__ for more information. +* `node['build_essential']['osx']['gcc_installer_url']` - The URL of + the OS X GCC package installer (.pkg). +* `node['build_essential']['osx']['gcc_installer_checksum']` - The + SHA256 checksum of the OS X GCC installer. + +Recipes +======= + +This cookbook has one recipe, default. + +On Linux platforms (see __Platform__ above for a supported list of +families), packages required to build C source projects are installed. +This includes GCC, make, autconf and others. On Debian-family +distributions, the apt-cache may need to be updated, especially during +compile time installation. See __Usage__ for further information. + +On Mac OS X, the GCC standalone installer by Kenneth Reitz is +installed. Note that this is *not* the Xcode CLI package, as that does +not include all programs and headers required to build some common +GNU-style C projects, such as those that are available from projects +such as MacPorts or Homebrew. Changing the attributes for the GCC +installer URL and checksum to the Xcode values may work, but this is +untested. + +Usage +===== + +Simply include the `build-essential` and the required tools will be +installed to the system, and later recipes will be able to compile +software from C source code. + +For RubyGems that include native C extensions you wish to use with +Chef, you should do two things. + +0. Ensure that the C libraries, include files and other assorted "dev" +type packages are installed. You should do this in the compile phase +after the build-essential recipe. +1. Use the `chef_gem` resource in your recipes. This requires Chef version 0.10.10+. +2. Set the `compiletime` attribute in roles where such recipes are +required. This will ensure that the build tools are available to +compile the RubyGems' extensions, as `chef_gem` happens during the +compile phase, too. + +Example installation of a devel package at compile-time in a recipe: + + package "mypackage-dev" do + action :nothing + end.run_action(:install) + +Example use of `chef_gem`: + + chef_gem "mygem" + +Example role: + + name "myapp" + run_list( + "recipe[build-essential]", + "recipe[myapp]" + ) + default_attributes( + "build_essential" => { + "compiletime" => true + } + ) + +The compile time option (via the attribute) is to ensure that the +proper packages are available at the right time in the Chef run. It is +recommended that the build-essential recipe appear early in the run +list. + +The Chef wiki has documentation on +[the anatomy of a chef run](http://wiki.opscode.com/display/chef/Anatomy+of+a+Chef+Run). + +Limitations +=========== + +It is not in the scope of this cookbook to handle installing the +required headers for individual software projects in order to compile +them, or to compile RubyGems with native C extensions. You should +create a cookbook for handling that. + +License and Author +================== + +Author:: Joshua Timberman () +Author:: Seth Chisamore () + +Copyright 2009-2011, Opscode, Inc. () + +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. Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/README.md ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/attributes/default.rb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/attributes/default.rb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/attributes/default.rb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/attributes/default.rb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,33 @@ +# +# Cookbook Name:: build-essential +# Attributes:: default +# +# Copyright 2008-2012, Opscode, Inc. +# +# 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. +# + +default['build_essential']['compiletime'] = false + +case platform +when "mac_os_x" + case + when Chef::VersionConstraint.new("~> 10.7.0").include?(platform_version), + Chef::VersionConstraint.new("~> 10.8.0").include?(platform_version) + default['build_essential']['osx']['gcc_installer_url'] = "https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg" + default['build_essential']['osx']['gcc_installer_checksum'] = "df36aa87606feb99d0db9ac9a492819e" + when Chef::VersionConstraint.new("~> 10.6.0").include?(platform_version) + default['build_essential']['osx']['gcc_installer_url'] = "https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.6.pkg" + default['build_essential']['osx']['gcc_installer_checksum'] = "d1db5bab6a3f6b9f3b5577a130baeefa" + end +end Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/attributes/default.rb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/metadata.json URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/metadata.json?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/metadata.json (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/metadata.json Thu Oct 31 14:59:48 2013 @@ -0,0 +1,37 @@ +{ + "name": "build-essential", + "description": "Installs C compiler / build tools", + "long_description": "", + "maintainer": "Opscode, Inc.", + "maintainer_email": "cookbooks@opscode.com", + "license": "Apache 2.0", + "platforms": { + "fedora": ">= 0.0.0", + "redhat": ">= 0.0.0", + "centos": ">= 0.0.0", + "ubuntu": ">= 0.0.0", + "debian": ">= 0.0.0", + "amazon": ">= 0.0.0", + "mac_os_x": ">= 10.6.0" + }, + "dependencies": { + }, + "recommendations": { + }, + "suggestions": { + }, + "conflicting": { + }, + "providing": { + }, + "replacing": { + }, + "attributes": { + }, + "groupings": { + }, + "recipes": { + "build-essential": "Installs packages required for compiling C software from source." + }, + "version": "1.1.2" +} \ No newline at end of file Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/metadata.json ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/metadata.rb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/metadata.rb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/metadata.rb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/metadata.rb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,12 @@ +maintainer "Opscode, Inc." +maintainer_email "cookbooks@opscode.com" +license "Apache 2.0" +description "Installs C compiler / build tools" +version "1.1.2" +recipe "build-essential", "Installs packages required for compiling C software from source." + +%w{ fedora redhat centos ubuntu debian amazon }.each do |os| + supports os +end + +supports "mac_os_x", ">= 10.6.0" Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/metadata.rb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/recipes/default.rb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/recipes/default.rb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/recipes/default.rb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/recipes/default.rb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,79 @@ +# +# Cookbook Name:: build-essential +# Recipe:: default +# +# Copyright 2008-2009, Opscode, Inc. +# +# 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. +# + +require 'chef/shell_out' + +compiletime = node['build_essential']['compiletime'] + +case node['os'] +when "linux" + + # on apt-based platforms when first provisioning we need to force + # apt-get update at compiletime if we are going to try to install at compiletime + if node['platform_family'] == "debian" + execute "apt-get update" do + action :nothing + # tip: to suppress this running every time, just use the apt cookbook + not_if do + ::File.exists?('/var/lib/apt/periodic/update-success-stamp') && + ::File.mtime('/var/lib/apt/periodic/update-success-stamp') > Time.now - 86400*2 + end + end.run_action(:run) if compiletime + end + + packages = case node['platform_family'] + when "debian" + %w{build-essential binutils-doc} + when "rhel", "fedora" + %w{gcc gcc-c++ kernel-devel make} + end + + packages.each do |pkg| + r = package pkg do + action ( compiletime ? :nothing : :install ) + end + r.run_action(:install) if compiletime + end + + %w{autoconf flex bison}.each do |pkg| + r = package pkg do + action ( compiletime ? :nothing : :install ) + end + r.run_action(:install) if compiletime + end +when "darwin" + result = Chef::ShellOut.new("pkgutil --pkgs").run_command + installed = result.stdout.split("\n").include?("com.apple.pkg.gcc4.2Leo") + pkg_filename = File.basename(node['build_essential']['osx']['gcc_installer_url']) + pkg_path = "#{Chef::Config[:file_cache_path]}/#{pkg_filename}" + + r = remote_file pkg_path do + source node['build_essential']['osx']['gcc_installer_url'] + checksum node['build_essential']['osx']['gcc_installer_checksum'] + action ( compiletime ? :nothing : :create ) + not_if { installed } + end + r.run_action(:create) if compiletime + + r = execute "sudo installer -pkg \"#{pkg_path}\" -target /" do + action ( compiletime ? :nothing : :run ) + not_if { installed } + end + r.run_action(:run) if compiletime +end Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/build-essential/recipes/default.rb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/CHANGELOG.md URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/CHANGELOG.md?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/CHANGELOG.md (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/CHANGELOG.md Thu Oct 31 14:59:48 2013 @@ -0,0 +1,21 @@ +## v1.0.8: + +* [COOK-1016] - python package needs separate names for centos/rhel 5.x vs 6.x +* [COOK-1048] - installation of pip does not honor selected python version +* [COOK-1282] - catch Chef::Exceptions::ShellCommandFailed for chef 0.10.8 compatibility +* [COOK-1311] - virtualenv should have options attribute +* [COOK-1320] - pip provider doesn't catch correct exception +* [COOK-1415] - use plain 'python' binary instead of versioned one for + default interpreter + +## v1.0.6: + +* [COOK-1036] - correctly grep for python-module version +* [COOK-1046] - run pip inside the virtualenv + +## v1.0.4: + +* [COOK-960] - add timeout to python_pip +* [COOK-651] - 'install_path' not correctly resolved when using python::source +* [COOK-650] - Add ability to specify version when installing distribute. +* [COOK-553] - FreeBSD support in the python cookbook Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/CHANGELOG.md ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/CONTRIBUTING URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/CONTRIBUTING?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/CONTRIBUTING (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/CONTRIBUTING Thu Oct 31 14:59:48 2013 @@ -0,0 +1,29 @@ +If you would like to contribute, please open a ticket in JIRA: + +* http://tickets.opscode.com + +Create the ticket in the COOK project and use the cookbook name as the +component. + +For all code contributions, we ask that contributors sign a +contributor license agreement (CLA). Instructions may be found here: + +* http://wiki.opscode.com/display/chef/How+to+Contribute + +When contributing changes to individual cookbooks, please do not +modify the version number in the metadata.rb. Also please do not +update the CHANGELOG.md for a new version. Not all changes to a +cookbook may be merged and released in the same versions. Opscode will +handle the version updates during the release process. You are welcome +to correct typos or otherwise make updates to documentation in the +README. + +If a contribution adds new platforms or platform versions, indicate +such in the body of the commit message(s), and update the relevant +COOK ticket. When writing commit messages, it is helpful for others if +you indicate the COOK ticket. For example: + + git commit -m '[COOK-1041] Updated pool resource to correctly delete.' + +In the ticket itself, it is also helpful if you include log output of +a successful Chef run, but this is not absolutely required. Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/CONTRIBUTING ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/LICENSE URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/LICENSE?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/LICENSE (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/LICENSE Thu Oct 31 14:59:48 2013 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/LICENSE ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/README.md URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/README.md?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/README.md (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/README.md Thu Oct 31 14:59:48 2013 @@ -0,0 +1,176 @@ +Description +=========== + +Installs and configures Python. Also includes LWRPs for managing python packages with `pip` and `virtualenv` isolated Python environments. + +Requirements +============ + +Platform +-------- + +* Debian, Ubuntu +* CentOS, Red Hat, Fedora + +Cookbooks +--------- + +* build-essential +* yum + +NOTE: The `yum` cookbook is a dependency of the cookbook, and will be used to install [EPEL](http://fedoraproject.org/wiki/EPEL) on RedHet/CentOS 5.x systems to provide the Python 2.6 packages. + +Attributes +========== + +See `attributes/default.rb` for default values. + +* `node["python"]["install_method"]` - method to install python with, default `package`. + +The file also contains the following attributes: + +* platform specific locations and settings. +* source installation settings + +Resource/Provider +================= + +This cookbook includes LWRPs for managing: + +* pip packages +* virtualenv isolated Python environments + +`python_pip` +------------ + +Install packages using the new hotness in Python package management...[`pip`](http://pypi.python.org/pypi/pip). Yo dawg...easy_install is so 2009, you better ask your local Pythonista if you don't know! The usage semantics are like that of any normal package provider. + +# Actions + +- :install: Install a pip package - if version is provided, install that specific version +- :upgrade: Upgrade a pip package - if version is provided, upgrade to that specific version +- :remove: Remove a pip package +- :purge: Purge a pip package (this usually entails removing configuration files as well as the package itself). With pip packages this behaves the same as `:remove` + +# Attribute Parameters + +- package_name: name attribute. The name of the pip package to install +- version: the version of the package to install/upgrade. If no version is given latest is assumed. +- virtualenv: virtualenv environment to install pip package into +- options: Add additional options to the underlying pip package command +- timeout: timeout in seconds for the command to execute. Useful for pip packages that may take a long time to install. Default 900 seconds. + +# Example + + # install latest gunicorn into system path + python_pip "gunicorn" do + action :install + end + + # target a virtualenv + python_pip "gunicorn" do + virtualenv "/home/ubunut/my_ve" + action :install + end + + # install Django 1.1.4 + python_pip "django" do + version "1.1.4" + action :install + end + + # use this provider with the core package resource + package "django" do + provider Chef::Provider::PythonPip + action :install + end + +`python_virtualenv` +------------------- + +[`virtualenv`](http://pypi.python.org/pypi/virtualenv) is a great tool that creates isolated python environments. Think of it as RVM without all those hipsters and tight jeans. + +# Actions + +- :create: creates a new virtualenv +- :delete: deletes an existing virtualenv + +# Attribute Parameters + +- path: name attribute. The path where the virtualenv will be created +- interpreter: The Python interpreter to use. default is `python2.6` +- owner: The owner for the virtualenv +- group: The group owner of the file (string or id) +- options : Command line options (string) + +# Example + + # create a 2.6 virtualenv owned by ubuntu user + python_virtualenv "/home/ubuntu/my_cool_ve" do + owner "ubuntu" + group "ubuntu" + action :create + end + + # create a Python 2.4 virtualenv + python_virtualenv "/home/ubuntu/my_old_ve" do + interpreter "python2.4" + owner "ubuntu" + group "ubuntu" + action :create + end + + # create a Python 2.6 virtualenv with access to the global packages owned by ubuntu user + python_virtualenv "/home/ubuntu/my_old_ve" do + owner "ubuntu" + group "ubuntu" + options "--system-site-packages" + action :create + end + +Usage +===== + +default +------- + +Include default recipe in a run list, to get `python`, `pip` and `virtualenv`. Installs python by package or source depending on the platform. + +package +------- + +Installs Python from packages. + +source +------ + +Installs Python from source. + +pip +--- + +Installs `pip` from source. + +virtualenv +---------- + +Installs virtualenv using the `python_pip` resource. + +License and Author +================== + +Author:: Seth Chisamore () + +Copyright:: 2011, Opscode, Inc + +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. Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/README.md ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/attributes/default.rb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/attributes/default.rb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/attributes/default.rb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/attributes/default.rb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,42 @@ +# +# Author:: Seth Chisamore () +# Cookbook Name:: python +# Attribute:: default +# +# Copyright 2011, Opscode, Inc. +# +# 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. +# + +default['python']['install_method'] = 'package' + +if python['install_method'] == 'package' + default['python']['prefix_dir'] = '/usr' +else + default['python']['prefix_dir'] = '/usr/local' +end + +case platform +when "redhat","centos","scientific","fedora","suse","amazon" + set['python']['pip']['prefix_dir'] = '/usr' +when "debian","ubuntu" + set['python']['pip']['prefix_dir'] = '/usr/local' +else + set['python']['pip']['prefix_dir'] = '/usr/local' +end + +default['python']['url'] = 'http://www.python.org/ftp/python' +default['python']['version'] = '2.7.1' +default['python']['checksum'] = '80e387bcf57eae8ce26726753584fd63e060ec11682d1145af921e85fd612292' +default['python']['configure_options'] = %W{--prefix=#{python['prefix_dir']}} + Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/attributes/default.rb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/metadata.json URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/metadata.json?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/metadata.json (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/metadata.json Thu Oct 31 14:59:48 2013 @@ -0,0 +1,42 @@ +{ + "name": "python", + "description": "Installs Python, pip and virtualenv. Includes LWRPs for managing Python packages with `pip` and `virtualenv` isolated Python environments.", + "long_description": "", + "maintainer": "Opscode, Inc.", + "maintainer_email": "cookbooks@opscode.com", + "license": "Apache 2.0", + "platforms": { + "debian": ">= 0.0.0", + "ubuntu": ">= 0.0.0", + "centos": ">= 0.0.0", + "redhat": ">= 0.0.0", + "fedora": ">= 0.0.0", + "freebsd": ">= 0.0.0" + }, + "dependencies": { + "build-essential": ">= 0.0.0", + "yum": ">= 0.0.0" + }, + "recommendations": { + }, + "suggestions": { + }, + "conflicting": { + }, + "providing": { + }, + "replacing": { + }, + "attributes": { + }, + "groupings": { + }, + "recipes": { + "python": "Installs python, pip, and virtualenv", + "python::package": "Installs python using packages.", + "python::source": "Installs python from source.", + "python::pip": "Installs pip from source.", + "python::virtualenv": "Installs virtualenv using the python_pip resource." + }, + "version": "1.0.8" +} \ No newline at end of file Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/metadata.json ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/metadata.rb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/metadata.rb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/metadata.rb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/metadata.rb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,18 @@ +maintainer "Opscode, Inc." +maintainer_email "cookbooks@opscode.com" +license "Apache 2.0" +description "Installs Python, pip and virtualenv. Includes LWRPs for managing Python packages with `pip` and `virtualenv` isolated Python environments." +version "1.0.8" + +depends "build-essential" +depends "yum" + +recipe "python", "Installs python, pip, and virtualenv" +recipe "python::package", "Installs python using packages." +recipe "python::source", "Installs python from source." +recipe "python::pip", "Installs pip from source." +recipe "python::virtualenv", "Installs virtualenv using the python_pip resource." + +%w{ debian ubuntu centos redhat fedora freebsd }.each do |os| + supports os +end Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/metadata.rb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/providers/pip.rb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/providers/pip.rb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/providers/pip.rb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/providers/pip.rb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,167 @@ +# +# Author:: Seth Chisamore +# Cookbook Name:: python +# Provider:: pip +# +# Copyright:: 2011, Opscode, Inc +# +# 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. +# + +require 'chef/mixin/shell_out' +require 'chef/mixin/language' +include Chef::Mixin::ShellOut + +# the logic in all action methods mirror that of +# the Chef::Provider::Package which will make +# refactoring into core chef easy + +action :install do + # If we specified a version, and it's not the current version, move to the specified version + if @new_resource.version != nil && @new_resource.version != @current_resource.version + install_version = @new_resource.version + # If it's not installed at all, install it + elsif @current_resource.version == nil + install_version = candidate_version + end + + # Set the timeout (units in seconds) + timeout = 900 + if @new_resource.timeout + timeout = @new_resource.timeout + end + + if install_version + Chef::Log.info("Installing #{@new_resource} version #{install_version}") + status = install_package(@new_resource.package_name, install_version, timeout) + if status + @new_resource.updated_by_last_action(true) + end + end +end + +action :upgrade do + # Set the timeout (units in seconds) + timeout = 900 + if @new_resource.timeout + timeout = @new_resource.timeout + end + + if @current_resource.version != candidate_version + orig_version = @current_resource.version || "uninstalled" + Chef::Log.info("Upgrading #{@new_resource} version from #{orig_version} to #{candidate_version}") + status = upgrade_package(@new_resource.package_name, candidate_version, timeout) + if status + @new_resource.updated_by_last_action(true) + end + end +end + +action :remove do + # Set the timeout (units in seconds) + timeout = 900 + if @new_resource.timeout + timeout = @new_resource.timeout + end + + if removing_package? + Chef::Log.info("Removing #{@new_resource}") + remove_package(@current_resource.package_name, @new_resource.version, timeout) + @new_resource.updated_by_last_action(true) + else + end +end + +def removing_package? + if @current_resource.version.nil? + false # nothing to remove + elsif @new_resource.version.nil? + true # remove any version of a package + elsif @new_resource.version == @current_resource.version + true # remove the version we have + else + false # we don't have the version we want to remove + end +end + +def expand_options(options) + options ? " #{options}" : "" +end + +# these methods are the required overrides of +# a provider that extends from Chef::Provider::Package +# so refactoring into core Chef should be easy + +def load_current_resource + @current_resource = Chef::Resource::PythonPip.new(@new_resource.name) + @current_resource.package_name(@new_resource.package_name) + @current_resource.version(nil) + + unless current_installed_version.nil? + @current_resource.version(current_installed_version) + end + + @current_resource +end + +def current_installed_version + @current_installed_version ||= begin + delimeter = /==/ + + version_check_cmd = "#{pip_cmd(@new_resource)} freeze | grep -i '^#{@new_resource.package_name}=='" + # incase you upgrade pip with pip! + if @new_resource.package_name.eql?('pip') + delimeter = /\s/ + version_check_cmd = "pip --version" + end + p = shell_out!(version_check_cmd) + p.stdout.split(delimeter)[1].strip + rescue Chef::Exceptions::ShellCommandFailed + rescue Mixlib::ShellOut::ShellCommandFailed + end +end + +def candidate_version + @candidate_version ||= begin + # `pip search` doesn't return versions yet + # `pip list` may be coming soon: + # https://bitbucket.org/ianb/pip/issue/197/option-to-show-what-version-would-be + @new_resource.version||'latest' + end +end + +def install_package(name, version, timeout) + v = "==#{version}" unless version.eql?('latest') + shell_out!("#{pip_cmd(@new_resource)} install#{expand_options(@new_resource.options)} #{name}#{v}", :timeout => timeout) +end + +def upgrade_package(name, version, timeout) + v = "==#{version}" unless version.eql?('latest') + shell_out!("#{pip_cmd(@new_resource)} install --upgrade#{expand_options(@new_resource.options)} #{@new_resource.name}#{v}", :timeout => timeout) +end + +def remove_package(name, version, timeout) + shell_out!("#{pip_cmd(@new_resource)} uninstall -y#{expand_options(@new_resource.options)} #{@new_resource.name}", :timeout => timeout) +end + +# TODO remove when provider is moved into Chef core +# this allows PythonPip to work with Chef::Resource::Package +def pip_cmd(nr) + if (nr.respond_to?("virtualenv") && nr.virtualenv) + ::File.join(nr.virtualenv,'/bin/pip') + elsif "#{node['python']['install_method']}".eql?("source") + ::File.join("#{node['python']['prefix_dir']}","/bin/pip") + else + 'pip' + end +end Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/providers/pip.rb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/providers/virtualenv.rb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/providers/virtualenv.rb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/providers/virtualenv.rb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/providers/virtualenv.rb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,68 @@ +# +# Author:: Seth Chisamore +# Cookbook Name:: python +# Provider:: virtualenv +# +# Copyright:: 2011, Opscode, Inc +# +# 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. +# + +require 'chef/mixin/shell_out' +require 'chef/mixin/language' +include Chef::Mixin::ShellOut + +action :create do + unless exists? + Chef::Log.info("Creating virtualenv #{@new_resource} at #{@new_resource.path}") + execute "#{virtualenv_cmd} --python=#{@new_resource.interpreter} #{@new_resource.options} #{@new_resource.path}" do + user new_resource.owner if new_resource.owner + group new_resource.group if new_resource.group + end + new_resource.updated_by_last_action(true) + end +end + +action :delete do + if exists? + Chef::Log.info("Deleting virtualenv #{@new_resource} at #{@new_resource.path}") + FileUtils.rm_rf(@new_resource.path) + new_resource.updated_by_last_action(true) + end +end + +def load_current_resource + @current_resource = Chef::Resource::PythonVirtualenv.new(@new_resource.name) + @current_resource.path(@new_resource.path) + + if exists? + cstats = ::File.stat(@current_resource.path) + @current_resource.owner(cstats.uid) + @current_resource.group(cstats.gid) + end + @current_resource +end + +def virtualenv_cmd() + if "#{node['python']['install_method']}".eql?("source") + ::File.join("#{node['python']['prefix_dir']}","/bin/virtualenv") + else + "virtualenv" + end +end + +private +def exists? + ::File.exist?(@current_resource.path) && ::File.directory?(@current_resource.path) \ + && ::File.exists?("#{@current_resource.path}/bin/activate") +end Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/providers/virtualenv.rb ------------------------------------------------------------------------------ svn:executable = * Added: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/recipes/default.rb URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/recipes/default.rb?rev=1537520&view=auto ============================================================================== --- incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/recipes/default.rb (added) +++ incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/recipes/default.rb Thu Oct 31 14:59:48 2013 @@ -0,0 +1,23 @@ +# +# Author:: Seth Chisamore +# Cookbook Name:: python +# Recipe:: default +# +# Copyright 2011, Opscode, Inc. +# +# 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. +# + +include_recipe "python::#{node['python']['install_method']}" +include_recipe "python::pip" +include_recipe "python::virtualenv" \ No newline at end of file Propchange: incubator/climate/branches/rcmet-2.1.2/src/main/vm/src/cookbooks/python/recipes/default.rb ------------------------------------------------------------------------------ svn:executable = *