@@ -0,0 +1,1345 @@
+#!/usr/bin/env python%0A#-*- coding:utf-8 -*-%0A# Author: Kun Huang %3Cacademicgareth@gmail.com%3E%0A%0Aimport copy%0Aimport sys%0Aimport ConfigParser%0A%0A# TODO need cfg.CONF instead%0A# at least two requeriments:%0A# 1, keep this CONF alone with children process' CONF%0A# 2, re-struct config file if necessary, but we must keep it friendly to ops%0A#    guys%0A%0ADEFAULT_CONFIG_FILE = '/Users/Gareth/celtics/nova-thousands/etc/nova-thousands.conf'%0ADEFAULT_TEMPLATE = %7B'boot_time': '30',%0A                    'boot_time_deviation': '0'%7D%0A%0Adef parse_config():%0A    config = ConfigParser.ConfigParser()%0A    config.read(DEFAULT_CONFIG_FILE)%0A    return config%0A%0A%0Adef main():%0A    config = parse_config()%0A    default = config.defaults()%0A    templates = %7B%7D%0A    ports = %5B%5D%0A%0A    for sec in config.sections():%0A        _temp = dict(config.items(sec))%0A        for key in default:%0A            del _temp%5Bkey%5D%0A%0A        if sec.startswith('template:'):%0A            name = sec%5Blen('template:'):%5D%0A            templates%5Bname%5D = copy.deepcopy(DEFAULT_TEMPLATE)%0A            templates%5Bname%5D.update(_temp) # TODO Template(_temp)%0A        elif sec.startswith('port:'):%0A            _temp%5B'name'%5D = sec%5Blen('port:'):%5D%0A            ports.append(_temp) # TODO Port(_item)%0A%0A    # TODO fork processes to run nova compute services%0A    # debug: print config object%0A%0A    # hang farther process after fork%0A%0Amain()%0A

add init main() for cmd module