blob: 9ac7ea111d910d5b28975b3127f9ef8cbff5bb4d [file] [log] [blame]
martin f. krafftf37f0682013-06-14 16:36:20 +02001#!/usr/bin/python
2# -*- coding: utf-8 -*-
3#
4# ansible-adapter — adapter between Ansible and reclass
5#
6# Copyright © 2007–13 martin f. krafft <madduck@madduck.net>
7# Released under the terms of the Artistic Licence 2.0
8#
martin f. krafftb37f9df2013-06-26 15:41:31 +02009import os, sys, posix
10
11ansible_dir = os.path.dirname(sys.argv[0])
12
13# In order to be able to use reclass as modules, manipulate the search
14# path, starting from the location of the adapter. Realpath will make
15# sure that symlinks are resolved.
16realpath = os.path.realpath(sys.argv[0] + '/../../')
17sys.path.insert(0, realpath)
martin f. krafft7c64f9c2013-06-25 13:26:23 +020018from reclass.adapters.ansible import ansible_adapter
martin f. krafftb37f9df2013-06-26 15:41:31 +020019
20def exc_handler(message, rc):
21 print >>sys.stderr, message
22 sys.exit(rc)
23
24ansible_adapter(ansible_dir, exc_handler)
25sys.exit(posix.EX_OK)