diff --git a/plugins/prometheus_plugin/include/eosio/prometheus_plugin/simple_rest_server.hpp b/plugins/prometheus_plugin/include/eosio/prometheus_plugin/simple_rest_server.hpp index f82492df28..c9bef7f05f 100644 --- a/plugins/prometheus_plugin/include/eosio/prometheus_plugin/simple_rest_server.hpp +++ b/plugins/prometheus_plugin/include/eosio/prometheus_plugin/simple_rest_server.hpp @@ -67,7 +67,7 @@ namespace eosio { namespace rest { try { auto res = self()->on_request(std::move(req)); if (!res) - not_found(target); + return not_found(target); return *res; } catch (std::exception& ex) { return server_error(ex.what()); } } diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index ec9e9a058c..945452d200 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -1050,29 +1050,29 @@ struct set_account_permission_subcommand { struct set_action_permission_subcommand { string accountStr; string codeStr; - string typeStr; + string actionStr; string requirementStr; set_action_permission_subcommand(CLI::App* actionRoot) { auto permissions = actionRoot->add_subcommand("permission", localized("Set parameters dealing with account permissions")); permissions->add_option("account", accountStr, localized("The account to set/delete a permission authority for"))->required(); permissions->add_option("code", codeStr, localized("The account that owns the code for the action"))->required(); - permissions->add_option("type", typeStr, localized("The type of the action"))->required(); - permissions->add_option("requirement", requirementStr, localized("[delete] NULL, [set/update] The permission name require for executing the given action"))->required(); + permissions->add_option("action", actionStr, localized("The name of the action [use ALL for all actions]"))->required(); + permissions->add_option("requirement", requirementStr, localized("The permission name required for executing the given action [use NULL to delete]"))->required(); add_standard_transaction_options_plus_signing(permissions, "account@active"); permissions->callback([this] { name account = name(accountStr); name code = name(codeStr); - name type = name(typeStr); - bool is_delete = boost::iequals(requirementStr, "null"); + name action = (actionStr == "ALL") ? name{} : name(actionStr); + bool is_delete = (requirementStr == "NULL"); if (is_delete) { - send_actions({create_unlinkauth(account, code, type)}, signing_keys_opt.get_keys()); + send_actions({create_unlinkauth(account, code, action)}, signing_keys_opt.get_keys()); } else { name requirement = name(requirementStr); - send_actions({create_linkauth(account, code, type, requirement)}, signing_keys_opt.get_keys()); + send_actions({create_linkauth(account, code, action, requirement)}, signing_keys_opt.get_keys()); } }); } diff --git a/tests/TestHarness/queries.py b/tests/TestHarness/queries.py index e73c3ad06b..5521be8870 100644 --- a/tests/TestHarness/queries.py +++ b/tests/TestHarness/queries.py @@ -643,6 +643,8 @@ def processUrllibRequest(self, resource, command, payload={}, silentErrors=False rtn = ex.read() else: unhandledEnumType(returnType) + elif returnType==ReturnType.raw: + return ex.code else: return None diff --git a/tests/nodeos_run_test.py b/tests/nodeos_run_test.py index 1c78cdbe1f..1b87863966 100755 --- a/tests/nodeos_run_test.py +++ b/tests/nodeos_run_test.py @@ -696,7 +696,7 @@ trans=node.setPermission(testeraAccount, currencyAccount, pType, requirement, waitForTransBlock=True, exitOnError=True) Print("remove permission") - requirement="null" + requirement="NULL" trans=node.setPermission(testeraAccount, currencyAccount, pType, requirement, waitForTransBlock=True, exitOnError=True) Print("Locking all wallets.") diff --git a/tests/plugin_http_api_test.py b/tests/plugin_http_api_test.py index b020039817..c0fc0cb2ba 100755 --- a/tests/plugin_http_api_test.py +++ b/tests/plugin_http_api_test.py @@ -1352,6 +1352,8 @@ def test_prometheusApi(self) : self.assertTrue(int(metrics["blocks_produced"]) > 1) self.assertTrue(int(metrics["last_irreversible"]) > 1) + ret = self.nodeos.processUrllibRequest(resource, "m", returnType = ReturnType.raw, method="GET", silentErrors= True, endpoint=endpointPrometheus) + self.assertTrue(ret == 404) def test_multipleRequests(self): """Test keep-alive ability of HTTP plugin. Handle multiple requests in a single session"""