diff --git a/modules.env b/modules.env index 3f5739243a..469e40c553 100644 --- a/modules.env +++ b/modules.env @@ -59,6 +59,7 @@ SOURCE_MODULES["https://github.com/puppet-community/puppet-module-puppetboard"]= INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-storyboard"]="origin/master" INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-kibana"]="origin/master" INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-jenkins"]="origin/master" +INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-pip"]="origin/master" if [[ "$PUPPET_INTEGRATION_TEST" -ne "1" ]]; then # If puppet integration tests are not being run, merge SOURCE and INTEGRATION modules diff --git a/modules/pip/lib/puppet/provider/package/pip3.rb b/modules/pip/lib/puppet/provider/package/pip3.rb deleted file mode 100644 index f155a572ec..0000000000 --- a/modules/pip/lib/puppet/provider/package/pip3.rb +++ /dev/null @@ -1,138 +0,0 @@ -# Puppet - Automating Configuration Management. - -# Copyright (C) 2005-2012 Puppet Labs Inc -# Copyright 2013 Red Hat, Inc. - -# Puppet Labs can be contacted at: info@puppetlabs.com - -# 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. - -# Puppet package provider for Python's `pip3` package management frontend. -# -# -# Loosely based on the 'pip' package provider in puppet 2.7. -require 'puppet/provider/package' -require 'xmlrpc/client' - -Puppet::Type.type(:package).provide :pip3, - :parent => ::Puppet::Provider::Package do - - desc "Python packages via `python-pip3`." - - has_feature :installable, :uninstallable, :upgradeable, :versionable - - # Parse lines of output from `pip freeze`, which are structured as - # _package_==_version_. - def self.parse(line) - if line.chomp =~ /^([^=]+)==([^=]+)$/ - {:ensure => $2, :name => $1, :provider => name} - else - nil - end - end - - # Return an array of structured information about every installed package - # that's managed by `pip` or an empty array if `pip` is not available. - def self.instances - packages = [] - execpipe "#{pip3_cmd} freeze" do |process| - process.collect do |line| - next unless options = parse(line) - packages << new(options) - end - end - packages - end - - # Return structured information about a particular package or `nil` if - # it is not installed or `pip` itself is not available. - def query - self.class.instances.each do |provider_pip| - return provider_pip.properties if @resource[:name] == provider_pip.name - end - return nil - end - - # Ask the PyPI API for the latest version number. There is no local - # cache of PyPI's package list so this operation will always have to - # ask the web service. - def latest - client = XMLRPC::Client.new2("http://pypi.python.org/pypi") - client.http_header_extra = {"Content-Type" => "text/xml"} - client.timeout = 10 - result = client.call("package_releases", @resource[:name]) - result.first - rescue Timeout::Error => detail - raise Puppet::Error, "Timeout while contacting pypi.python.org: #{detail}"; - end - - # Install a package. The ensure parameter may specify installed, - # latest, a version number, or, in conjunction with the source - # parameter, an SCM revision. In that case, the source parameter - # gives the fully-qualified URL to the repository. - def install - args = %w{install -q} - if @resource[:source] - args << "-e" - if String === @resource[:ensure] - args << "#{@resource[:source]}@#{@resource[:ensure]}#egg=#{ - @resource[:name]}" - else - args << "#{@resource[:source]}#egg=#{@resource[:name]}" - end - else - case @resource[:ensure] - when String - args << "#{@resource[:name]}==#{@resource[:ensure]}" - when :latest - args << "--upgrade" << @resource[:name] - else - args << @resource[:name] - end - end - lazy_pip *args - end - - # Uninstall a package. Uninstall won't work reliably on Debian/Ubuntu - # unless this issue gets fixed. - # - def uninstall - lazy_pip "uninstall", "-y", "-q", @resource[:name] - end - - def update - install - end - - # Execute a `pip` command. If Puppet doesn't yet know how to do so, - # try to teach it and if even that fails, raise the error. - private - def lazy_pip(*args) - pip3 *args - rescue NoMethodError => e - self.class.commands :pip => pip3_cmd - pip *args - end - - def self.pip3_cmd - ['/usr/bin/python3-pip', '/usr/bin/pip3', '/usr/bin/pip-3.2', '/usr/bin/pip-3.3'].each do |p| - return p if File.exist?(p) - end - raise Puppet::Error, "Unable to find pip3 binary."; - end - - def pip3_cmd - return self.class.pip3_cmd - end - -end diff --git a/modules/pip/manifests/init.pp b/modules/pip/manifests/init.pp deleted file mode 100644 index 731691ed58..0000000000 --- a/modules/pip/manifests/init.pp +++ /dev/null @@ -1,10 +0,0 @@ -# Class: pip -# -class pip { - include pip::params - - package { $::pip::params::python_devel_package: - ensure => present, - } - -} diff --git a/modules/pip/manifests/params.pp b/modules/pip/manifests/params.pp deleted file mode 100644 index 3bd4f86308..0000000000 --- a/modules/pip/manifests/params.pp +++ /dev/null @@ -1,21 +0,0 @@ -# Class: pip::params -# -# This class holds parameters that need to be -# accessed by other classes. -class pip::params { - case $::osfamily { - 'RedHat': { - $python_devel_package = 'python-devel' - $python3_devel_package = 'python3-devel' - $python3_pip_package = 'python3-pip' - } - 'Debian': { - $python_devel_package = 'python-all-dev' - $python3_devel_package = 'python3-all-dev' - $python3_pip_package = 'python3-pip' - } - default: { - fail("Unsupported osfamily: ${::osfamily} The 'pip' module only supports osfamily Debian or RedHat.") - } - } -} diff --git a/modules/pip/manifests/python3.pp b/modules/pip/manifests/python3.pp deleted file mode 100644 index 38a24122b7..0000000000 --- a/modules/pip/manifests/python3.pp +++ /dev/null @@ -1,15 +0,0 @@ -# Class: pip -# -class pip::python3 { - include pip::params - - package { $::pip::params::python3_devel_package: - ensure => present, - } - - package { $::pip::params::python3_pip_package: - ensure => present, - require => Package[$::pip::params::python3_devel_package] - } - -}