<commit_before>require 'puppet/provider/mobileconfig'

Puppet::Type.type(:mobileconfig).provide(:activedirectory, 
  :parent => Puppet::Provider::MobileConfig) do
  
  commands :profiles => '/usr/bin/profiles'
  
  mk_resource_methods
  
end<commit_msg>override the #content getter to handle AD bind passwords<commit_after>require 'puppet/provider/mobileconfig'

Puppet::Type.type(:mobileconfig).provide(:activedirectory, 
  :parent => Puppet::Provider::MobileConfig) do
  
  commands :profiles => '/usr/bin/profiles'
  
  mk_resource_methods
  
  # Override the #content getter so that we can interecept any
  # any Password key/values.
  #
  # This has to do with the manner which we determine whether or not a profile
  # is actually installed. When /usr/bin/profiles returns the list of 
  # installed profiles, it scrubs passwords, so we can never know the real
  # value. This isn;t such a problem for a bind operation, but it does mean 
  # that this value is NOT idempotent (ie. changes to this value, will not
  # trigger a puppet apply).
  #
  def content
    if @resource[:content]
      return @property_hash[:content].each_with_index.map do |hash, i|
        if hash.key?('Password')
          hash['Password'] = @resource[:content][i]['Password']
          hash
        end
      end
    end
    @property_hash[:content]
  end
  
end
{'fraction_non_alphanumeric': 0.09799554565701558, 'fraction_numerical': 0.0, 'mean_word_length': 3.6164383561643834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6981549', 'n_tokens_mistral': 415, 'n_tokens_neox': 401, 'n_words': 128}