openbmc / bmcweb

A do everything Redfish, KVM, GUI, and DBus webserver for OpenBMC
Apache License 2.0
154 stars 131 forks source link

Method patch not allowed #229

Closed Abdelfel closed 2 years ago

Abdelfel commented 2 years ago

Hello, If this is the wrong place to post this please let me know. I am using the version of bmcweb with the classes. I am trying to patch an attribute on Memory schema Memory.hpp:

`class Memory : public Node
{
  public:
    /*
     * Default Constructor
     */
    Memory(App& app) :
        Node(app, "/redfish/v1/Systems/system/Memory/<str>/", std::string())
    {
        entityPrivileges = {
            {boost::beast::http::verb::get, {{"Login"}}},
            {boost::beast::http::verb::head, {{"Login"}}},
            {boost::beast::http::verb::patch, {{"ConfigureComponents"}}},
            {boost::beast::http::verb::put, {{"ConfigureComponents"}}},
            {boost::beast::http::verb::delete_, {{"ConfigureComponents"}}},
            {boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
    }

  private:
    /**
     * Functions triggers appropriate requests on DBus
     */
    void doGet(crow::Response& res, const crow::Request&,
               const std::vector<std::string>& params) override
    {..}
void doPatch(crow::Response& res, const crow::Request& req,  //this is the function I added
                 const std::vector<std::string>& params) override
    {...}
`

when I try to pass the patch command, it says "Method not allowed" image

are we supposed to allow a certain method that didn't exist originally on a schema ? thank you

edtanous commented 2 years ago

You've posted content that is clearly from an older version of bmcweb, as shown by the fact that you're using the node class. Also, the bug template that you've ignored politely requests that you ask these kinds of questions on the openbmc discord or mailing list. Please direct your questions there, although I suspect the first answer will be to re-test on master, given you're on a fairly old version of bmcweb.