Package syspolicy :: Module config
[hide private]
[frames] | no frames]

Module config

source code

Base configuration class Config and comparison functions

Classes [hide private]
  Config
Functions [hide private]
 
walk(tree, path=[])
This function returns a branch of a dictionary tree by walking using the attribute names specified with `path`.
source code
 
compare_trees(a, b)
This function does an in-depth comparison of 2 dictionary trees and produces another tree of their differences.
source code
 
diff_type(a, b, path)
This function reports which is the type of difference that was detected in `a` and `b` at `path`.
source code
Variables [hide private]
  DEFAULT = '_default_'
the config section containing the defaults
  CONFIG_ADDED = 1
  CONFIG_CHANGED = 2
  CONFIG_REMOVED = 3
  __package__ = 'syspolicy'
Function Details [hide private]

walk(tree, path=[])

source code 

This function returns a branch of a dictionary tree by walking using the attribute names specified with `path`.

Parameters:
  • tree - A dictionary tree
  • path - A list of keys to be iterated until the final location
Returns:
Value of `tree` at `path` or None if such path does not exist

compare_trees(a, b)

source code 

This function does an in-depth comparison of 2 dictionary trees and produces another tree of their differences. This function calls itself recursively to produce the final result.

Changed and newly set attribute values are present in the result as their new values. Removed values and branches appear as None.

Parameters:
  • a - Dictionary tree A
  • b - Dictionary tree B
Returns:
Differences between A and B

diff_type(a, b, path)

source code 

This function reports which is the type of difference that was detected in `a` and `b` at `path`.

Parameters:
  • a - Dictionary tree A
  • b - Dictionary tree B
  • path - Location of the difference
Returns:
If the value at `path` was added in A, return CONFIG_ADDED. When it was removed in A, return CONFIG_REMOVED. Otherwise, return CONFIG_CHANGED.