Skip to content

Commit

Permalink
Fact to list all members of the admin group
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamgilbert committed May 20, 2014
1 parent 140e81e commit 5a6ee40
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#Changelog

##0.5.0

Fact listing all the users in the admin group.

##0.4.0

Changes for an upcoming OS release
Expand Down
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'grahamgilbert-mac_facts'
version '0.4.0'
version '0.5.0'
author 'grahamgilbert'
license 'Apache License, Version 2.0'
summary 'A collection of Facts to aid with the administration of OS X machines'
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ mac_facts

This a collection of Facts specific to managing OS X clients with Puppet.

###mac_admin_users

A comma separated list of users in the admin group

###mac_battery_charge_percent

The current battery charge, in percent
Expand Down Expand Up @@ -51,4 +55,4 @@ Returns a simple value of the amount of memory the Mac has in GB - useful for do

###mac_timezone

Returns the current timezone in a format that systemsetup can use.
Returns the current timezone in a format that systemsetup can use.
10 changes: 10 additions & 0 deletions lib/facter/mac_admin_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#mac_admin_users.rb
#require 'facter'
Facter.add(:mac_admin_users) do
confine :kernel => "Darwin"
setcode do
admins = Facter::Util::Resolution.exec("dscl . -read /Groups/admin GroupMembership")

admins.gsub('GroupMembership: ','').gsub(' ', ', ')
end
end

0 comments on commit 5a6ee40

Please sign in to comment.