view docker/prosody/scripts/container_server @ 114:14b29b9e06bb

docker (prosody): fixed prosodyctl call in container_server: it was not using absolute path, so it was calling /usr/local/bin/prosodyctl instead of /usr/bin/prosodyctl, resulting in a loop
author Goffi <goffi@goffi.org>
date Tue, 01 Mar 2016 15:47:02 +0100
parents b69056368901
children
line wrap: on
line source

#!/usr/bin/env python2
# this script allow to call prosodyctl and get configuration variables from linked containers
import subprocess, SimpleXMLRPCServer, os

def prosodyctl(command, profile, pwd):
    process = subprocess.Popen(["/usr/bin/prosodyctl", command, profile], stdin=subprocess.PIPE)
    if pwd:
        process.communicate("%s\n%s" % (pwd,pwd))
    return process.wait()

def getenv(variable):
    assert variable in ("SAT_PUBSUB_SECRET", "SAT_SALUT_SECRET", "DOMAIN")
    return os.getenv(variable)

server = SimpleXMLRPCServer.SimpleXMLRPCServer(("0.0.0.0", 9999))
server.register_function(prosodyctl, "prosodyctl")
server.register_function(getenv, "getenv")
server.serve_forever()