Changeset - 6245840e7c6b
[Not reviewed]
0 1 0
Jan Kaluza - 13 years ago 2012-10-04 10:18:35
hanzz.k@gmail.com
Show more info about boost filesystem error
1 file changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
spectrum_manager/src/methods.cpp
Show inline comments
 
@@ -186,25 +186,25 @@ int start_instances(ManagerConfig *config, const std::string &_jid) {
 
							rv = rc;
 
						}
 
					}
 
					else {
 
						response = "Starting " + itr->path().string() + ": Already started (PID=" + boost::lexical_cast<std::string>(pid) + ")\n";
 
						std::cout << "Starting " << itr->path() << ": Already started (PID=" << pid << ")\n";
 
					}
 
				}
 
			}
 
		}
 
	}
 
	catch (const filesystem_error& ex) {
 
		std::cerr << "boost filesystem error\n";
 
		std::cerr << "Filesystem error: " << ex.what() << "\n";
 
		return 6;
 
	}
 
	return rv;
 
}
 

	
 
void stop_instances(ManagerConfig *config, const std::string &_jid) {
 
	response = "";
 
	path p(CONFIG_STRING(config, "service.config_directory"));
 

	
 
	try {
 
		if (!exists(p)) {
 
			std::cerr << "Config directory " << CONFIG_STRING(config, "service.config_directory") << " does not exist\n";
 
@@ -262,25 +262,25 @@ void stop_instances(ManagerConfig *config, const std::string &_jid) {
 
							std::cout << " OK\n";
 
						}
 
					}
 
					else {
 
						response = "Stopping " + itr->path().string() + ": Not running\n";
 
						std::cout << "Stopping " << itr->path() << ": Not running\n";
 
					}
 
				}
 
			}
 
		}
 
	}
 
	catch (const filesystem_error& ex) {
 
		std::cerr << "boost filesystem error\n";
 
		std::cerr << "Filesystem error: " << ex.what() << "\n";
 
		exit(5);
 
	}
 
}
 

	
 
int show_status(ManagerConfig *config) {
 
	int ret = 0;
 
	path p(CONFIG_STRING(config, "service.config_directory"));
 

	
 
	try {
 
		if (!exists(p)) {
 
			std::cerr << "Config directory " << CONFIG_STRING(config, "service.config_directory") << " does not exist\n";
 
			exit(6);
 
@@ -315,25 +315,25 @@ int show_status(ManagerConfig *config) {
 
					if (pid) {
 
						std::cout << itr->path() << ": " << vhost << " Running\n";
 
					}
 
					else {
 
						ret = 3;
 
						std::cout << itr->path() << ": " << vhost << " Stopped\n";
 
					}
 
				}
 
			}
 
		}
 
	}
 
	catch (const filesystem_error& ex) {
 
		std::cerr << "boost filesystem error\n";
 
		std::cerr << "Filesystem error: " << ex.what() << "\n";
 
		exit(5);
 
	}
 
	return ret;
 
}
 

	
 
static void handleDataRead(boost::shared_ptr<Swift::Connection> m_conn, boost::shared_ptr<Swift::SafeByteArray> data) {
 
	_data += std::string(data->begin(), data->end());
 

	
 
	// Parse data while there are some
 
	while (_data.size() != 0) {
 
		// expected_size of wrapper message
 
		unsigned int expected_size;
 
@@ -451,25 +451,25 @@ void ask_local_server(ManagerConfig *config, Swift::BoostNetworkFactories &netwo
 
// 				opt.allowPLAINWithoutTLS = true;
 
// 				client->connect(opt);
 
			}
 
		}
 

	
 
		if (!found) {
 
			response = "Config file for Spectrum instance with this JID was not found\n";
 
			std::cerr << "Config file for Spectrum instance with this JID was not found\n";
 
// 			exit(20);
 
		}
 
	}
 
	catch (const filesystem_error& ex) {
 
		std::cerr << "boost filesystem error\n";
 
		std::cerr << "Filesystem error: " << ex.what() << "\n";
 
		exit(5);
 
	}
 
}
 

	
 
std::vector<std::string> show_list(ManagerConfig *config, bool show) {
 
	path p(CONFIG_STRING(config, "service.config_directory"));
 
	std::vector<std::string> list;
 

	
 
	try {
 
		if (!exists(p)) {
 
			std::cerr << "Config directory " << CONFIG_STRING(config, "service.config_directory") << " does not exist\n";
 
			exit(6);
 
@@ -489,21 +489,21 @@ std::vector<std::string> show_list(ManagerConfig *config, bool show) {
 
					std::cerr << "Can't load config file " << itr->path().string() << ". Skipping...\n";
 
					continue;
 
				}
 

	
 
				if (show) {
 
					std::cout << CONFIG_STRING(&cfg, "service.jid") << "\n";
 
				}
 
				list.push_back(CONFIG_STRING(&cfg, "service.jid"));
 
			}
 
		}
 
	}
 
	catch (const filesystem_error& ex) {
 
		std::cerr << "boost filesystem error\n";
 
		std::cerr << "Filesystem error: " << ex.what() << "\n";
 
	}
 
	return list;
 
}
 

	
 

	
 

	
 

	
 

	
0 comments (0 inline, 0 general)