# HG changeset patch # User Goffi # Date 1396261390 -7200 # Node ID abd3a75d629c61bbf75abb941c6db03e684a98ed # Parent 61c4755f039430594e0c90f169e830ad38839728 plugin account: prosody gid is used to spawn prosodyctl process diff -r 61c4755f0394 -r abd3a75d629c src/plugins/plugin_misc_account.py --- a/src/plugins/plugin_misc_account.py Fri Mar 28 19:19:11 2014 +0100 +++ b/src/plugins/plugin_misc_account.py Mon Mar 31 12:23:10 2014 +0200 @@ -64,6 +64,7 @@ class ProsodyRegisterProtocol(protocol.ProcessProtocol): """ Try to register an account with prosody """ + prosody_gid = None def __init__(self, password=None, deferred=None): """ @@ -73,6 +74,14 @@ self.password = password self.deferred = deferred self.data = '' + if ProsodyRegisterProtocol.prosody_gid is None: + try: + import grp + ProsodyRegisterProtocol.prosody_gid = grp.getgrnam("prosody").gr_gid + info("prosody gid found: %s" % ProsodyRegisterProtocol.prosody_gid) + except: + warning("Can't find prosody gid") + def connectionMade(self): if self.password is None: @@ -107,7 +116,7 @@ prosody_reg = ProsodyRegisterProtocol(password, d) prosody_exe = join(plugin._prosody_path, plugin.getConfig('prosodyctl')) # TODO delete account which are not on the same host - reactor.spawnProcess(prosody_reg, prosody_exe, [prosody_exe, command, "%s@%s" % (profile, plugin.getConfig('new_account_domain'))], path=plugin._prosody_path) + reactor.spawnProcess(prosody_reg, prosody_exe, [prosody_exe, command, "%s@%s" % (profile, plugin.getConfig('new_account_domain'))], path=plugin._prosody_path, gid=ProsodyRegisterProtocol.prosody_gid) return d