mirror of https://github.com/Icinga/icinga2.git
parent
5db8dd7361
commit
82a31c9b20
|
@ -19,12 +19,12 @@ set(cli_SOURCES
|
|||
nodeaddcommand.cpp nodeblackandwhitelistcommand.cpp nodelistcommand.cpp noderemovecommand.cpp
|
||||
nodesetcommand.cpp nodesetupcommand.cpp nodeupdateconfigcommand.cpp nodewizardcommand.cpp nodeutility.cpp
|
||||
clicommand.cpp
|
||||
consolecommand.cpp
|
||||
daemoncommand.cpp
|
||||
featureenablecommand.cpp featuredisablecommand.cpp featurelistcommand.cpp featureutility.cpp
|
||||
objectlistcommand.cpp
|
||||
pkinewcacommand.cpp pkinewcertcommand.cpp pkisigncsrcommand.cpp pkirequestcommand.cpp pkisavecertcommand.cpp pkiticketcommand.cpp
|
||||
pkiutility.cpp
|
||||
replcommand.cpp
|
||||
repositoryclearchangescommand.cpp repositorycommitcommand.cpp repositoryobjectcommand.cpp repositoryutility.cpp
|
||||
variablegetcommand.cpp variablelistcommand.cpp variableutility.cpp
|
||||
)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "cli/replcommand.hpp"
|
||||
#include "cli/consolecommand.hpp"
|
||||
#include "config/configcompiler.hpp"
|
||||
#include "base/json.hpp"
|
||||
#include "base/console.hpp"
|
||||
|
@ -37,29 +37,24 @@ extern "C" {
|
|||
using namespace icinga;
|
||||
namespace po = boost::program_options;
|
||||
|
||||
REGISTER_CLICOMMAND("repl", ReplCommand);
|
||||
REGISTER_CLICOMMAND("console", ConsoleCommand);
|
||||
|
||||
String ReplCommand::GetDescription(void) const
|
||||
String ConsoleCommand::GetDescription(void) const
|
||||
{
|
||||
return "Interprets Icinga script expressions.";
|
||||
}
|
||||
|
||||
String ReplCommand::GetShortDescription(void) const
|
||||
String ConsoleCommand::GetShortDescription(void) const
|
||||
{
|
||||
return "Icinga REPL console";
|
||||
return "Icinga console";
|
||||
}
|
||||
|
||||
bool ReplCommand::IsHidden(void) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ImpersonationLevel ReplCommand::GetImpersonationLevel(void) const
|
||||
ImpersonationLevel ConsoleCommand::GetImpersonationLevel(void) const
|
||||
{
|
||||
return ImpersonateNone;
|
||||
}
|
||||
|
||||
void ReplCommand::InitParameters(boost::program_options::options_description& visibleDesc,
|
||||
void ConsoleCommand::InitParameters(boost::program_options::options_description& visibleDesc,
|
||||
boost::program_options::options_description& hiddenDesc) const
|
||||
{
|
||||
visibleDesc.add_options()
|
||||
|
@ -68,11 +63,11 @@ void ReplCommand::InitParameters(boost::program_options::options_description& vi
|
|||
}
|
||||
|
||||
/**
|
||||
* The entry point for the "repl" CLI command.
|
||||
* The entry point for the "console" CLI command.
|
||||
*
|
||||
* @returns An exit status.
|
||||
*/
|
||||
int ReplCommand::Run(const po::variables_map& vm, const std::vector<std::string>& ap) const
|
||||
int ConsoleCommand::Run(const po::variables_map& vm, const std::vector<std::string>& ap) const
|
||||
{
|
||||
ScriptFrame frame;
|
||||
std::map<String, String> lines;
|
||||
|
@ -167,7 +162,7 @@ int ReplCommand::Run(const po::variables_map& vm, const std::vector<std::string>
|
|||
socket = usocket;
|
||||
} else {
|
||||
#endif /* _WIN32 */
|
||||
Log(LogCritical, "ReplCommand", "Sorry, TCP sockets aren't supported yet.");
|
||||
Log(LogCritical, "ConsoleCommand", "Sorry, TCP sockets aren't supported yet.");
|
||||
return 1;
|
||||
#ifndef _WIN32
|
||||
}
|
||||
|
@ -187,7 +182,7 @@ int ReplCommand::Run(const po::variables_map& vm, const std::vector<std::string>
|
|||
}
|
||||
|
||||
if (result.GetLength() < 16) {
|
||||
Log(LogCritical, "ReplCommand", "Received invalid response from Livestatus.");
|
||||
Log(LogCritical, "ConsoleCommand", "Received invalid response from Livestatus.");
|
||||
continue;
|
||||
}
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef REPLCOMMAND_H
|
||||
#define REPLCOMMAND_H
|
||||
#ifndef CONSOLECOMMAND_H
|
||||
#define CONSOLECOMMAND_H
|
||||
|
||||
#include "cli/clicommand.hpp"
|
||||
|
||||
|
@ -26,18 +26,17 @@ namespace icinga
|
|||
{
|
||||
|
||||
/**
|
||||
* The "repl" CLI command.
|
||||
* The "console" CLI command.
|
||||
*
|
||||
* @ingroup cli
|
||||
*/
|
||||
class ReplCommand : public CLICommand
|
||||
class ConsoleCommand : public CLICommand
|
||||
{
|
||||
public:
|
||||
DECLARE_PTR_TYPEDEFS(ReplCommand);
|
||||
DECLARE_PTR_TYPEDEFS(ConsoleCommand);
|
||||
|
||||
virtual String GetDescription(void) const;
|
||||
virtual String GetShortDescription(void) const;
|
||||
virtual bool IsHidden(void) const;
|
||||
virtual ImpersonationLevel GetImpersonationLevel(void) const;
|
||||
virtual void InitParameters(boost::program_options::options_description& visibleDesc,
|
||||
boost::program_options::options_description& hiddenDesc) const;
|
||||
|
@ -46,4 +45,4 @@ public:
|
|||
|
||||
}
|
||||
|
||||
#endif /* REPLCOMMAND_H */
|
||||
#endif /* CONSOLECOMMAND_H */
|
Loading…
Reference in New Issue