mirror of https://github.com/progval/irctest.git
Fix insp4 support after 'helpop' config file was renamed (#187)
c2e954903a
This commit is contained in:
parent
8530c85adc
commit
1ea3e1c15c
|
@ -1,3 +1,4 @@
|
||||||
|
import functools
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from typing import Optional, Set, Type
|
from typing import Optional, Set, Type
|
||||||
|
@ -80,8 +81,8 @@ TEMPLATE_CONFIG = """
|
||||||
|
|
||||||
# HELP/HELPOP
|
# HELP/HELPOP
|
||||||
<module name="alias"> # for the HELP alias
|
<module name="alias"> # for the HELP alias
|
||||||
<module name="helpop">
|
<module name="{help_module_name}">
|
||||||
<include file="examples/helpop.conf.example">
|
<include file="examples/{help_module_name}.conf.example">
|
||||||
|
|
||||||
# Misc:
|
# Misc:
|
||||||
<log method="file" type="*" level="debug" target="/tmp/ircd-{port}.log">
|
<log method="file" type="*" level="debug" target="/tmp/ircd-{port}.log">
|
||||||
|
@ -94,6 +95,17 @@ TEMPLATE_SSL_CONFIG = """
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@functools.lru_cache()
|
||||||
|
def installed_version() -> int:
|
||||||
|
output = subprocess.check_output(["inspircd", "--version"], universal_newlines=True)
|
||||||
|
if output.startswith("InspIRCd-3"):
|
||||||
|
return 3
|
||||||
|
if output.startswith("InspIRCd-4"):
|
||||||
|
return 4
|
||||||
|
else:
|
||||||
|
assert False, f"unexpected version: {output}"
|
||||||
|
|
||||||
|
|
||||||
class InspircdController(BaseServerController, DirectoryBasedController):
|
class InspircdController(BaseServerController, DirectoryBasedController):
|
||||||
software_name = "InspIRCd"
|
software_name = "InspIRCd"
|
||||||
supported_sasl_mechanisms = {"PLAIN"}
|
supported_sasl_mechanisms = {"PLAIN"}
|
||||||
|
@ -138,6 +150,13 @@ class InspircdController(BaseServerController, DirectoryBasedController):
|
||||||
else:
|
else:
|
||||||
ssl_config = ""
|
ssl_config = ""
|
||||||
|
|
||||||
|
if installed_version() == 3:
|
||||||
|
help_module_name = "helpop"
|
||||||
|
elif installed_version() == 4:
|
||||||
|
help_module_name = "help"
|
||||||
|
else:
|
||||||
|
assert False, f"unexpected version: {installed_version()}"
|
||||||
|
|
||||||
with self.open_file("server.conf") as fd:
|
with self.open_file("server.conf") as fd:
|
||||||
fd.write(
|
fd.write(
|
||||||
TEMPLATE_CONFIG.format(
|
TEMPLATE_CONFIG.format(
|
||||||
|
@ -147,6 +166,7 @@ class InspircdController(BaseServerController, DirectoryBasedController):
|
||||||
services_port=services_port,
|
services_port=services_port,
|
||||||
password_field=password_field,
|
password_field=password_field,
|
||||||
ssl_config=ssl_config,
|
ssl_config=ssl_config,
|
||||||
|
help_module_name=help_module_name,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
assert self.directory
|
assert self.directory
|
||||||
|
|
Loading…
Reference in New Issue