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