lib/puppet_x/coi/jboss/internal/securitydomain_auditor.rb
# Method that checks current situation of security-domain in Jboss instance
# @param actual_data [Hash] output of recursive read of security-domain resource
# @param resource [Hash] reference to standard puppet resource object
# @return [Boolean] return true if security-domain with given name exists in any state
Method that checks current situation of security-domain in Jboss instance
Method that checks current situation of security - domain in Jboss instance
def resolve_state(actual_data, resource)
    @state = actual_data
    unless actual_data.key? 'security-domain'
      Puppet.debug('There is no securitydomain at all')
      return false
    end
    Puppet.debug "Security Domain exists: #{actual_data.inspect}"
    givenhash = build_givenhash(resource)
    path_in_state = [
      'security-domain',
      resource[:name].to_s,
      'authentication',
      'classic',
      'login-modules',
      0,
      'module-options'
    ]
    nil_checker = get_nillable_from_hash_iterative(actual_data, path_in_state)
    Puppet.debug("Value of nil checker: #{nil_checker}")
    return false if nil_checker.nil?
    state_login_modules = array_keys_to_hash_value(actual_data, path_in_state)
    existinghash = build_existinghash(state_login_modules)
    if !existinghash.nil? && !givenhash.nil? && existinghash != givenhash
      diff = givenhash.to_a - existinghash.to_a
      Puppet.notice("Security domain should be recreated. Diff: #{diff.inspect}")
      Puppet.debug("Security domain moduleoptions existing hash => #{existinghash.inspect}")
      Puppet.debug("Security domain moduleoptions given hash => #{givenhash.inspect}")
      @destroyer.destroy(resource)
      return false
    end
    true
  end
def resolve_state ( actual_data , resource ) @state = actual_data unless actual_data . key? 'security-domain' Puppet . debug ( 'There is no securitydomain at all' ) return false end Puppet . debug "Security Domain exists: #{actual_data.inspect}" givenhash = build_givenhash ( resource ) path_in_state = [ 'security-domain' , resource [ :name ] . to_s , 'authentication' , 'classic' , 'login-modules' , 0 , 'module-options' ] nil_checker = get_nillable_from_hash_iterative ( actual_data , path_in_state ) Puppet . debug ( "Value of nil checker: #{nil_checker}" ) return false if nil_checker . nil? state_login_modules = array_keys_to_hash_value ( actual_data , path_in_state ) existinghash = build_existinghash ( state_login_modules ) if ! existinghash . nil? && ! givenhash . nil? && existinghash != givenhash diff = givenhash . to_a - existinghash . to_a Puppet . notice ( "Security domain should be recreated. Diff: #{diff.inspect}" ) Puppet . debug ( "Security domain moduleoptions existing hash => #{existinghash.inspect}" ) Puppet . debug ( "Security domain moduleoptions given hash => #{givenhash.inspect}" ) @destroyer . destroy ( resource ) return false end true end
Method that checks current situation of security-domain in Jboss instance
Method that checks current situation of security - domain in Jboss instance
return true if security-domain with given name exists in any state
return true if security - domain with given name exists in any state
Boolean
actual_data
output of recursive read of security-domain resource
output of recursive read of security - domain resource
resource
reference to standard puppet resource object
reference to standard puppet resource object