Changeset 89838be in nscp
- Timestamp:
- 01/16/12 22:22:59 (17 months ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2
- Children:
- ffa6a59
- Parents:
- 35254d1
- Files:
-
- 13 edited
-
changelog (modified) (1 diff)
-
helpers/settings_manager/settings_manager_impl.cpp (modified) (2 diffs)
-
modules/NRPEClient/NRPEClient.cpp (modified) (2 diffs)
-
scripts/python/lib/test_helper.py (modified) (4 diffs)
-
scripts/python/test_nrpe.py (modified) (1 diff)
-
scripts/python/test_python.py (modified) (1 diff)
-
service/NSClient++.cpp (modified) (7 diffs)
-
service/NSClient++.h (modified) (2 diffs)
-
service/cli_parser.hpp (modified) (4 diffs)
-
service/settings_client.hpp (modified) (1 diff)
-
service/simple_client.hpp (modified) (1 diff)
-
version.hpp (modified) (1 diff)
-
version.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
changelog
r35254d1 r89838be 5 5 * Fixa dependonservice LanManWorkStation (old win) 6 6 * Fix RtlStringFromGUID problem on NT4 7 8 2012-01-16 MickeM 9 * Added option to both execute and query item (with a reload in the middle for installing/running unittests) 10 * Fixed issue in python unittest framework to handle "unload" (ie. reload) 11 * Fixed NRPE certificate path lookup issue 12 * Fixed some minor issues here and there 13 * Fixed issue in loader to allow loading dummy as dummy (and not only dummy://) 7 14 8 15 2012-01-15 MickeM -
helpers/settings_manager/settings_manager_impl.cpp
rba63b95 r89838be 119 119 if (key == _T("ini")) 120 120 return DEFAULT_CONF_INI_LOCATION; 121 if (key == _T("dummy")) 122 return _T("dummy://"); 121 123 return key; 122 124 } … … 124 126 bool NSCSettingsImpl::context_exists(std::wstring key) { 125 127 net::wurl url = net::parse(key); 128 if (url.protocol.empty()) 129 url = net::parse(expand_context(key)); 126 130 #ifdef WIN32 127 131 if (url.protocol == _T("old")) -
modules/NRPEClient/NRPEClient.cpp
ra87ce04 r89838be 152 152 nscapi::target_handler::target t = targets.add(get_settings_proxy(), target_path , key, arg); 153 153 if (t.has_option(_T("certificate"))) { 154 boost::filesystem::wpath p = t.options[_T("certificate")]; 154 std::wstring value = t.options[_T("certificate")]; 155 boost::filesystem::wpath p = value; 155 156 if (!boost::filesystem::is_regular(p)) { 156 157 p = get_core()->getBasePath() / p; 157 t.options[_T("certificate")] = utf8::cvt<std::wstring>(p.string()); 158 if (boost::filesystem::is_regular(p)) { 159 value = p.string(); 160 } else { 161 value = get_core()->expand_path(value); 162 } 163 t.options[_T("certificate")] = value; 158 164 targets.add(t); 159 165 } … … 164 170 } 165 171 } 172 } catch (const std::exception &e) { 173 NSC_LOG_ERROR_STD(_T("Failed to add target: ") + key + _T(", ") + utf8::to_unicode(e.what())); 166 174 } catch (...) { 167 175 NSC_LOG_ERROR_STD(_T("Failed to add target: ") + key); -
scripts/python/lib/test_helper.py
rba63b95 r89838be 16 16 17 17 def shutdown_testcases(): 18 get_test_manager().shutdown() 18 if get_test_manager(): 19 get_test_manager().shutdown() 20 destroy_test_manager() 19 21 20 22 def get_test_manager(): … … 22 24 return test_manager 23 25 26 def destroy_test_manager(): 27 global test_manager 28 test_manager = None 29 24 30 def create_test_manager(plugin_id = 0, plugin_alias = '', script_alias = ''): 25 31 global test_manager 26 32 if not test_manager: 33 log('=== Creating new Test manager ===') 27 34 test_manager = TestManager(plugin_id, plugin_alias, script_alias) 28 35 … … 34 41 35 42 reg.simple_function('py_unittest', run_tests, 'Run python unit test suite') 43 else: 44 log('=== Reusing existing testmanager ===') 36 45 37 46 return test_manager … … 284 293 285 294 #core = Core.get() 295 #core.reload('service') 286 296 #(code, msg, perf) = core.simple_query('py_unittest', []) 287 297 -
scripts/python/test_nrpe.py
rba63b95 r89838be 188 188 return r1 189 189 result = TestResult() 190 result.add_message(True, '*FAILED* to send message with %s (retrying)'% encryption)190 result.add_message(True, '*FAILED* to send message with %s (retrying)'%tag) 191 191 r2 = self.submit_payload('%s/%s'%(ssl, length), ssl, length, '%ssrc%s'%(tag, tag), state, '%smsg%s'%(tag, tag), '') 192 192 if r2: 193 193 result.add(r2) 194 194 return result 195 result.add_message(False, 'Failed to send message with: %s %%s'%(ssl, length))195 result.add_message(False, 'Failed to send message with: %s/%s'%(ssl, length)) 196 196 return result 197 197 -
scripts/python/test_python.py
rba63b95 r89838be 44 44 start = time() 45 45 while self.stress_count < install_checks*10: 46 log('Waiting for 100: %d/%d'%(self.stress_count, self.noop_count))46 log('Waiting for %d: %d/%d'%(install_checks*10, self.stress_count, self.noop_count)) 47 47 old_stress_count = self.stress_count 48 48 old_noop_count = self.noop_count -
service/NSClient++.cpp
r35254d1 r89838be 793 793 } 794 794 795 bool NSClientT:: exitCore(bool boot) {796 LOG_DEBUG_CORE(_T("Attempting to stop "));795 bool NSClientT::stop_unload_plugins_pre() { 796 LOG_DEBUG_CORE(_T("Attempting to stop all plugins")); 797 797 try { 798 798 LOG_DEBUG_CORE(_T("Stopping: NON Message Handling Plugins")); … … 803 803 LOG_ERROR_CORE_STD(_T("Unknown exception raised when unloading non msg plugins")); 804 804 } 805 return true; 806 } 807 bool NSClientT::stop_exit_pre() { 805 808 #ifdef WIN32 806 809 LOG_DEBUG_CORE(_T("Stopping: COM helper")); … … 845 848 LOG_ERROR_CORE_STD(_T("UNknown exception raised: When closing shared session")); 846 849 } 850 return true; 851 } 852 bool NSClientT::stop_unload_plugins_post() { 847 853 try { 848 854 LOG_DEBUG_CORE(_T("Stopping: Message handling Plugins")); … … 853 859 LOG_ERROR_CORE_STD(_T("UNknown exception raised: When stopping message plguins")); 854 860 } 855 LOG_INFO_CORE(_T("Stopped succcessfully"));856 logger_master_.stop_slave();857 861 return true; 858 862 } 863 bool NSClientT::stop_exit_post() { 864 try { 865 logger_master_.stop_slave(); 866 } catch(...) { 867 LOG_ERROR_CORE_STD(_T("UNknown exception raised: When closing shared session")); 868 } 869 return true; 870 } 871 859 872 void NSClientT::service_on_session_changed(unsigned long dwSessionId, bool logon, unsigned long dwEventType) { 860 873 // if (shared_server_.get() == NULL) { … … 937 950 } 938 951 939 NSCAPI::errorReturn NSClientT::reload(const wchar_t *module) {952 NSCAPI::errorReturn NSClientT::reload(const std::wstring module) { 940 953 if (module == _T("service")) { 941 boot_start_plugins() 942 954 try { 955 stop_unload_plugins_pre(); 956 stop_unload_plugins_post(); 957 958 boot_load_all_plugins(); 959 boot_start_plugins(true); 960 return NSCAPI::isSuccess; 961 } catch(const std::exception &e) { 962 LOG_ERROR_CORE_STD(_T("Exception raised when reloading: ") + utf8::to_unicode(e.what())); 963 } catch(...) { 964 LOG_ERROR_CORE_STD(_T("Exception raised when reloading: UNKNOWN")); 965 } 943 966 } else { 944 std::wstring m = module;945 967 boost::unique_lock<boost::shared_mutex> writeLock(m_mutexRW, boost::get_system_time() + boost::posix_time::seconds(10)); 946 968 if (!writeLock.owns_lock()) { … … 950 972 951 973 BOOST_FOREACH(plugin_type &p, plugins_) { 952 if (p->get_alias() == m ) {953 LOG_DEBUG_CORE_STD(_T("Found module: ") + m + _T(", reloading..."));974 if (p->get_alias() == module) { 975 LOG_DEBUG_CORE_STD(_T("Found module: ") + module + _T(", reloading...")); 954 976 p->unload_plugin(); 955 977 p->load_plugin(NSCAPI::normalStart); … … 1522 1544 } 1523 1545 void NSClientT::handle_shutdown(std::wstring service_name) { 1524 exitCore(true); 1546 stop_unload_plugins_pre(); 1547 stop_exit_pre(); 1548 stop_unload_plugins_post(); 1549 stop_exit_post(); 1525 1550 } 1526 1551 -
service/NSClient++.h
r9c06054 r89838be 135 135 bool boot_load_plugin(std::wstring plugin); 136 136 bool boot_start_plugins(bool boot); 137 bool exitCore(bool boot); 137 138 bool stop_unload_plugins_pre(); 139 bool stop_exit_pre(); 140 bool stop_exit_post(); 141 bool stop_unload_plugins_post(); 142 //bool exitCore(); 138 143 void set_settings_context(std::wstring context) { context_ = context; } 139 144 #ifdef WIN32x … … 179 184 NSCAPI::errorReturn register_routing_listener(unsigned int plugin_id, const wchar_t* channel); 180 185 181 NSCAPI::errorReturn reload(const wchar_t *module);186 NSCAPI::errorReturn reload(const std::wstring module); 182 187 183 188 struct service_controller { -
service/cli_parser.hpp
r35254d1 r89838be 341 341 return 1; 342 342 343 std::wstring command ;344 enum modes { exec, query, submit, none };343 std::wstring command, combined_query; 344 enum modes { exec, query, submit, none, combined}; 345 345 modes mode = none; 346 346 … … 348 348 command = vm["exec"].as<std::wstring>(); 349 349 mode = exec; 350 } 351 if (vm.count("query")) { 350 if (vm.count("query")) { 351 combined_query = vm["query"].as<std::wstring>(); 352 mode = combined; 353 } 354 } else if (vm.count("query")) { 352 355 command = vm["query"].as<std::wstring>(); 353 356 mode = query; 354 } 355 if (vm.count("submit")) { 357 } else if (vm.count("submit")) { 356 358 command = vm["submit"].as<std::wstring>(); 357 359 mode = submit; … … 422 424 if (mode == query) { 423 425 ret = mainClient.simple_query(module, command, arguments, resp); 424 } else if (mode == exec ) {426 } else if (mode == exec || mode == combined) { 425 427 ret = mainClient.simple_exec(module, command, arguments, resp); 426 428 if (ret == NSCAPI::returnIgnored) { 427 429 ret = 1; 428 430 std::wcout << _T("Command not found (by module): ") << command << std::endl; 431 resp.push_back(_T("Command not found: ") + command); 429 432 mainClient.simple_exec(module, _T("help"), arguments, resp); 433 } else if (mode == combined) { 434 mainClient.reload(_T("service")); 435 ret = mainClient.simple_query(module, combined_query, arguments, resp); 430 436 } 431 437 } else if (mode == submit) { … … 434 440 std::wcerr << _T("Need to specify one of --exec, --query or --submit") << std::endl; 435 441 } 436 mainClient.exitCore(boot); 442 mainClient.stop_unload_plugins_pre(); 443 mainClient.stop_exit_pre(); 444 mainClient.stop_unload_plugins_post(); 445 mainClient.stop_exit_post(); 437 446 438 447 BOOST_FOREACH(std::wstring r, resp) { -
service/settings_client.hpp
r35254d1 r89838be 41 41 42 42 void exit() { 43 core_->exitCore(true); 43 core_->stop_unload_plugins_pre(); 44 core_->stop_exit_pre(); 45 core_->stop_unload_plugins_post(); 46 core_->stop_exit_post(); 44 47 } 45 48 -
service/simple_client.hpp
r9c06054 r89838be 92 92 } 93 93 } 94 core_->exitCore(true); 94 core_->stop_unload_plugins_pre(); 95 core_->stop_exit_pre(); 96 core_->stop_unload_plugins_post(); 97 core_->stop_exit_post(); 95 98 } 96 99 }; -
version.hpp
rba63b95 r89838be 1 1 #ifndef VERSION_HPP 2 2 #define VERSION_HPP 3 #define PRODUCTVER 0,4,0,12 14 #define STRPRODUCTVER "0,4,0,12 1"5 #define STRPRODUCTDATE "2012-01-1 2"3 #define PRODUCTVER 0,4,0,123 4 #define STRPRODUCTVER "0,4,0,123" 5 #define STRPRODUCTDATE "2012-01-16" 6 6 #endif // VERSION_HPP -
version.txt
rba63b95 r89838be 1 1 version=0.4.0 2 build=12 13 date=2012-01-1 22 build=123 3 date=2012-01-16
Note: See TracChangeset
for help on using the changeset viewer.








