mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-11 04:58:16 +03:00
parent
dd7f564553
commit
90bf20b4f6
@ -88,6 +88,8 @@ private:
|
||||
* String representation of the API call
|
||||
*/
|
||||
std::string call;
|
||||
|
||||
const static std::string unsupported_calls[];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -21,6 +21,11 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
const string HookAPI::unsupported_calls[] = {"one.hook.info", "one.hookpool.info"};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
std::string * HookAPI::format_message(std::string method, ParamList& paramList,
|
||||
const RequestAttributes& att)
|
||||
{
|
||||
@ -63,7 +68,7 @@ int HookAPI::parse_template(Template * tmpl, string& error_str)
|
||||
|
||||
if (!call_exist(call))
|
||||
{
|
||||
error_str = "API call does not exist: " + call;
|
||||
error_str = "API call does not exist or is not supported: " + call;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -81,7 +86,7 @@ int HookAPI::from_template(const Template * tmpl, string& error_str)
|
||||
|
||||
if (!call_exist(call))
|
||||
{
|
||||
error_str = "API call does not exist: " + call;
|
||||
error_str = "API call does not exist or is not supported: " + call;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -119,5 +124,18 @@ bool HookAPI::call_exist(const string& api_call)
|
||||
{
|
||||
RequestManager * rm = Nebula::instance().get_rm();
|
||||
|
||||
return rm->exist_method(api_call);
|
||||
if (!rm->exist_method(api_call))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto& call : unsupported_calls)
|
||||
{
|
||||
if (api_call == call)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user