Sha256: 8467759d2a80604b6273ad480b1d930f7aafb8af9941ca392279838fcf94c27e

Contents?: true

Size: 1.28 KB

Versions: 44

Compression:

Stored size: 1.28 KB

Contents

Puppet::Type.type(:zfs).provide(:solaris) do
  desc "Provider for Solaris zfs."

  commands :zfs => "/usr/sbin/zfs"
  defaultfor :operatingsystem => :solaris

  def add_properties
    properties = []
    Puppet::Type.type(:zfs).validproperties.each do |property|
      next if property == :ensure
      if value = @resource[property] and value != ""
        properties << "-o" << "#{property}=#{value}"
      end
    end
    properties
  end

  def create
    zfs *([:create] + add_properties + [@resource[:name]])
  end

  def destroy
    zfs(:destroy, @resource[:name])
  end

  def exists?
    if zfs(:list).split("\n").detect { |line| line.split("\s")[0] == @resource[:name] }
      true
    else
      false
    end
  end

  [:aclinherit, :aclmode, :atime, :canmount, :checksum, :compression, :copies, :devices, :exec, :logbias, :mountpoint, :nbmand, :primarycache, :quota, :readonly, :recordsize, :refquota, :refreservation, :reservation, :secondarycache, :setuid, :shareiscsi, :sharenfs, :sharesmb, :snapdir, :version, :volsize, :vscan, :xattr, :zoned, :vscan].each do |field|
    define_method(field) do
      zfs(:get, "-H", "-o", "value", field, @resource[:name]).strip
    end

    define_method(field.to_s + "=") do |should|
      zfs(:set, "#{field}=#{should}", @resource[:name])
    end
  end

end

Version data entries

44 entries across 44 versions & 4 rubygems

Version Path
puppet-parse-0.1.4 lib/vendor/puppet/provider/zfs/solaris.rb
puppet-parse-0.1.3 lib/vendor/puppet/provider/zfs/solaris.rb
puppet-parse-0.1.2 lib/vendor/puppet/provider/zfs/solaris.rb
puppet-parse-0.1.1 lib/vendor/puppet/provider/zfs/solaris.rb
puppet-2.7.26 lib/puppet/provider/zfs/solaris.rb
puppet-2.7.25 lib/puppet/provider/zfs/solaris.rb
puppet-2.7.24 lib/puppet/provider/zfs/solaris.rb
puppet-2.7.23 lib/puppet/provider/zfs/solaris.rb
puppet-2.7.22 lib/puppet/provider/zfs/solaris.rb
puppet-parse-0.1.0 lib/vendor/puppet/provider/zfs/solaris.rb
puppet-parse-0.0.6 lib/vendor/puppet/provider/zfs/solaris.rb
puppet-2.7.21 lib/puppet/provider/zfs/solaris.rb
puppet-parse-0.0.5 lib/vendor/puppet/provider/zfs/solaris.rb
puppet-parse-0.0.4 lib/vendor/puppet/provider/zfs/solaris.rb
puppet-parse-0.0.2 lib/vendor/puppet/provider/zfs/solaris.rb
puppet-2.7.20 lib/puppet/provider/zfs/solaris.rb
puppet-2.7.20.rc1 lib/puppet/provider/zfs/solaris.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/lib/puppet/provider/zfs/solaris.rb
puppet-2.7.19 lib/puppet/provider/zfs/solaris.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/provider/zfs/solaris.rb