+def get_config_children(config, args):
+ '''Gets the names of the children of the given parameter.
+
+ :param config Config: The configuration where to read the values
+ :param args: The path in the config from which get the keys
+ '''
+ vals = []
+ rootkeys = config.keys()
+
+ if len(args) == 0:
+ # no parameter returns list of root keys
+ vals = rootkeys
+ else:
+ parent = args[0]
+ pos = parent.rfind('.')
+ if pos < 0:
+ # Case where there is only on key as parameter.
+ # For example VARS
+ vals = [m for m in rootkeys if m.startswith(parent)]
+ else:
+ # Case where there is a part from a key
+ # for example VARS.us (for VARS.user)
+ head = parent[0:pos]
+ tail = parent[pos+1:]
+ try:
+ a = config.getByPath(head)
+ if dir(a).__contains__('keys'):
+ vals = map(lambda x: head + '.' + x, [m for m in a.keys() if m.startswith(tail)])
+ except:
+ pass
+
+ for v in sorted(vals):
+ sys.stdout.write("%s\n" % v)
+