diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6199e5a6..cb714b7f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,10 @@ All changes to this project will be documented in this file. +## [10.2.9] - 2020-08-19 + +(ws) cobra to python bot / take a module python name as argument foo.bar.baz instead of a path foo/bar/baz.py + ## [10.2.8] - 2020-08-19 (ws) on Linux with mbedtls, when the system ca certs are specified (the default) pick up sensible OS supplied paths (tested with CentOS and Alpine) diff --git a/ixbots/ixbots/IXCobraToPythonBot.cpp b/ixbots/ixbots/IXCobraToPythonBot.cpp index 384c51ff..7f8fc5d3 100644 --- a/ixbots/ixbots/IXCobraToPythonBot.cpp +++ b/ixbots/ixbots/IXCobraToPythonBot.cpp @@ -102,7 +102,7 @@ namespace ix { int64_t cobra_to_python_bot(const ix::CobraBotConfig& config, StatsdClient& statsdClient, - const std::string& scriptPath) + const std::string& moduleName) { #ifndef IXBOTS_USE_PYTHON CoreLogger::error("Command is disabled. " @@ -113,10 +113,7 @@ namespace ix Py_InitializeEx(0); // 0 arg so that we do not install signal handlers // which prevent us from using Ctrl-C - size_t lastIndex = scriptPath.find_last_of("."); - std::string modulePath = scriptPath.substr(0, lastIndex); - - PyObject* pyModuleName = PyUnicode_DecodeFSDefault(modulePath.c_str()); + PyObject* pyModuleName = PyUnicode_DecodeFSDefault(moduleName.c_str()); if (pyModuleName == nullptr) { diff --git a/ixbots/ixbots/IXCobraToPythonBot.h b/ixbots/ixbots/IXCobraToPythonBot.h index 448234e7..ad96c110 100644 --- a/ixbots/ixbots/IXCobraToPythonBot.h +++ b/ixbots/ixbots/IXCobraToPythonBot.h @@ -15,5 +15,5 @@ namespace ix { int64_t cobra_to_python_bot(const ix::CobraBotConfig& config, StatsdClient& statsdClient, - const std::string& scriptPath); + const std::string& moduleName); } // namespace ix diff --git a/ixwebsocket/IXWebSocketVersion.h b/ixwebsocket/IXWebSocketVersion.h index 13a03f37..5df38a9c 100644 --- a/ixwebsocket/IXWebSocketVersion.h +++ b/ixwebsocket/IXWebSocketVersion.h @@ -6,4 +6,4 @@ #pragma once -#define IX_WEBSOCKET_VERSION "10.2.8" +#define IX_WEBSOCKET_VERSION "10.2.9" diff --git a/ws/ws.cpp b/ws/ws.cpp index 66deda8f..03da67b9 100644 --- a/ws/ws.cpp +++ b/ws/ws.cpp @@ -2814,7 +2814,7 @@ int main(int argc, char** argv) std::string project; std::string key; std::string logfile; - std::string scriptPath; + std::string moduleName; std::string republishChannel; std::string sendMsg("hello world"); ix::SocketTLSOptions tlsOptions; @@ -3085,8 +3085,7 @@ int main(int argc, char** argv) cobra2python->add_option("--host", hostname, "Statsd host"); cobra2python->add_option("--port", statsdPort, "Statsd port"); cobra2python->add_option("--prefix", prefix, "Statsd prefix"); - cobra2python->add_option("--script", scriptPath, "Python script path") - ->check(CLI::ExistingPath); + cobra2python->add_option("--module", moduleName, "Python module"); cobra2python->add_option("--pidfile", pidfile, "Pid file"); addTLSOptions(cobra2python); addCobraBotConfig(cobra2python); @@ -3389,7 +3388,7 @@ int main(int argc, char** argv) } else { - ret = (int) ix::cobra_to_python_bot(cobraBotConfig, statsdClient, scriptPath); + ret = (int) ix::cobra_to_python_bot(cobraBotConfig, statsdClient, moduleName); } } else if (app.got_subcommand("cobra_to_sentry"))