def app_factory(global_config, **local_config): """ Use `./bin/paster serve path/to/config.ini to instantiate a WSGI application. Enter the debug shell using the command line option `shell=true`. This will start an interpreter with the components registry available as `gsm` and the parsed config as `settings`. """ # parse config settings = _parse_config(global_config, local_config) # bootstrap components bootstrapper = Bootstrapper(settings=settings) bootstrapper.setup_components() # if the user has set the shell if settings['shell']: # get a handle on the component registry and interact from zope.component import getGlobalSiteManager gsm = getGlobalSiteManager() # interact import code code.interact(local=locals()) # return wsgi app return web.WSGIApplication(mapping, settings=settings)
def __request_now_bootstrap(self, directory_id=None, directory=None, all_files=True): if (not directory_id) and (not directory): raise ValueError( "You must provide either directory_id or \ directory" ) sdb = AirtimeDB(apc()) if directory: directory = os.path.normpath(directory) if directory_id == None: directory_id = sdb.to_id(directory) if directory == None: directory = sdb.to_directory(directory_id) try: bs = Bootstrapper(sdb, self.manager.watch_signal()) bs.flush_watch(directory=directory, last_ran=self.cfg.last_ran()) except Exception as e: self.fatal_exception("Exception bootstrapping: (dir,id)=(%s,%s)" % (directory, directory_id), e) raise DirectoryIsNotListed(directory, cause=e)
def main(): filename = _get_log_filename() LoggingService(INITIAL_LOG_LEVEL, INITIAL_LOG_LEVEL, filename) bootstrapper = Bootstrapper() ces = bootstrapper.get_command_executer_service() command_to_run = os.environ.get('COMMAND') # for debug if len(sys.argv) > 2 and sys.argv[1] == "debug": cloudshellConnectData = {"user": "******", "password": "******", "domain": "Global", "reservationId": "17b9c357-bfe8-46b9-9828-47b3e1cacc4f"} attachAndGetResourceContext(cloudshellConnectData) command_to_run = sys.argv[2] os.environ["resourceContext".upper()] = '{"name":"VCenter Template Request", "address":"Service",' \ ' "model":"VCenter Template Request", "family":"VM Request", ' \ '"description":"", "fullname":"", ' \ '"attributes":{"vCenter Template":"vCenter/QualiSB/Alex/test",' \ '"VM Power State":"True",' \ '"VM Storage":"eric ds cluster", ' \ '"VM Cluster":"QualiSB Cluster/LiverPool"}}' # execute the command getattr(ces, command_to_run)()
import time import encryption import rsa from bootstrap import Bootstrapper from gossip import GossipServer try: f = open('pub-key.pem', 'r') except IOError: encryption.make_key() f = open('pub-key.pem', 'r') pubkey = f.read() f.close() bs = Bootstrapper(pubkey) bs.bootstrap() time.sleep(5) gs = GossipServer(bs) while True: filename = raw_input('Filename: ') if filename == 'exit': exit() gs.init_file_request(filename)
from aiohttp import web from bootstrap import Bootstrapper bootstrapper = Bootstrapper() web.run_app(bootstrapper.create_application())