Sha256: 8450eb73aca19700feb1739c7485b4b8da3d04ee3d499753fc99a8bb03c4c0b0

Contents?: true

Size: 1.28 KB

Versions: 260

Compression:

Stored size: 1.28 KB

Contents

require 'puppet/util/posix'

module Puppet
  # Manage file group ownership.
  Puppet::Type.type(:file).newproperty(:group) do
    desc <<-EOT
      Which group should own the file.  Argument can be either a group
      name or a group ID.

      On Windows, a user (such as "Administrator") can be set as a file's group
      and a group (such as "Administrators") can be set as a file's owner;
      however, a file's owner and group shouldn't be the same. (If the owner
      is also the group, files with modes like `0640` will cause log churn, as
      they will always appear out of sync.)
    EOT

    validate do |group|
      raise(Puppet::Error, "Invalid group name '#{group.inspect}'") unless group and group != ""
    end

    def insync?(current)
      # We don't want to validate/munge groups until we actually start to
      # evaluate this property, because they might be added during the catalog
      # apply.
      @should.map! do |val|
        provider.name2gid(val) or raise "Could not find group #{val}"
      end

      @should.include?(current)
    end

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

    def should_to_s(newvalue)
      provider.gid2name(newvalue) || newvalue
    end
  end
end

Version data entries

260 entries across 260 versions & 3 rubygems

Version Path
puppet-retrospec-1.8.0 vendor/pup410/lib/puppet/type/file/group.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/type/file/group.rb
puppet-4.10.12 lib/puppet/type/file/group.rb
puppet-4.10.12-x86-mingw32 lib/puppet/type/file/group.rb
puppet-4.10.12-x64-mingw32 lib/puppet/type/file/group.rb
puppet-4.10.12-universal-darwin lib/puppet/type/file/group.rb
puppet-4.10.11 lib/puppet/type/file/group.rb
puppet-4.10.11-x86-mingw32 lib/puppet/type/file/group.rb
puppet-4.10.11-x64-mingw32 lib/puppet/type/file/group.rb
puppet-4.10.11-universal-darwin lib/puppet/type/file/group.rb
puppet-4.10.10 lib/puppet/type/file/group.rb
puppet-4.10.10-x86-mingw32 lib/puppet/type/file/group.rb
puppet-4.10.10-x64-mingw32 lib/puppet/type/file/group.rb
puppet-4.10.10-universal-darwin lib/puppet/type/file/group.rb
puppet-retrospec-1.6.1 vendor/pup410/lib/puppet/type/file/group.rb
puppet-retrospec-1.6.0 vendor/pup410/lib/puppet/type/file/group.rb
puppet-4.10.9 lib/puppet/type/file/group.rb
puppet-4.10.9-x86-mingw32 lib/puppet/type/file/group.rb
puppet-4.10.9-x64-mingw32 lib/puppet/type/file/group.rb
puppet-4.10.9-universal-darwin lib/puppet/type/file/group.rb