| #!/usr/bin/python |
| # -*- coding: utf-8 -*- |
| # |
| # ansible-adapter — adapter between Ansible and reclass |
| # |
| # IMPORTANT NOTICE: I was kicked out of the Ansible community, and therefore |
| # I have no interest in developing this adapter anymore. If you use it and |
| # want to turn it into a setuptools entrypoints compatible adapter, I will |
| # take your patch. |
| # |
| # Copyright © 2007–13 martin f. krafft <madduck@madduck.net> |
| # Released under the terms of the Artistic Licence 2.0 |
| # |
| import os, sys, posix |
| |
| ansible_dir = os.path.dirname(sys.argv[0]) |
| |
| # In order to be able to use reclass as modules, manipulate the search |
| # path, starting from the location of the adapter. Realpath will make |
| # sure that symlinks are resolved. |
| realpath = os.path.realpath(sys.argv[0] + '/../../') |
| sys.path.insert(0, realpath) |
| from reclass.adapters.ansible import ansible_adapter |
| |
| def exc_handler(message, rc): |
| print >>sys.stderr, message |
| sys.exit(rc) |
| |
| ansible_adapter(ansible_dir, exc_handler) |
| sys.exit(posix.EX_OK) |