Sha256: 7ecc4f05077f7e639551678582d4006fae0d9812d6b151f59543f5b42309c995

Contents?: true

Size: 1.41 KB

Versions: 16

Compression:

Stored size: 1.41 KB

Contents

Puppet::Type.type(:package).provide :freebsd, :parent => :openbsd do
  desc "The specific form of package management on FreeBSD.  This is an
    extremely quirky packaging system, in that it freely mixes between
    ports and packages.  Apparently all of the tools are written in Ruby,
    so there are plans to rewrite this support to directly use those
    libraries."

  commands :pkginfo => "/usr/sbin/pkg_info",
    :pkgadd => "/usr/sbin/pkg_add",
    :pkgdelete => "/usr/sbin/pkg_delete"

  confine :operatingsystem => :freebsd

  def self.listcmd
    command(:pkginfo)
  end

  def install
    should = @resource.should(:ensure)

    if @resource[:source] =~ /\/$/
      if @resource[:source] =~ /^(ftp|https?):/
        Puppet::Util::Execution::withenv :PACKAGESITE => @resource[:source] do
          pkgadd "-r", @resource[:name]
        end
      else
        Puppet::Util::Execution::withenv :PKG_PATH => @resource[:source] do
          pkgadd @resource[:name]
        end
      end
    else
      Puppet.warning "source is defined but does not have trailing slash, ignoring #{@resource[:source]}" if @resource[:source]
      pkgadd "-r", @resource[:name]
    end
  end

  def query
    self.class.instances.each do |provider|
      if provider.name == @resource.name
        return provider.properties
      end
    end
    nil
  end

  def uninstall
    pkgdelete "#{@resource[:name]}-#{@resource.should(:ensure)}"
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
puppet-2.6.18 lib/puppet/provider/package/freebsd.rb
puppet-2.6.17 lib/puppet/provider/package/freebsd.rb
puppet-2.6.16 lib/puppet/provider/package/freebsd.rb
puppet-2.6.15 lib/puppet/provider/package/freebsd.rb
puppet-2.6.14 lib/puppet/provider/package/freebsd.rb
puppet-2.6.13 lib/puppet/provider/package/freebsd.rb
puppet-2.6.12 lib/puppet/provider/package/freebsd.rb
puppet-2.6.11 lib/puppet/provider/package/freebsd.rb
puppet-2.6.10 lib/puppet/provider/package/freebsd.rb
puppet-2.7.3 lib/puppet/provider/package/freebsd.rb
puppet-2.7.1 lib/puppet/provider/package/freebsd.rb
puppet-2.6.9 lib/puppet/provider/package/freebsd.rb
puppet-2.6.8 lib/puppet/provider/package/freebsd.rb
puppet-2.6.7 lib/puppet/provider/package/freebsd.rb
puppet-2.6.6 lib/puppet/provider/package/freebsd.rb
puppet-2.6.5 lib/puppet/provider/package/freebsd.rb