Skip to content

Instantly share code, notes, and snippets.

{
"allocation_requests": [
{
"allocations": {
"e5a3195f-0466-4c88-be32-e8778d445d7c": {
"resources": {
"VCPU": 1
}
}
}
#!/bin/bash -e
# Either install from pip if no $1, or $1 is a path or URL
# to an installable placement (such as a local copy of the
# repo).
PLACEMENT_LOCATION=${1:-openstack-placement}
# Make the virtualenv
python -m virtualenv -p python3 placetest
#!/bin/bash -e
# Either install from pip if no $1, or $1 is a path or URL
# to an installable placement (such as a local cop of the
# repo).
PLACEMENT_LOCATION=${1:-openstack-placement}
# Make the virtualenv
python -m virtualenv -p python3 placetest
import contextlib
import functools
import testtools
from alembic import script
import fixtures
import mock
from oslo_concurrency.fixture import lockutils as concurrency
from oslo_config import fixture as config_fixture
from oslo_db import exception as db_exc
#!/bin/bash
set -xe
# Change these as required
CONF_DIR=/etc/placement
DB_DRIVER=mysql+pymysql # we assume mysql throughout, feel free to change
DB_NAME=placement
DB_USER=root
DB_PASS=secret

Demo difference in behaviors between pyyaml 3 and 4 when using custom tags and safe loading. Also check against a pending Ingy change.

Run tox to see it in action. The different versions will do different things. Which is right?

The key difference is that in PyYAML 3 we see ConstructorErrors from safe_load and in PyYAML 4 they are from danger mode.

@cdent
cdent / README.md
Created October 28, 2017 15:28 — forked from FND/README.md
complate-wsgi sandbox
$ python3 -m venv venv
$ . venv/bin/activate

$ pip install js2py gunicorn

$ gunicorn app:app

http://localhost:8000

defaults:
request_headers:
content-type: application/json
verbose: True
tests:
- name: post data
POST: /
data:
@cdent
cdent / app.py
Last active April 16, 2018 19:50 — forked from FND/app.py
custom Python module importer
from hook import register_import_hook
print('calling to register')
register_import_hook()
print('registered')
def later():
import test_foo
@cdent
cdent / extractbin.py
Created November 15, 2016 14:54
a tool to pull the binaries out of a fat json tiddlers collection
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.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