Sha256: 2bf7be1e1c7b5f599d783af1bcf436c37942c256b9eef13a717c477e3c27edd0

Contents?: true

Size: 1.16 KB

Versions: 18

Compression:

Stored size: 1.16 KB

Contents

module Puppet
  Puppet::Type.type(:file).newproperty(:owner) do

    desc "To whom the file should belong.  Argument can be user name or
      user ID."
    @event = :file_changed

    def insync?(current)
      provider.is_owner_insync?(current, @should)
    end

    # We want to print names, not numbers
    def is_to_s(currentvalue)
      provider.id2name(currentvalue) || currentvalue
    end

    def should_to_s(newvalue = @should)
      case newvalue
      when Symbol
        newvalue.to_s
      when Integer
        provider.id2name(newvalue) || newvalue
      when String
        newvalue
      else
        raise Puppet::DevError, "Invalid uid type #{newvalue.class}(#{newvalue})"
      end
    end

    def retrieve
      if self.should
        @should = @should.collect do |val|
          unless val.is_a?(Integer)
            if tmp = provider.validuser?(val)
              val = tmp
            else
              raise "Could not find user #{val}"
            end
          else
            val
          end
        end
      end
      provider.retrieve(@resource)
    end

    def sync
      provider.sync(resource[:path], resource[:links], @should)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
puppet-2.6.18 lib/puppet/type/file/owner.rb
puppet-2.6.17 lib/puppet/type/file/owner.rb
puppet-2.6.16 lib/puppet/type/file/owner.rb
puppet-2.6.15 lib/puppet/type/file/owner.rb
puppet-2.6.14 lib/puppet/type/file/owner.rb
puppet-2.6.13 lib/puppet/type/file/owner.rb
puppet-2.6.12 lib/puppet/type/file/owner.rb
puppet-2.7.5 lib/puppet/type/file/owner.rb
puppet-2.6.11 lib/puppet/type/file/owner.rb
puppet-2.7.4 lib/puppet/type/file/owner.rb
puppet-2.6.10 lib/puppet/type/file/owner.rb
puppet-2.7.3 lib/puppet/type/file/owner.rb
puppet-2.7.1 lib/puppet/type/file/owner.rb
puppet-2.6.9 lib/puppet/type/file/owner.rb
puppet-2.6.8 lib/puppet/type/file/owner.rb
puppet-2.6.7 lib/puppet/type/file/owner.rb
puppet-2.6.6 lib/puppet/type/file/owner.rb
puppet-2.6.5 lib/puppet/type/file/owner.rb