Now packaging 2013.1_g0.5+dcfb45320a
[openstack-build/ceilometer-build.git] / xenial / debian / patches / removes-needs-for-wsme-python-module.patch
1 Description: Removes the need for WSME
2 Author: Julien Danjou <julien@danjou.info>
3 Origin: upstream, https://review.openstack.org/#/c/18477/
4
5 --- ceilometer-2013.1~g0.4+23ff2f9bbf.orig/bin/ceilometer-api
6 +++ ceilometer-2013.1~g0.4+23ff2f9bbf/bin/ceilometer-api
7 @@ -18,15 +18,10 @@
8  # under the License.
9  """Set up the development API server.
10  """
11 -import os
12  import sys
13 -from wsgiref import simple_server
14  
15 -from pecan import configuration
16 -
17 -from ceilometer.api import acl
18 -from ceilometer.api import app
19 -from ceilometer.api import config as api_config
20 +from ceilometer.api.v1 import acl
21 +from ceilometer.api.v1 import app
22  from ceilometer.openstack.common import cfg
23  from ceilometer.openstack.common import log as logging
24  
25 @@ -37,34 +32,15 @@ if __name__ == '__main__':
26      # inputs.
27      acl.register_opts(cfg.CONF)
28  
29 -    # Parse OpenStack config file and command line options, then
30 -    # configure logging.
31 +    # Parse config file and command line options,
32 +    # then configure logging.
33      cfg.CONF(sys.argv[1:])
34      logging.setup('ceilometer.api')
35  
36 -    # Set up the pecan configuration
37 -    filename = api_config.__file__.replace('.pyc', '.py')
38 -    pecan_config = configuration.conf_from_file(filename)
39 -
40 -    # Build the WSGI app
41 -    root = app.setup_app(pecan_config,
42 -                         extra_hooks=[acl.AdminAuthHook()])
43 -    root = acl.install(root, cfg.CONF)
44 -
45 -    # Create the WSGI server and start it
46 -    host, port = '0.0.0.0', int(cfg.CONF.metering_api_port)
47 -    srv = simple_server.make_server(host, port, root)
48 -
49 -    print 'Starting server in PID %s' % os.getpid()
50 -
51 -    if host == '0.0.0.0':
52 -        print 'serving on 0.0.0.0:%s, view at http://127.0.0.1:%s' % \
53 -            (port, port)
54 -    else:
55 -        print "serving on http://%s:%s" % (host, port)
56 -
57 -    try:
58 -        srv.serve_forever()
59 -    except KeyboardInterrupt:
60 -        # allow CTRL+C to shutdown without an error
61 -        pass
62 +    root = app.make_app()
63 +
64 +    # Enable debug mode
65 +    if cfg.CONF.verbose or cfg.CONF.debug:
66 +        root.debug = True
67 +
68 +    root.run(host='0.0.0.0', port=cfg.CONF.metering_api_port)