def setUp(self, *args, **kwargs): # Make a local reference to the CherryPy app so we can mock attributes. self.app = app __opts__ = self.config.copy() __opts__.update( self.__opts__ or { 'external_auth': { 'auto': { 'saltdev': [ '@wheel', '@runner', '.*', ], } }, 'rest_cherrypy': { 'port': 8000, 'debug': True, }, }) root, apiopts, conf = app.get_app(__opts__) cherrypy.tree.mount(root, '/', conf) cherrypy.server.unsubscribe() cherrypy.engine.start()
def setUp(self, *args, **kwargs): # Make a local reference to the CherryPy app so we can mock attributes. self.app = app __opts__ = self.config.copy() __opts__.update(self.__opts__ or { 'external_auth': { 'auto': { 'saltdev': [ '@wheel', '@runner', '.*', ], } }, 'rest_cherrypy': { 'port': 8000, 'debug': True, }, }) root, apiopts, conf = app.get_app(__opts__) cherrypy.tree.mount(root, '/', conf) cherrypy.server.unsubscribe() cherrypy.engine.start()
def setUp(self): # Make a local reference to the CherryPy app so we can mock attributes. self.app = app self.addCleanup(delattr, self, "app") master_conf = os.path.join(RUNTIME_VARS.TMP_CONF_DIR, 'master') client_config = salt.config.client_config(master_conf) base_opts = {} base_opts.update(client_config) base_opts.update( self.__get_opts__() or { "external_auth": { "auto": {"saltdev": ["@wheel", "@runner", ".*"]}, "pam": {"saltdev": ["@wheel", "@runner", ".*"]}, }, "rest_cherrypy": {"port": 8000, "debug": True}, } ) root, apiopts, conf = app.get_app(base_opts) cherrypy.tree.mount(root, "/", conf) cherrypy.server.unsubscribe() cherrypy.engine.start() # Make sure cherrypy does not memleak on its bus since it keeps # adding handlers without cleaning the old ones each time we setup # a new application for value in cherrypy.engine.listeners.values(): value.clear() cherrypy.engine._priorities.clear() self.addCleanup(cherrypy.engine.exit)
def bootstrap_app(): ''' Grab the opts dict of the master config by trying to import Salt ''' from salt.netapi.rest_cherrypy import app import salt.config __opts__ = salt.config.client_config( os.environ.get('SALT_MASTER_CONFIG', '/etc/salt/master')) return app.get_app(__opts__)
def bootstrap_app(): ''' Grab the opts dict of the master config by trying to import Salt ''' from salt.netapi.rest_cherrypy import app import salt.config __opts__ = salt.config.client_config( os.environ.get('SALT_MASTER_CONFIG', '/etc/salt/master')) return app.get_app(__opts__)
def bootstrap_app(): """ Grab the opts dict of the master config by trying to import Salt """ import salt.config from salt.netapi.rest_cherrypy import app __opts__ = salt.config.client_config( os.environ.get("SALT_MASTER_CONFIG", "/etc/salt/master") ) return app.get_app(__opts__)
def setUp(self): # Make a local reference to the CherryPy app so we can mock attributes. self.app = app self.addCleanup(delattr, self, 'app') master_conf = os.path.join(RUNTIME_VARS.TMP_CONF_DIR, 'master') client_config = salt.config.client_config(master_conf) base_opts = {} base_opts.update(client_config) base_opts.update( self.__get_opts__() or { 'external_auth': { 'auto': { 'saltdev': [ '@wheel', '@runner', '.*', ], }, 'pam': { 'saltdev': [ '@wheel', '@runner', '.*', ], } }, 'rest_cherrypy': { 'port': 8000, 'debug': True, }, }) root, apiopts, conf = app.get_app(base_opts) cherrypy.tree.mount(root, '/', conf) cherrypy.server.unsubscribe() cherrypy.engine.start() # Make sure cherrypy does not memleak on it's bus since it keeps # adding handlers without cleaning the old ones each time we setup # a new application for value in cherrypy.engine.listeners.values(): value.clear() cherrypy.engine._priorities.clear() self.addCleanup(cherrypy.engine.exit)