)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"e796e206fade962e6c123b11a2bced71ab564010","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":12,"id":"4896b0f4_f52a0781","updated":"2024-01-11 14:18:32.000000000","message":"recheck","commit_id":"e566fd422f0e05e026036240189b89dd5266968e"},{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"6f2c09d433c022646b4c7550e07b51572ae5812d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":12,"id":"c822df96_9c89cd8b","updated":"2024-01-10 15:16:50.000000000","message":"thanks!","commit_id":"e566fd422f0e05e026036240189b89dd5266968e"}],"src/main-system.cpp":[{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"97ee939a168d98d2ccd7ca55bc68d300cd08c893","unresolved":true,"context_lines":[{"line_number":68,"context_line":""},{"line_number":69,"context_line":"        DBUS_EVENTLOOP_START"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"        auto syslog \u003d velia::system::Syslog(srConn, *g_dbusConnection, \"/cfg/journal-remote\");"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"        // initialize ietf-system"},{"line_number":74,"context_line":"        auto sysrepoIETFSystem \u003d velia::system::IETFSystem(srSess, \"/etc/os-release\", *g_dbusConnection, \"org.freedesktop.resolve1\");"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"bd35a79f_f04a1900","line":71,"updated":"2024-01-02 16:40:03.000000000","message":"Changes of `running` should go into a tmpfs somewhere (/run ?), while changes of the startup DS should go here into /cfg; this will require changing of the unit file in br2-external so that two env files are read in sequence.\n\nOr maybe do it in a different way -- modify the Environment of the systemd unit directly via D-Bus, if that\u0027s possible, or through a dynamically created drop-in file in tmpfs. I guess that doing that via a pair of EnvironmentFile\u003d is going to be easier :).","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"36f070d55b7ef2180a0370b736daeb539d20eeb8","unresolved":false,"context_lines":[{"line_number":68,"context_line":""},{"line_number":69,"context_line":"        DBUS_EVENTLOOP_START"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"        auto syslog \u003d velia::system::Syslog(srConn, *g_dbusConnection, \"/cfg/journal-remote\");"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"        // initialize ietf-system"},{"line_number":74,"context_line":"        auto sysrepoIETFSystem \u003d velia::system::IETFSystem(srSess, \"/etc/os-release\", *g_dbusConnection, \"org.freedesktop.resolve1\");"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"c3b7d8ee_14e1943e","line":71,"in_reply_to":"bd35a79f_f04a1900","updated":"2024-01-03 12:26:20.000000000","message":"Done","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"}],"src/system/JournalUpload.cpp":[{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"f0c3c8053649c78d349a3b0321d59421c21c2797","unresolved":true,"context_lines":[{"line_number":52,"context_line":"    auto sub \u003d session.onModuleChange("},{"line_number":53,"context_line":"        \"czechlight-system\","},{"line_number":54,"context_line":"        [log, envFile, restartCb](auto session, auto, auto, auto, auto, auto) {"},{"line_number":55,"context_line":"            for (const auto\u0026 change : session.getChanges()) {"},{"line_number":56,"context_line":"                if (change.node.path() \u003d\u003d UPLOAD_URL_LEAF) {"},{"line_number":57,"context_line":"                    std::optional\u003cstd::string\u003e url;"},{"line_number":58,"context_line":"                    if (change.operation !\u003d sysrepo::ChangeOperation::Deleted) { // value modified"},{"line_number":59,"context_line":"                        url \u003d change.node.asTerm().valueStr();"}],"source_content_type":"text/x-c++src","patch_set":3,"id":"89821546_794bce66","line":56,"range":{"start_line":55,"start_character":0,"end_line":56,"end_character":60},"updated":"2024-01-03 13:06:25.000000000","message":"instead of iterating over everything and checking each XPath, just ask for that single leaf directly","commit_id":"5bdb9593f0b9c627d348c62551a86576566264ff"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"96e5afda4c677524218939566dc19e98abda192f","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    auto sub \u003d session.onModuleChange("},{"line_number":53,"context_line":"        \"czechlight-system\","},{"line_number":54,"context_line":"        [log, envFile, restartCb](auto session, auto, auto, auto, auto, auto) {"},{"line_number":55,"context_line":"            for (const auto\u0026 change : session.getChanges()) {"},{"line_number":56,"context_line":"                if (change.node.path() \u003d\u003d UPLOAD_URL_LEAF) {"},{"line_number":57,"context_line":"                    std::optional\u003cstd::string\u003e url;"},{"line_number":58,"context_line":"                    if (change.operation !\u003d sysrepo::ChangeOperation::Deleted) { // value modified"},{"line_number":59,"context_line":"                        url \u003d change.node.asTerm().valueStr();"}],"source_content_type":"text/x-c++src","patch_set":3,"id":"338bed81_e49499d5","line":56,"range":{"start_line":55,"start_character":0,"end_line":56,"end_character":60},"in_reply_to":"89821546_794bce66","updated":"2024-01-03 14:02:01.000000000","message":"Yeah, that is actually a good idea.","commit_id":"5bdb9593f0b9c627d348c62551a86576566264ff"},{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"ac707a8960a62ae2d0c8b029518dbffb4e92c5a5","unresolved":true,"context_lines":[{"line_number":24,"context_line":""},{"line_number":25,"context_line":"        url +\u003d data-\u003efindPath(UPLOAD_URL_CONTAINER + \"/protocol\"s)-\u003easTerm().valueStr();"},{"line_number":26,"context_line":"        url +\u003d \"://\";"},{"line_number":27,"context_line":"        url +\u003d data-\u003efindPath(UPLOAD_URL_CONTAINER + \"/host\"s)-\u003easTerm().valueStr();"},{"line_number":28,"context_line":"        url +\u003d \":\";"},{"line_number":29,"context_line":"        url +\u003d std::string(data-\u003efindPath(UPLOAD_URL_CONTAINER + \"/port\"s)-\u003easTerm().valueStr());"},{"line_number":30,"context_line":""}],"source_content_type":"text/x-c++src","patch_set":5,"id":"d5b0aa52_11be78d7","line":27,"updated":"2024-01-03 17:29:58.000000000","message":"How does this work with IPv6 address literals? They normally produce URLs such as http://[::1]:80/ .","commit_id":"34c0eb5611a77bc12f216621a236568864016bdd"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"0182d7ce99c2e4298c0d351b8cb3b9098ee480b4","unresolved":false,"context_lines":[{"line_number":24,"context_line":""},{"line_number":25,"context_line":"        url +\u003d data-\u003efindPath(UPLOAD_URL_CONTAINER + \"/protocol\"s)-\u003easTerm().valueStr();"},{"line_number":26,"context_line":"        url +\u003d \"://\";"},{"line_number":27,"context_line":"        url +\u003d data-\u003efindPath(UPLOAD_URL_CONTAINER + \"/host\"s)-\u003easTerm().valueStr();"},{"line_number":28,"context_line":"        url +\u003d \":\";"},{"line_number":29,"context_line":"        url +\u003d std::string(data-\u003efindPath(UPLOAD_URL_CONTAINER + \"/port\"s)-\u003easTerm().valueStr());"},{"line_number":30,"context_line":""}],"source_content_type":"text/x-c++src","patch_set":5,"id":"191691bb_813a7f2e","line":27,"in_reply_to":"d5b0aa52_11be78d7","updated":"2024-01-03 19:30:53.000000000","message":"I validated the address with a regexp in our C++ code. I don\u0027t know how to do better :(","commit_id":"34c0eb5611a77bc12f216621a236568864016bdd"},{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"ac707a8960a62ae2d0c8b029518dbffb4e92c5a5","unresolved":true,"context_lines":[{"line_number":76,"context_line":"        },"},{"line_number":77,"context_line":"        std::nullopt,"},{"line_number":78,"context_line":"        0,"},{"line_number":79,"context_line":"        sysrepo::SubscribeOptions::DoneOnly | sysrepo::SubscribeOptions::Enabled | sysrepo::SubscribeOptions::Update);"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    /*"},{"line_number":82,"context_line":"     * In case someone removes the presence container between sysrepo loads the data and this module startup we won\u0027t get a change (Deleted) from sysrepo and the file won\u0027t be written."}],"source_content_type":"text/x-c++src","patch_set":5,"id":"873e8f28_bfc31ec4","line":79,"range":{"start_line":79,"start_character":80,"end_line":79,"end_character":116},"updated":"2024-01-03 17:29:58.000000000","message":"This is wrong; the callback doesn\u0027t check whether it\u0027s \"done\" or \"update\".","commit_id":"34c0eb5611a77bc12f216621a236568864016bdd"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"c28090d4ec3adf51f28662712f388dbe4af67f71","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        },"},{"line_number":77,"context_line":"        std::nullopt,"},{"line_number":78,"context_line":"        0,"},{"line_number":79,"context_line":"        sysrepo::SubscribeOptions::DoneOnly | sysrepo::SubscribeOptions::Enabled | sysrepo::SubscribeOptions::Update);"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    /*"},{"line_number":82,"context_line":"     * In case someone removes the presence container between sysrepo loads the data and this module startup we won\u0027t get a change (Deleted) from sysrepo and the file won\u0027t be written."}],"source_content_type":"text/x-c++src","patch_set":5,"id":"058fb7dc_7cfb0677","line":79,"range":{"start_line":79,"start_character":80,"end_line":79,"end_character":116},"in_reply_to":"873e8f28_bfc31ec4","updated":"2024-01-03 19:30:04.000000000","message":"This should have not been commited. Thanks and done","commit_id":"34c0eb5611a77bc12f216621a236568864016bdd"},{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"17ab482e46ee549d21bcab8cb1921999b5888509","unresolved":true,"context_lines":[{"line_number":35,"context_line":"    if (auto data \u003d session.getData(UPLOAD_URL_CONTAINER)) {"},{"line_number":36,"context_line":"        std::string url;"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"        auto host \u003d std::string{data-\u003efindPath(UPLOAD_URL_CONTAINER + \"/host\"s)-\u003easTerm().valueStr()};"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"        url +\u003d data-\u003efindPath(UPLOAD_URL_CONTAINER + \"/protocol\"s)-\u003easTerm().valueStr();"},{"line_number":41,"context_line":"        url +\u003d \"://\";"}],"source_content_type":"text/x-c++src","patch_set":9,"id":"a3941002_174bb57e","line":38,"updated":"2024-01-04 14:12:56.000000000","message":"how much do you like https://gerrit.cesnet.cz/c/CzechLight/libyang-cpp/+/6765 ?","commit_id":"93dabfcbc18b30e0db7e645cd47e2f420889ac54"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"d95e5c542f85e3c3db7508f36889ae4743e5b25f","unresolved":false,"context_lines":[{"line_number":35,"context_line":"    if (auto data \u003d session.getData(UPLOAD_URL_CONTAINER)) {"},{"line_number":36,"context_line":"        std::string url;"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"        auto host \u003d std::string{data-\u003efindPath(UPLOAD_URL_CONTAINER + \"/host\"s)-\u003easTerm().valueStr()};"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"        url +\u003d data-\u003efindPath(UPLOAD_URL_CONTAINER + \"/protocol\"s)-\u003easTerm().valueStr();"},{"line_number":41,"context_line":"        url +\u003d \"://\";"}],"source_content_type":"text/x-c++src","patch_set":9,"id":"3f106d27_f8bfa6a7","line":38,"in_reply_to":"a3941002_174bb57e","updated":"2024-01-09 13:18:27.000000000","message":"Done","commit_id":"93dabfcbc18b30e0db7e645cd47e2f420889ac54"},{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"a9ec7760642e44581a60729cdd32070e274874a9","unresolved":true,"context_lines":[{"line_number":20,"context_line":""},{"line_number":21,"context_line":"std::optional\u003cstd::string\u003e extractURL(sysrepo::Session session)"},{"line_number":22,"context_line":"{"},{"line_number":23,"context_line":"    if (auto data \u003d session.getData(UPLOAD_URL_CONTAINER)) {"},{"line_number":24,"context_line":"        std::string url;"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"        auto hostNode \u003d data-\u003efindPath(UPLOAD_URL_CONTAINER + \"/host\"s);"}],"source_content_type":"text/x-c++src","patch_set":11,"id":"cbb9f3f8_2bbf5e61","line":23,"updated":"2024-01-10 15:05:00.000000000","message":"nit: perhaps an early return here?","commit_id":"54ce3f99dba247536d74d04707535bef19e23306"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"6b0a440ce4e169765fb439c6b34b1a09a7da905b","unresolved":false,"context_lines":[{"line_number":20,"context_line":""},{"line_number":21,"context_line":"std::optional\u003cstd::string\u003e extractURL(sysrepo::Session session)"},{"line_number":22,"context_line":"{"},{"line_number":23,"context_line":"    if (auto data \u003d session.getData(UPLOAD_URL_CONTAINER)) {"},{"line_number":24,"context_line":"        std::string url;"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"        auto hostNode \u003d data-\u003efindPath(UPLOAD_URL_CONTAINER + \"/host\"s);"}],"source_content_type":"text/x-c++src","patch_set":11,"id":"6164cacd_b06aa76f","line":23,"in_reply_to":"cbb9f3f8_2bbf5e61","updated":"2024-01-10 15:15:18.000000000","message":"Done","commit_id":"54ce3f99dba247536d74d04707535bef19e23306"},{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"a9ec7760642e44581a60729cdd32070e274874a9","unresolved":true,"context_lines":[{"line_number":66,"context_line":"            ofs \u003c\u003c *newContent;"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"            newContent-\u003epop_back(); // remove the \\n"},{"line_number":69,"context_line":"            log-\u003edebug(\"systemd-journal-upload.service environment file {} set to {}\", std::string(envFile), *newContent);"},{"line_number":70,"context_line":"        } else {"},{"line_number":71,"context_line":"            std::filesystem::remove(envFile);"},{"line_number":72,"context_line":"            log-\u003edebug(\"systemd-journal-upload.service environment file {} removed\", std::string(envFile));"}],"source_content_type":"text/x-c++src","patch_set":11,"id":"6e15f7ba_255ff929","line":69,"range":{"start_line":69,"start_character":17,"end_line":69,"end_character":22},"updated":"2024-01-10 15:05:00.000000000","message":"nit: I\u0027d prefer trace here because the operator probably should not ever want that, IMHO (also also below)","commit_id":"54ce3f99dba247536d74d04707535bef19e23306"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"6b0a440ce4e169765fb439c6b34b1a09a7da905b","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            ofs \u003c\u003c *newContent;"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"            newContent-\u003epop_back(); // remove the \\n"},{"line_number":69,"context_line":"            log-\u003edebug(\"systemd-journal-upload.service environment file {} set to {}\", std::string(envFile), *newContent);"},{"line_number":70,"context_line":"        } else {"},{"line_number":71,"context_line":"            std::filesystem::remove(envFile);"},{"line_number":72,"context_line":"            log-\u003edebug(\"systemd-journal-upload.service environment file {} removed\", std::string(envFile));"}],"source_content_type":"text/x-c++src","patch_set":11,"id":"1b36b2dc_d9fe7e95","line":69,"range":{"start_line":69,"start_character":17,"end_line":69,"end_character":22},"in_reply_to":"6e15f7ba_255ff929","updated":"2024-01-10 15:15:18.000000000","message":"Done","commit_id":"54ce3f99dba247536d74d04707535bef19e23306"}],"src/system/Syslog.cpp":[{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"97ee939a168d98d2ccd7ca55bc68d300cd08c893","unresolved":true,"context_lines":[{"line_number":25,"context_line":""},{"line_number":26,"context_line":"    try {"},{"line_number":27,"context_line":"        oldContent \u003d velia::utils::readFileToString(envFile);"},{"line_number":28,"context_line":"    } catch (const std::invalid_argument\u0026) {"},{"line_number":29,"context_line":"    }"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    if (url) {"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"0e3152a8_550fa75c","line":28,"updated":"2024-01-02 16:40:03.000000000","message":"this deserves a comment","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"36f070d55b7ef2180a0370b736daeb539d20eeb8","unresolved":false,"context_lines":[{"line_number":25,"context_line":""},{"line_number":26,"context_line":"    try {"},{"line_number":27,"context_line":"        oldContent \u003d velia::utils::readFileToString(envFile);"},{"line_number":28,"context_line":"    } catch (const std::invalid_argument\u0026) {"},{"line_number":29,"context_line":"    }"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    if (url) {"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"ecd0f841_6cd97d7e","line":28,"in_reply_to":"0e3152a8_550fa75c","updated":"2024-01-03 12:26:20.000000000","message":"Done","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"},{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"97ee939a168d98d2ccd7ca55bc68d300cd08c893","unresolved":true,"context_lines":[{"line_number":64,"context_line":"{"},{"line_number":65,"context_line":"    auto sess \u003d conn.sessionStart();"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    /* reset journal-upload settings:"},{"line_number":68,"context_line":"     * In case someone removes the presence container between sysrepo loads the data and this module startup we won\u0027t get a change (Deleted) from sysrepo and the file won\u0027t be written."},{"line_number":69,"context_line":"     * Therefore, first check the current state and configure journal-upload."},{"line_number":70,"context_line":"     * Then, start the module change CB. In case someone changes the data between first and second configure call, it is no problem. In case nothing gets changed, no restart will be done, because"},{"line_number":71,"context_line":"     * the configure restarts the unit only when the configuration changes."},{"line_number":72,"context_line":"     */"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    std::optional\u003cstd::string\u003e url;"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"88a430fc_a7d85ff5","line":71,"range":{"start_line":67,"start_character":0,"end_line":71,"end_character":75},"updated":"2024-01-02 16:40:03.000000000","message":"If the change occurs in a time window between when lines 75 and line 82 execute, that change is still getting lost.\n\nIf I understand the problem correctly, you want to have an information whether the logging is configured or not configured at some time point X. In sysrepo, the SR_EV_ENABLED is used for this purpose, and this code correctly sets that flag when making the subscription. The problem is that we do not have an explicit value \"no logging is configured\", and that there\u0027s an impedance mismatch of how this application\u0027s \"idea about the state\" differs from how sysrepo callbacks work. Indeed, in sysrepo there\u0027s no way to tell that a value is \"not present\" when there was no \"previous state\" to use, such as when the callback is invoked for the first time.\n\nThere are several ways to fix this:\n\n- Ask for sysrepo SR_EV_ENABLED CBs to be always invoked, even when there are no changes to report. That way, the user CB will be notified about that \"time point X\" when you already know about the desired config state (uploading or not uploading).\n- Lock the DS before asking for data and registering the CB.\n- Change the YANG layout so that there\u0027s something explicit that the CB will get. For example, make the URL into a union of an enum `disabled` and a URL,, defaulting to `disabled`. This will have an ugly side-effect of confusing tab completion in netconf-cli.","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"2c0f1b5f47079a31c78d14dcf0be8ec5e85a7f9b","unresolved":false,"context_lines":[{"line_number":64,"context_line":"{"},{"line_number":65,"context_line":"    auto sess \u003d conn.sessionStart();"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    /* reset journal-upload settings:"},{"line_number":68,"context_line":"     * In case someone removes the presence container between sysrepo loads the data and this module startup we won\u0027t get a change (Deleted) from sysrepo and the file won\u0027t be written."},{"line_number":69,"context_line":"     * Therefore, first check the current state and configure journal-upload."},{"line_number":70,"context_line":"     * Then, start the module change CB. In case someone changes the data between first and second configure call, it is no problem. In case nothing gets changed, no restart will be done, because"},{"line_number":71,"context_line":"     * the configure restarts the unit only when the configuration changes."},{"line_number":72,"context_line":"     */"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    std::optional\u003cstd::string\u003e url;"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"6c17c15d_f78edcc7","line":71,"range":{"start_line":67,"start_character":0,"end_line":71,"end_character":75},"in_reply_to":"88a430fc_a7d85ff5","updated":"2024-01-03 12:26:35.000000000","message":"We agreed on the call that it is enough just to swap the two calls. First register CB with ENABLED flag, then query once. If nothing changed, nothing happens because the file","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"}],"tests/dbus-helpers/dbus_systemd_server.cpp":[{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"97ee939a168d98d2ccd7ca55bc68d300cd08c893","unresolved":true,"context_lines":[{"line_number":17,"context_line":"    // create manager object"},{"line_number":18,"context_line":"    m_manager-\u003eregisterMethod(\"Subscribe\").onInterface(interfaceManager).implementedAs([] {}).withNoReply(); // no-op for us"},{"line_number":19,"context_line":"    m_manager-\u003eregisterMethod(\"ListUnits\").onInterface(interfaceManager).implementedAs([this]() { return ListUnits(); });"},{"line_number":20,"context_line":"    m_manager-\u003eregisterMethod(\"RestartUnit\").onInterface(interfaceManager).implementedAs([restartUnitCb \u003d restartUnitCb](const std::string\u0026 unitName, const std::string\u0026 mode) { restartUnitCb(unitName, mode); }).withNoReply(); // returns Job obj in reality"},{"line_number":21,"context_line":"    m_manager-\u003eregisterSignal(\"UnitNew\").onInterface(interfaceManager).withParameters\u003cstd::string, sdbus::ObjectPath\u003e();"},{"line_number":22,"context_line":"    m_manager-\u003efinishRegistration();"},{"line_number":23,"context_line":"}"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"c613a060_08764809","line":20,"range":{"start_line":20,"start_character":90,"end_line":20,"end_character":119},"updated":"2024-01-02 16:40:03.000000000","message":"add an explicit comment that this is about creating a long-lived copy of the function","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"},{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"97ee939a168d98d2ccd7ca55bc68d300cd08c893","unresolved":true,"context_lines":[{"line_number":17,"context_line":"    // create manager object"},{"line_number":18,"context_line":"    m_manager-\u003eregisterMethod(\"Subscribe\").onInterface(interfaceManager).implementedAs([] {}).withNoReply(); // no-op for us"},{"line_number":19,"context_line":"    m_manager-\u003eregisterMethod(\"ListUnits\").onInterface(interfaceManager).implementedAs([this]() { return ListUnits(); });"},{"line_number":20,"context_line":"    m_manager-\u003eregisterMethod(\"RestartUnit\").onInterface(interfaceManager).implementedAs([restartUnitCb \u003d restartUnitCb](const std::string\u0026 unitName, const std::string\u0026 mode) { restartUnitCb(unitName, mode); }).withNoReply(); // returns Job obj in reality"},{"line_number":21,"context_line":"    m_manager-\u003eregisterSignal(\"UnitNew\").onInterface(interfaceManager).withParameters\u003cstd::string, sdbus::ObjectPath\u003e();"},{"line_number":22,"context_line":"    m_manager-\u003efinishRegistration();"},{"line_number":23,"context_line":"}"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"944fd56d_49783702","line":20,"updated":"2024-01-02 16:40:03.000000000","message":"nit: wrap this, please","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"36f070d55b7ef2180a0370b736daeb539d20eeb8","unresolved":false,"context_lines":[{"line_number":17,"context_line":"    // create manager object"},{"line_number":18,"context_line":"    m_manager-\u003eregisterMethod(\"Subscribe\").onInterface(interfaceManager).implementedAs([] {}).withNoReply(); // no-op for us"},{"line_number":19,"context_line":"    m_manager-\u003eregisterMethod(\"ListUnits\").onInterface(interfaceManager).implementedAs([this]() { return ListUnits(); });"},{"line_number":20,"context_line":"    m_manager-\u003eregisterMethod(\"RestartUnit\").onInterface(interfaceManager).implementedAs([restartUnitCb \u003d restartUnitCb](const std::string\u0026 unitName, const std::string\u0026 mode) { restartUnitCb(unitName, mode); }).withNoReply(); // returns Job obj in reality"},{"line_number":21,"context_line":"    m_manager-\u003eregisterSignal(\"UnitNew\").onInterface(interfaceManager).withParameters\u003cstd::string, sdbus::ObjectPath\u003e();"},{"line_number":22,"context_line":"    m_manager-\u003efinishRegistration();"},{"line_number":23,"context_line":"}"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"be462188_9ae4159d","line":20,"in_reply_to":"944fd56d_49783702","updated":"2024-01-03 12:26:20.000000000","message":"Done","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"36f070d55b7ef2180a0370b736daeb539d20eeb8","unresolved":false,"context_lines":[{"line_number":17,"context_line":"    // create manager object"},{"line_number":18,"context_line":"    m_manager-\u003eregisterMethod(\"Subscribe\").onInterface(interfaceManager).implementedAs([] {}).withNoReply(); // no-op for us"},{"line_number":19,"context_line":"    m_manager-\u003eregisterMethod(\"ListUnits\").onInterface(interfaceManager).implementedAs([this]() { return ListUnits(); });"},{"line_number":20,"context_line":"    m_manager-\u003eregisterMethod(\"RestartUnit\").onInterface(interfaceManager).implementedAs([restartUnitCb \u003d restartUnitCb](const std::string\u0026 unitName, const std::string\u0026 mode) { restartUnitCb(unitName, mode); }).withNoReply(); // returns Job obj in reality"},{"line_number":21,"context_line":"    m_manager-\u003eregisterSignal(\"UnitNew\").onInterface(interfaceManager).withParameters\u003cstd::string, sdbus::ObjectPath\u003e();"},{"line_number":22,"context_line":"    m_manager-\u003efinishRegistration();"},{"line_number":23,"context_line":"}"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"2b8a3be2_87f293c5","line":20,"range":{"start_line":20,"start_character":90,"end_line":20,"end_character":119},"in_reply_to":"c613a060_08764809","updated":"2024-01-03 12:26:20.000000000","message":"Done","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"}],"tests/sysrepo_system-journalupload.cpp":[{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"ac707a8960a62ae2d0c8b029518dbffb4e92c5a5","unresolved":true,"context_lines":[{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    // not a valid host"},{"line_number":118,"context_line":"    REQUIRE_THROWS_AS(client.setItem(\"/czechlight-system:journal-upload/host\", std::string(500, \u0027a\u0027)), sysrepo::ErrorWithCode);"},{"line_number":119,"context_line":"}"}],"source_content_type":"text/x-c++src","patch_set":5,"id":"70342b9d_e544bd96","line":119,"updated":"2024-01-03 17:29:58.000000000","message":"can you please test for some extra newlines as well, given that that\u0027s what prompted that whole regex/validation thingy?","commit_id":"34c0eb5611a77bc12f216621a236568864016bdd"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"c28090d4ec3adf51f28662712f388dbe4af67f71","unresolved":false,"context_lines":[{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    // not a valid host"},{"line_number":118,"context_line":"    REQUIRE_THROWS_AS(client.setItem(\"/czechlight-system:journal-upload/host\", std::string(500, \u0027a\u0027)), sysrepo::ErrorWithCode);"},{"line_number":119,"context_line":"}"}],"source_content_type":"text/x-c++src","patch_set":5,"id":"f4d15a97_45dba9e7","line":119,"in_reply_to":"70342b9d_e544bd96","updated":"2024-01-03 19:30:04.000000000","message":"Done","commit_id":"34c0eb5611a77bc12f216621a236568864016bdd"}],"tests/sysrepo_system-syslog.cpp":[{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"97ee939a168d98d2ccd7ca55bc68d300cd08c893","unresolved":true,"context_lines":[{"line_number":20,"context_line":"TEST_CASE(\"Sysrepo czechlight-system:syslog\")"},{"line_number":21,"context_line":"{"},{"line_number":22,"context_line":"    trompeloeil::sequence seq1;"},{"line_number":23,"context_line":"    SdMock systemdExpectations;"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    TEST_SYSREPO_INIT_LOGS;"},{"line_number":26,"context_line":"    TEST_SYSREPO_INIT;"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"1d43fb3d_278d7768","line":23,"range":{"start_line":23,"start_character":11,"end_line":23,"end_character":30},"updated":"2024-01-02 16:40:03.000000000","message":"I\u0027d prefer `sdMock`. It\u0027s not storing the expectations at all, it\u0027s a mock object.","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"36f070d55b7ef2180a0370b736daeb539d20eeb8","unresolved":false,"context_lines":[{"line_number":20,"context_line":"TEST_CASE(\"Sysrepo czechlight-system:syslog\")"},{"line_number":21,"context_line":"{"},{"line_number":22,"context_line":"    trompeloeil::sequence seq1;"},{"line_number":23,"context_line":"    SdMock systemdExpectations;"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    TEST_SYSREPO_INIT_LOGS;"},{"line_number":26,"context_line":"    TEST_SYSREPO_INIT;"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"07050953_f420a4c0","line":23,"range":{"start_line":23,"start_character":11,"end_line":23,"end_character":30},"in_reply_to":"1d43fb3d_278d7768","updated":"2024-01-03 12:26:20.000000000","message":"Done","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"},{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"97ee939a168d98d2ccd7ca55bc68d300cd08c893","unresolved":true,"context_lines":[{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    SECTION(\"Presence container\")"},{"line_number":43,"context_line":"    {"},{"line_number":44,"context_line":"        client.setItem(\"/czechlight-system:syslog/journal-upload/url\", \"https://upload.service\");"},{"line_number":45,"context_line":"        client.applyChanges();"},{"line_number":46,"context_line":"        REQUIRE(!std::filesystem::exists(fakeEnvFile));"},{"line_number":47,"context_line":""}],"source_content_type":"text/x-c++src","patch_set":1,"id":"f704c6fb_dc5922bb","line":44,"range":{"start_line":44,"start_character":72,"end_line":44,"end_character":94},"updated":"2024-01-02 16:40:03.000000000","message":"nit: if you want to be fancy, https://datatracker.ietf.org/doc/html/rfc6761#section-6.5 and https://datatracker.ietf.org/doc/html/rfc5735#section-3 for some \"well-known\" example strings :)","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"36f070d55b7ef2180a0370b736daeb539d20eeb8","unresolved":false,"context_lines":[{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    SECTION(\"Presence container\")"},{"line_number":43,"context_line":"    {"},{"line_number":44,"context_line":"        client.setItem(\"/czechlight-system:syslog/journal-upload/url\", \"https://upload.service\");"},{"line_number":45,"context_line":"        client.applyChanges();"},{"line_number":46,"context_line":"        REQUIRE(!std::filesystem::exists(fakeEnvFile));"},{"line_number":47,"context_line":""}],"source_content_type":"text/x-c++src","patch_set":1,"id":"6bed6606_e4542ccd","line":44,"range":{"start_line":44,"start_character":72,"end_line":44,"end_character":94},"in_reply_to":"f704c6fb_dc5922bb","updated":"2024-01-03 12:26:20.000000000","message":"Done","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"},{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"97ee939a168d98d2ccd7ca55bc68d300cd08c893","unresolved":true,"context_lines":[{"line_number":42,"context_line":"    SECTION(\"Presence container\")"},{"line_number":43,"context_line":"    {"},{"line_number":44,"context_line":"        client.setItem(\"/czechlight-system:syslog/journal-upload/url\", \"https://upload.service\");"},{"line_number":45,"context_line":"        client.applyChanges();"},{"line_number":46,"context_line":"        REQUIRE(!std::filesystem::exists(fakeEnvFile));"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        EXPECT_RESTART_UNIT;"},{"line_number":49,"context_line":"        syslog \u003d std::make_unique\u003cvelia::system::Syslog\u003e(srConn, *dbusConnClient, dbusConnServer-\u003egetUniqueName(), fakeEnvFile);"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"152f7d62_6942e0c8","line":46,"range":{"start_line":45,"start_character":0,"end_line":46,"end_character":55},"updated":"2024-01-02 16:40:03.000000000","message":"there\u0027s a race in between these two, isn\u0027t it?","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"36f070d55b7ef2180a0370b736daeb539d20eeb8","unresolved":false,"context_lines":[{"line_number":42,"context_line":"    SECTION(\"Presence container\")"},{"line_number":43,"context_line":"    {"},{"line_number":44,"context_line":"        client.setItem(\"/czechlight-system:syslog/journal-upload/url\", \"https://upload.service\");"},{"line_number":45,"context_line":"        client.applyChanges();"},{"line_number":46,"context_line":"        REQUIRE(!std::filesystem::exists(fakeEnvFile));"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        EXPECT_RESTART_UNIT;"},{"line_number":49,"context_line":"        syslog \u003d std::make_unique\u003cvelia::system::Syslog\u003e(srConn, *dbusConnClient, dbusConnServer-\u003egetUniqueName(), fakeEnvFile);"}],"source_content_type":"text/x-c++src","patch_set":1,"id":"5a9c6a51_790e081c","line":46,"range":{"start_line":45,"start_character":0,"end_line":46,"end_character":55},"in_reply_to":"152f7d62_6942e0c8","updated":"2024-01-03 12:26:20.000000000","message":"I see, the module change callback is running in different thread.","commit_id":"9822c1aa1454cfa228a2fef166f5a3f9d5c6e722"}],"yang/czechlight-system@2022-07-08.yang":[{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"f0c3c8053649c78d349a3b0321d59421c21c2797","unresolved":true,"context_lines":[{"line_number":271,"context_line":""},{"line_number":272,"context_line":"      leaf url {"},{"line_number":273,"context_line":"        mandatory true;"},{"line_number":274,"context_line":"        type string;"},{"line_number":275,"context_line":"        description"},{"line_number":276,"context_line":"         \"Sets the --url option of systemd-journal-upload"},{"line_number":277,"context_line":"          (see https://www.freedesktop.org/software/systemd/man/252/systemd-journal-upload.service.html)\";"}],"source_content_type":"application/octet-stream","patch_set":3,"id":"327e1515_b2a78a36","line":274,"range":{"start_line":274,"start_character":13,"end_line":274,"end_character":19},"updated":"2024-01-03 13:06:25.000000000","message":"This needs some constraining, otherwise people could inject newlines and other funny characters into this \"URL\", and clobber the env of the unit, which might be exploitable. There\u0027s `ietf-yang-types:uri`, but I see that a string with newlines passes validation even with that type :(. I asked on libyang slack about this.","commit_id":"5bdb9593f0b9c627d348c62551a86576566264ff"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"96e5afda4c677524218939566dc19e98abda192f","unresolved":true,"context_lines":[{"line_number":271,"context_line":""},{"line_number":272,"context_line":"      leaf url {"},{"line_number":273,"context_line":"        mandatory true;"},{"line_number":274,"context_line":"        type string;"},{"line_number":275,"context_line":"        description"},{"line_number":276,"context_line":"         \"Sets the --url option of systemd-journal-upload"},{"line_number":277,"context_line":"          (see https://www.freedesktop.org/software/systemd/man/252/systemd-journal-upload.service.html)\";"}],"source_content_type":"application/octet-stream","patch_set":3,"id":"68b50ca5_6cd433fb","line":274,"range":{"start_line":274,"start_character":13,"end_line":274,"end_character":19},"in_reply_to":"327e1515_b2a78a36","updated":"2024-01-03 14:02:01.000000000","message":"Well I can go hard and split the destination URL into multiple leafs according to https://www.freedesktop.org/software/systemd/man/latest/systemd-journal-upload.html (i.e., protocol, address, port) and validate each separately. \n\nBut I don!t want to do that so let\u0027s use ietf-yang-types:uri and wait for libyang to implement it? Maybe we can provide a simple regex validation meanwhile.","commit_id":"5bdb9593f0b9c627d348c62551a86576566264ff"},{"author":{"_account_id":1000070,"name":"Tomáš Pecka","email":"Tomas.Pecka@cesnet.cz","username":"pecka@cesnet.cz"},"change_message_id":"20c559e44161e72d599f06c5d9cc31f6d5e31e6c","unresolved":false,"context_lines":[{"line_number":271,"context_line":""},{"line_number":272,"context_line":"      leaf url {"},{"line_number":273,"context_line":"        mandatory true;"},{"line_number":274,"context_line":"        type string;"},{"line_number":275,"context_line":"        description"},{"line_number":276,"context_line":"         \"Sets the --url option of systemd-journal-upload"},{"line_number":277,"context_line":"          (see https://www.freedesktop.org/software/systemd/man/252/systemd-journal-upload.service.html)\";"}],"source_content_type":"application/octet-stream","patch_set":3,"id":"4375ca40_d62f07af","line":274,"range":{"start_line":274,"start_character":13,"end_line":274,"end_character":19},"in_reply_to":"3b067f69_d91d9ace","updated":"2024-01-03 17:20:20.000000000","message":"I was too lazy to concatenate the regexes for IPs and hosts so I went with the three-leafs with defaults option.","commit_id":"5bdb9593f0b9c627d348c62551a86576566264ff"},{"author":{"_account_id":1000000,"name":"Jan Kundrát","email":"jan.kundrat@cesnet.cz","username":"kundrat@cesnet.cz"},"change_message_id":"fbc3761af84865ffb42cae16cf16358dc7011b8c","unresolved":true,"context_lines":[{"line_number":271,"context_line":""},{"line_number":272,"context_line":"      leaf url {"},{"line_number":273,"context_line":"        mandatory true;"},{"line_number":274,"context_line":"        type string;"},{"line_number":275,"context_line":"        description"},{"line_number":276,"context_line":"         \"Sets the --url option of systemd-journal-upload"},{"line_number":277,"context_line":"          (see https://www.freedesktop.org/software/systemd/man/252/systemd-journal-upload.service.html)\";"}],"source_content_type":"application/octet-stream","patch_set":3,"id":"3b067f69_d91d9ace","line":274,"range":{"start_line":274,"start_character":13,"end_line":274,"end_character":19},"in_reply_to":"68b50ca5_6cd433fb","updated":"2024-01-03 14:11:22.000000000","message":"Yes please, let\u0027s go with a regex validation (and a FIXME note) for now. I somehow thought that `inet:uri` is a union, but now I see that that thing only applies to hostnames, not URIs. Good.","commit_id":"5bdb9593f0b9c627d348c62551a86576566264ff"}]}
