Preauthorization in Keystone

“I’ll gladly pay you Tuesday for a Hamburger Today” –Wimpy, from the Popeye Cartoon.

Sometimes you need to authorize a service to perform an action on your behalf. Often, that action takes place long after any authentication token you can provide would have expired.  Currently, the only mechanism in Keystone that people can use is to share credentials. We can do better.

Continue reading

Installing RPM Build Dependencies

If you ever want to build and RPM, you need to make sure that the things it requires are installed. These are listed in the SPEC file on lines that begin with BuildRequires.  Installing these by hand is time consuming enough that it should be automated.  Here’s a first hack in Python.

 

#!/usr/bin/python
import sys
import re

build_re = re.compile('BuildRequires:.*')
compare_re = re.compile('.*=.*')


def main():
    if (len(sys.argv) > 1):
        spec = open(sys.argv[1])
        for line in spec:
            if build_re.match(line):
                for token in line.rsplit(" "):
                    if build_re.match(token):
                        continue
                    if compare_re.match(token):
                        break
                    token = token.rstrip(" ,\n\r")
                    if len(token) > 0:
                        print token


if __name__ == "__main__":
    main()

To use it, save in a file called buildreqs.py and run:

sudo yum install `./buidreqs.py ~/rpmbuild/SPECS/krb5.spec`

Speeding up SQLite based unit tests

 

If you write database driven applications, you probably have used SQLite at some point. Since it is a simple embedded database, it is a logical choice to use for unit tests that go to the database. However, SQLite performance on Ext4 (default Fedora File system) is lack-luster.
A cheap way to speed things up is to use a ramdisk as the backing store for the database.
Continue reading