Skip to content

Instantly share code, notes, and snippets.

View jasonjohnson's full-sized avatar
👾

Jason Johnson jasonjohnson

👾
View GitHub Profile
@jasonjohnson
jasonjohnson / test.py
Created October 7, 2023 14:19
Discover and run all tests
import unittest
if __name__ == "__main__":
suite = unittest.TestLoader().discover(
start_dir=".",
pattern="*_test.py",
)
unittest.TextTestRunner(
verbosity=2
@jasonjohnson
jasonjohnson / commands.txt
Last active January 3, 2017 16:10
Mitaka Keystone Installation Problems
With constraints:
pip install -r requirements.txt -c /opt/upper-constraints.txt
pip install pymysql -c /opt/upper-constraints.txt
pip install osprofiler -c /opt/upper-constraints.txt
python setup.py install
Without constraints:
pip install -r requirements.txt
pip install pymysql
pip install osprofiler
@jasonjohnson
jasonjohnson / keystone-requirements.patch
Created December 3, 2016 23:49
keystone stable/mitaka requirements.txt fix
diff --git a/requirements.txt b/requirements.txt
index 1a19428..c734e16 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -17,7 +17,7 @@ sqlalchemy-migrate>=0.9.6 # Apache-2.0
stevedore>=1.5.0 # Apache-2.0
passlib>=1.6 # BSD
python-keystoneclient!=1.8.0,!=2.1.0,<3.0.0,>=1.6.0 # Apache-2.0
-keystonemiddleware!=4.1.0,>=4.0.0 # Apache-2.0
+keystonemiddleware!=4.1.0,>=4.0.0,<4.11.0 # Apache-2.0
PING 172.16.10.25 (172.16.10.25) 56(84) bytes of data.
From 172.16.10.20 icmp_seq=1 Destination Host Unreachable
From 172.16.10.20 icmp_seq=2 Destination Host Unreachable
From 172.16.10.20 icmp_seq=3 Destination Host Unreachable
From 172.16.10.20 icmp_seq=4 Destination Host Unreachable
^C
--- 172.16.10.25 ping statistics ---
5 packets transmitted, 0 received, +4 errors, 100% packet loss, time 4005ms
pipe 4
2016-11-14 11:12:40.446 30742 DEBUG oslo_concurrency.processutils [req-932cbe76-c34f-46b9-87d6-6d80a685ed5f eadcdac311c64dfd8e661d7a14158d79 6fed39a8f90e4913b9a752fdaaeb6a35 - - -] Running cmd (subprocess): genisoimage -o /opt/nova-data/instances/8f6dfb8c-154e-4c71-aae9-29b052cce3c0/disk.config -ldots -allow-lowercase -allow-multidot -l -publisher OpenStack Nova 13.1.3 -quiet -J -r -V config-2 /tmp/tmpDla_bR execute /opt/nova-env/lib/python2.7/site-packages/oslo_concurrency/processutils.py:349
2016-11-14 11:12:40.459 30742 DEBUG oslo_concurrency.processutils [req-932cbe76-c34f-46b9-87d6-6d80a685ed5f eadcdac311c64dfd8e661d7a14158d79 6fed39a8f90e4913b9a752fdaaeb6a35 - - -] u'genisoimage -o /opt/nova-data/instances/8f6dfb8c-154e-4c71-aae9-29b052cce3c0/disk.config -ldots -allow-lowercase -allow-multidot -l -publisher OpenStack Nova 13.1.3 -quiet -J -r -V config-2 /tmp/tmpDla_bR' failed. Not Retrying. execute /opt/nova-env/lib/python2.7/site-packages/oslo_concurrency/processutils.py:427
2016-11-14 11:12:40.461 307
@jasonjohnson
jasonjohnson / composer.json
Created July 24, 2014 15:09
Symfony Router
{
"require": {
"symfony/routing": "2.5.*",
"symfony/http-foundation": "2.5.*"
}
}
@jasonjohnson
jasonjohnson / client.sh
Created June 14, 2014 02:50
ZF2 JSON-RPC
#!/bin/bash
curl \
-X POST \
-d '{"method": "add", "params": [1, 2], "id": 1}' \
http://127.0.0.1:8080/server.php
@jasonjohnson
jasonjohnson / decoder.py
Last active August 29, 2015 14:01
bencode thing
from string import digits
class Decoder(object):
def __init__(self, source):
self.offset = 0
self.source = source
def current(self):
return self.source[self.offset]
@jasonjohnson
jasonjohnson / nugget.py
Created May 16, 2014 01:12
sketch for simple python database lib?
from nugget import use, bind, find, load, save
# Open a database.
use(":memory:")
# Create a class to bind to a database table.
class Contact(object):
pass
# Associate a class with a database table.
@jasonjohnson
jasonjohnson / sqlite.py
Last active August 29, 2015 14:01
python sqlite example
import sqlite3 as db
connection = db.connect(":memory:")
# Use the built-in row factory class and auto-commit
# all data modifications.
connection.row_factory = db.Row
connection.isolation_level = None