예제 #1
0
    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()
예제 #2
0
파일: __init__.py 프로젝트: DaveQB/salt
    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()
예제 #3
0
    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)
예제 #4
0
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__)
예제 #5
0
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__)
예제 #6
0
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__)
예제 #7
0
    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)