lib/puppet/provider/macgroup/default.rb
def update_membership(type)
    type = type.to_sym
    unless [:users, :nestedgroups].member? type
      raise Puppet::Error, "unknown membership type: #{type}"
    end

    desired_state = @resource.should(type).compact

    if @resource[:strict] == :false
      current_state = Array(@original_properties[type])
      desired_state = current_state | desired_state
    end

    unique_members = desired_state.uniq

    desired_state.detect do |e|
      if desired_state.count(e) > 1
        Puppet::Util::Warnings.warnonce(
          "Macgroup: duplicate group specified! #{e}. Ignoring...")
      end
    end

    name = @resource[:name]
    args = [@dslocal_root, 'create', "/Groups/#{name}", type.to_s,
      *unique_members]

    dscl(args)
  end
# Method for handling the two membership setter attributes
Method for handling the two membership setter attributes
Method for handling the two membership setter attributes
def update_membership(type)
    type = type.to_sym
    unless [:users, :nestedgroups].member? type
      raise Puppet::Error, "unknown membership type: #{type}"
    end
    desired_state = @resource.should(type).compact
    if @resource[:strict] == :false
      current_state = Array(@original_properties[type])
      desired_state = current_state | desired_state
    end
    unique_members = desired_state.uniq
    desired_state.detect do |e|
      if desired_state.count(e) > 1
        Puppet::Util::Warnings.warnonce(
          "Macgroup: duplicate group specified! #{e}. Ignoring...")
      end
    end
    name = @resource[:name]
    args = [@dslocal_root, 'create', "/Groups/#{name}", type.to_s,
      *unique_members]
    dscl(args)
  end
def update_membership ( type ) type = type . to_sym unless [ :users , :nestedgroups ] . member? type raise Puppet :: Error , "unknown membership type: #{type}" end desired_state = @resource . should ( type ) . compact if @resource [ :strict ] == :false current_state = Array ( @original_properties [ type ] ) desired_state = current_state | desired_state end unique_members = desired_state . uniq desired_state . detect do | e | if desired_state . count ( e ) > 1 Puppet :: Util :: Warnings . warnonce ( "Macgroup: duplicate group specified! #{e}. Ignoring..." ) end end name = @resource [ :name ] args = [ @dslocal_root , 'create' , "/Groups/#{name}" , type . to_s , * unique_members ] dscl ( args ) end
Method for handling the two membership setter attributes
Method for handling the two membership setter attributes
type