def main(args): useFakeRackConf() useFakeIPMITool() if args.I != "lanplus": assert args.I is None action = dict(power=power, sol=sol, chassis=chassis).get(args.action) action(args.subaction)
def main(args): useFakeRackConf() useFakeIPMITool() with open(config.RACK_YAML, "r") as f: conf = yaml.load(f) if args.I != "lanplus": assert args.I is None hostname = args.H try: host = [host for host in conf["HOSTS"] if host["ipmiLogin"]["hostname"] == hostname][0] except IndexError: print "Invalid hostname: %(hostname)s" % dict(hostname=hostname) raise assert args.U == host["ipmiLogin"]["username"] assert args.P == host["ipmiLogin"]["password"] action = dict(power=power, sol=sol).get(args.action) action(args.subaction)
import logging import threading from rackattack.physical import pikapatch, config from rackattack.physical.tests.integration import fakehosts from rackattack.physical.tests.integration.main import (useFakeRackConf, useFakeIPMITool, useFakeGeneralConfiguration) def configureLogging(): for loggerName in ("fakeConsumersServer", "pipeListener"): _logger = logging.getLogger(loggerName) handler = logging.StreamHandler() handler.setLevel(logging.DEBUG) formatter = logging.Formatter('%(name)s: %(message)s') handler.setFormatter(formatter) _logger.addHandler(handler) _logger.setLevel(logging.DEBUG) _logger.propagate = False if __name__ == "__main__": useFakeRackConf() useFakeIPMITool() useFakeGeneralConfiguration() configureLogging() fakeHostsServer = fakehosts.FakeHosts() fakeHostsServer.run()