lib/puppet/type/mobileconfig.rb
def insync?(is)
      key = 'PayloadUUID'

      # Return false if the two arrays are not of equal length
      return false unless is.length == should.length

      # Shoehorn the MD5 sums
      should.collect! do |hash|
        hash[key] = ::ManagedMacCommon::content_to_uuid hash.sort
        hash
      end

      # Sort the arrays
      i, s = [is, should].each do |a|
        a.sort! { |x, y| x[key] <=> y[key] }
      end

      # Compare ONLY the PayloadUUIDs
      result = i.collect.each_with_index do |a, index|
        s[index][key] == a[key]
      end

      # Is each result true?
      result.all?
    end
# Override #insync?
#
# This method is used to compare the 'is' (current resource settings) with
# the 'should' values (desired resource settings).
#
# Doing this is tricky because `/usr/bin/profiles` does not always
# return complete information about the profiles we've installed. As a
# workaround, we...
#
#    1. calculate an MD5 sum of the content
#    2. convert that value to a UUID
#    3. inject it into the each of the Payload objects
#
# Then, rather than granularly comparing each resource attribute, we only
# compare the MD5 sums.
#
Override #insync.
This method is used to compare the 'is' (current resource settings) with
the 'should' values (desired resource settings).

Doing this is tricky because `/usr/bin/profiles` does not always
return complete information about the profiles we've installed. As a
workaround, we

1. calculate an MD5 sum of the content
2. convert that value to a UUID
3. inject it into the each of the Payload objects

Then, rather than granularly comparing each resource attribute, we only
compare the MD5 sums.
Override #insync . This method is used to compare the ' is ' ( current resource settings ) with the ' should ' values ( desired resource settings ) . Doing this is tricky because ` / usr / bin / profiles ` does not always return complete information about the profiles we ' ve installed . As a workaround we 1 . calculate an MD5 sum of the content 2 . convert that value to a UUID 3 . inject it into the each of the Payload objects Then rather than granularly comparing each resource attribute we only compare the MD5 sums .
def insync?(is)
      key = 'PayloadUUID'
      return false unless is.length == should.length
      should.collect! do |hash|
        hash[key] = ::ManagedMacCommon::content_to_uuid hash.sort
        hash
      end
      i, s = [is, should].each do |a|
        a.sort! { |x, y| x[key] <=> y[key] }
      end
      result = i.collect.each_with_index do |a, index|
        s[index][key] == a[key]
      end
      result.all?
    end
def insync? ( is ) key = 'PayloadUUID' return false unless is . length == should . length should . collect! do | hash | hash [ key ] = :: ManagedMacCommon :: content_to_uuid hash . sort hash end i , s = [ is , should ] . each do | a | a . sort! { | x , y | x [ key ] <=> y [ key ] } end result = i . collect . each_with_index do | a , index | s [ index ] [ key ] == a [ key ] end result . all? end
Override #insync?
Override #insync?
# Return false if the two arrays are not of equal length # Shoehorn the MD5 sums # Sort the arrays # Compare ONLY the PayloadUUIDs # Is each result true?
is