(ws) cobra to python bot / take a module python name as argument foo.bar.baz instead of a path foo/bar/baz.py
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
| @@ -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) | ||||
|         { | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -6,4 +6,4 @@ | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #define IX_WEBSOCKET_VERSION "10.2.8" | ||||
| #define IX_WEBSOCKET_VERSION "10.2.9" | ||||
|   | ||||
| @@ -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")) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user