blob: b6e4f8f992aa3c80782e7fa4e3374f88e0f2e448 [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#
martin f. krafftc2c355b2013-07-01 20:04:15 +02006# IMPORTANT NOTICE: I was kicked out of the Ansible community, and therefore
7# I have no interest in developing this adapter anymore. If you use it and
8# want to turn it into a setuptools entrypoints compatible adapter, I will
9# take your patch.
10#
martin f. krafftf37f0682013-06-14 16:36:20 +020011# Copyright © 2007–13 martin f. krafft <madduck@madduck.net>
12# Released under the terms of the Artistic Licence 2.0
13#
martin f. krafftb37f9df2013-06-26 15:41:31 +020014import os, sys, posix
15
16ansible_dir = os.path.dirname(sys.argv[0])
17
18# In order to be able to use reclass as modules, manipulate the search
19# path, starting from the location of the adapter. Realpath will make
20# sure that symlinks are resolved.
21realpath = os.path.realpath(sys.argv[0] + '/../../')
22sys.path.insert(0, realpath)
martin f. krafft7c64f9c2013-06-25 13:26:23 +020023from reclass.adapters.ansible import ansible_adapter
martin f. krafftb37f9df2013-06-26 15:41:31 +020024
25def exc_handler(message, rc):
26 print >>sys.stderr, message
27 sys.exit(rc)
28
29ansible_adapter(ansible_dir, exc_handler)
30sys.exit(posix.EX_OK)