Пример #1
0
def run():
    # TODO(kgriffs): For now, we have to use the global config
    # to pick up common options from openstack.common.log, since
    # that module uses the global CONF instance exclusively.
    conf = cfg.CONF
    conf(project='marconi', prog='marconi-queues')

    server = bootstrap.Bootstrap(conf)
    server.run()
Пример #2
0
    def setUp(self):
        super(FunctionalTestBase, self).setUp()

        # NOTE(flaper87): Config can't be a class
        # attribute because it may be necessary to
        # modify it at runtime which will affect
        # other instances running instances.
        self.cfg = config.load_config()

        if not self.cfg.run_tests:
            self.skipTest("Functional tests disabled")

        self.mconf = self.load_conf(self.cfg.marconi.config)

        validator = validation.Validator(self.mconf)
        self.limits = validator._limits_conf
        self.response = response.ResponseSchema(self.limits)

        if _TEST_INTEGRATION:
            # TODO(kgriffs): This code should be replaced to use
            # an external wsgi server instance.

            # NOTE(flaper87): Use running instances.
            if self.cfg.marconi.run_server:
                if not (self.server and self.server.is_alive()):
                    # pylint: disable=not-callable
                    self.server = self.server_class()
                    self.server.start(self.mconf)

            self.client = http.Client()
        else:
            self.client = http.WSGIClient(
                bootstrap.Bootstrap(config.cfg.CONF).transport.app)

        self.headers = helpers.create_marconi_headers(self.cfg)

        if self.cfg.auth.auth_on:
            auth_token = helpers.get_keystone_token(self.cfg, self.client)
            self.headers["X-Auth-Token"] = auth_token

        self.headers_response_with_body = set(['location', 'content-type'])

        self.client.set_headers(self.headers)
Пример #3
0
    def setUp(self):
        super(TestBase, self).setUp()

        if not self.config_file:
            self.skipTest("No config specified")

        self.conf.register_opts(validation._TRANSPORT_LIMITS_OPTIONS,
                                group=validation._TRANSPORT_LIMITS_GROUP)
        self.transport_cfg = self.conf[validation._TRANSPORT_LIMITS_GROUP]

        self.conf.register_opts(driver._WSGI_OPTIONS, group=driver._WSGI_GROUP)
        self.wsgi_cfg = self.conf[driver._WSGI_GROUP]

        self.conf.admin_mode = True
        self.boot = bootstrap.Bootstrap(self.conf)

        self.app = self.boot.transport.app

        self.srmock = ftest.StartResponseMock()
Пример #4
0
def run():
    # TODO(kgriffs): For now, we have to use the global config
    # to pick up common options from openstack.common.log, since
    # that module uses the global CONF instance exclusively.
    conf = cfg.CONF
    conf(project='marconi', prog='marconi-queues')

    server = bootstrap.Bootstrap(conf)

    # The following code is to daemonize marconi-server to avoid
    # an issue with wsgiref writing to stdout/stderr when we don't
    # want it to.  This is specifically needed to allow marconi to
    # run under devstack, but it may also be useful for other scenarios.
    # Open /dev/zero and /dev/null for redirection.
    # Daemonizing marconi-server is needed *just* when running under devstack
    # and when marconi is invoked with `daemon` command line option.
    if conf.daemon:
        zerofd = os.open('/dev/zero', os.O_RDONLY)
        nullfd = os.open('/dev/null', os.O_WRONLY)

        # Close the stdthings and reassociate them with a non terminal
        os.dup2(zerofd, 0)
        os.dup2(nullfd, 1)
        os.dup2(nullfd, 2)

        # Detach process context, this requires 2 forks.
        try:
            pid = os.fork()
            if pid > 0:
                os._exit(0)
        except OSError:
            os._exit(1)

        try:
            pid = os.fork()
            if pid > 0:
                os._exit(0)
        except OSError:
            os._exit(2)
    server.run()
Пример #5
0
 def get_target(self, conf):
     conf.admin_mode = True
     server = bootstrap.Bootstrap(conf)
     conf.admin_mode = False
     return server.run
Пример #6
0
 def get_target(self, conf):
     server = bootstrap.Bootstrap(conf)
     return server.run
Пример #7
0
 def _bootstrap(self, conf_file):
     self.conf = self.load_conf(conf_file)
     return bootstrap.Bootstrap(self.conf)
Пример #8
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""WSGI App for WSGI Containers

This app should be used by external WSGI
containers. For example:

    $ gunicorn marconi.queues.transport.wsgi.app:app

NOTE: As for external containers, it is necessary
to put config files in the standard paths. There's
no common way to specify / pass configuration files
to the WSGI app when it is called from other apps.
"""

from oslo.config import cfg

from marconi.queues import bootstrap

# TODO(kgriffs): For now, we have to use the global config
# to pick up common options from openstack.common.log, since
# that module uses the global CONF instance exclusively.
conf = cfg.CONF
conf(project='marconi', prog='marconi-queues', args=[])

app = bootstrap.Bootstrap(conf).transport.app