summaryrefslogtreecommitdiffstats
path: root/test/lib/puppettest/support/helpers.rb
blob: 75c699f724499001a54e91b44f0d8a094e1b02a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'puppettest'

module PuppetTest
  # NOTE: currently both of these will produce bogus results on Darwin due to the wonderful
  # UID of nobody.
  def nonrootuser
    Etc.passwd { |user|
      return user if user.uid != Puppet::Util::SUIDManager.uid and user.uid > 0 and user.uid < 255
    }
  end

  def nonrootgroup
    Etc.group { |group|
      return group if group.gid != Puppet::Util::SUIDManager.gid and group.gid > 0 and group.gid < 255
    }
  end
end