Keystone uses PKI tokens by default, but they are very long and make the logs harder to read. Use the shorter UUID tokens instead:
KEYSTONE_TOKEN_FORMAT=UUID
To log to /opt/stack/logs/screen/
#Using Vagrant Vagrant does the grunt work of creating VirtualBox VMs.
sudo apt-get install vagrant
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # increment this so it is unique | |
| $eth1_ip = "192.168.2.2" | |
| def add_disk(vb, vm_id, port_num, size) | |
| # sata port_num should be unique > 0 | |
| # size is in GB | |
| # notes: will only work if the image uses a sata controller. |
| # http://jpmens.net/2012/07/15/ansible-it-s-a-fact/ | |
| #$ cat count_users | |
| ##!/bin/sh | |
| #COUNT=`who | wc -l` | |
| #cat <<EOF | |
| #{ | |
| # "ansible_facts" : { | |
| # "users_logged_in" : $COUNT |
| [pipeline:main] | |
| pipeline = auth hello | |
| [app:hello] | |
| paste.app_factory = app_layer:app_factory | |
| [filter:auth] | |
| paste.filter_factory = auth_layer:filter_factory |
| from webob import Response | |
| from webob.dec import wsgify | |
| @wsgify | |
| def application(request): | |
| return Response('Hello, welcome to paste \n') | |
| def app_factory(global_config, **local_config): | |
| return application |
| from webob.dec import wsgify | |
| from webob import exc | |
| @wsgify.middleware | |
| def auth_filter(request, app): | |
| if request.headers.get('X-Auth-Token') != 'open-sesame': | |
| return exc.HTTPForbidden() | |
| return app(request) | |
| def filter_factory(global_config, **local_config): |
| from paste import httpserver | |
| from paste.deploy import loadapp | |
| wsgi_app = loadapp('config:' + '/etc/example/paste.ini') | |
| httpserver.serve(wsgi_app, host='127.0.0.1', port=8080) |
| import sys | |
| import urllib2 | |
| req = urllib2.Request('http://127.0.0.1:8080') | |
| req.add_header('X-Auth-Token', sys.argv[1]) | |
| try: | |
| res = urllib2.urlopen(req) | |
| print res.read() | |
| except urllib2.HTTPError as e: |
| $ python start_app.py | |
| serving on http://127.0.0.1:8080 | |
| $ python do_get.py wrong-token | |
| HTTP Error 403: Forbidden | |
| $ py do_get.py open-sesame | |
| Hello, welcome to paste |