)]}'
{"paunch/utils/systemctl.py":[{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"5c7def0fb525f0bea9d8f664ab42084216d89db6","unresolved":false,"context_lines":[{"line_number":48,"context_line":"def reset_failed(service, log\u003dNone):"},{"line_number":49,"context_line":"    systemctl([\u0027reset-failed\u0027, service], log)"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"@tenacity.retry(  # Retry up to 5 times with jittered exponential backoff"},{"line_number":52,"context_line":"    reraise\u003dTrue,"},{"line_number":53,"context_line":"    retry\u003dtenacity.retry_if_exception_type("},{"line_number":54,"context_line":"        SystemctlException"}],"source_content_type":"text/x-python","patch_set":2,"id":"7faddb67_90050e17","line":51,"updated":"2019-08-12 16:29:34.000000000","message":"I think it\u0027s not the right place to implement the retries mechanisms.\n\nThe main topic of this module is to wrap the systemctl utility.\n\nSystemd can retry things but to do this we need to put some config who look like this:\n```\n[Unit]\nStartLimitInterval\u003d200\nStartLimitBurst\u003d5\n[Service]\nRestart\u003dalways\nRestartSec\u003d30\n```\n\nIMHO these changes and especially the retries mechanisms should be handled here [1] and there [2] by using the `Retrying` class of `tenacity` with something like:\n\n```\nretryer \u003d Retrying(\n    reraise\u003dTrue,\n    retry\u003dtenacity.retry_if_exception_type(\n        SystemctlException\n    ),\n    wait\u003dtenacity.wait_random_exponential(multiplier\u003d1, max\u003d10),\n    stop\u003dtenacity.stop_after_attempt(5))\n\nretryer(systemctl.enable, healthcheck_timer, now\u003dTrue)\n```\n\nThis approach allow us to define when a retry is needed and don\u0027t force everything to retry.\n\nAlso it\u0027s more semantical to use the systemd module to handle this instead using the systemctl module.\n\n[1] https://github.com/openstack/paunch/blob/master/paunch/utils/systemd.py#L111\n[2] https://github.com/openstack/paunch/blob/master/paunch/utils/systemd.py#L244","commit_id":"8060f2bef0609a104e3ecd55b8278fb93dda6802"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"eb619122256cf5fbc233771a730cd1c329597920","unresolved":false,"context_lines":[{"line_number":48,"context_line":"def reset_failed(service, log\u003dNone):"},{"line_number":49,"context_line":"    systemctl([\u0027reset-failed\u0027, service], log)"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"@tenacity.retry(  # Retry up to 5 times with jittered exponential backoff"},{"line_number":52,"context_line":"    reraise\u003dTrue,"},{"line_number":53,"context_line":"    retry\u003dtenacity.retry_if_exception_type("},{"line_number":54,"context_line":"        SystemctlException"}],"source_content_type":"text/x-python","patch_set":2,"id":"7faddb67_ec77bb3a","line":51,"in_reply_to":"7faddb67_0c081726","updated":"2019-08-13 12:52:05.000000000","message":"Thanks for your feedback, that make sense so ok to leave these changes there.","commit_id":"8060f2bef0609a104e3ecd55b8278fb93dda6802"},{"author":{"_account_id":6926,"name":"Bogdan Dobrelya","email":"bdobreli@redhat.com","username":"bogdando"},"change_message_id":"2bf4d5e4b71c7f5d684b66c70c8b5f94b672e968","unresolved":false,"context_lines":[{"line_number":48,"context_line":"def reset_failed(service, log\u003dNone):"},{"line_number":49,"context_line":"    systemctl([\u0027reset-failed\u0027, service], log)"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"@tenacity.retry(  # Retry up to 5 times with jittered exponential backoff"},{"line_number":52,"context_line":"    reraise\u003dTrue,"},{"line_number":53,"context_line":"    retry\u003dtenacity.retry_if_exception_type("},{"line_number":54,"context_line":"        SystemctlException"}],"source_content_type":"text/x-python","patch_set":2,"id":"7faddb67_0c081726","line":51,"in_reply_to":"7faddb67_90050e17","updated":"2019-08-13 12:26:10.000000000","message":"Thank you for feedback, Herve. I think LimitInterval and Burst settings are something different to the topic, although nice to have as well. This fix allows the locked from starting services to be unlocked back, if that happened so that paunch locked them down mistakenly. Each action that might cause the rate limiting activated and the service blocked, IMO must be wrapped with such a wrapper, which resets fail conters and retries. I see no value in allowing any code invoking that util method w/o such a wrapper, and potentially causing more locking for the services. I think this code should belong here. Alternatively, we could implement a full blown rate limiting for systemctl wrapper to never allow it trigger a blocked state for a service under its control. But I hope the crash-loop performs here good enough and as well.","commit_id":"8060f2bef0609a104e3ecd55b8278fb93dda6802"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"5c7def0fb525f0bea9d8f664ab42084216d89db6","unresolved":false,"context_lines":[{"line_number":63,"context_line":"    cmd.append(service)"},{"line_number":64,"context_line":"    try:"},{"line_number":65,"context_line":"        systemctl(cmd, log)"},{"line_number":66,"context_line":"    except SystemctlException as err:"},{"line_number":67,"context_line":"        # Reset failure counters for the service unit and retry"},{"line_number":68,"context_line":"        reset_failed(service, log)"},{"line_number":69,"context_line":"        raise SystemctlException(str(err))"}],"source_content_type":"text/x-python","patch_set":2,"id":"7faddb67_ab2e9b89","line":66,"updated":"2019-08-12 16:29:34.000000000","message":"This part can stay there","commit_id":"8060f2bef0609a104e3ecd55b8278fb93dda6802"}],"paunch/utils/systemd.py":[{"author":{"_account_id":6926,"name":"Bogdan Dobrelya","email":"bdobreli@redhat.com","username":"bogdando"},"change_message_id":"c28a7e51acddcca20b79062fb004f38bf1a4aa13","unresolved":false,"context_lines":[{"line_number":98,"context_line":"Wants\u003d%(wants)s"},{"line_number":99,"context_line":"[Service]"},{"line_number":100,"context_line":"Restart\u003d%(restart)s"},{"line_number":101,"context_line":"StartLimitIntervalSec\u003d0"},{"line_number":102,"context_line":"ExecStart\u003d%(start_cmd)s"},{"line_number":103,"context_line":"ExecStop\u003d/usr/bin/podman stop -t %(stop_grace_period)s %(name)s"},{"line_number":104,"context_line":"KillMode\u003dnone"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_dce40711","line":101,"updated":"2019-08-12 13:34:49.000000000","message":"or we could raise RestartSec to make paunch never (ever) hitting rate limiting?..","commit_id":"f60da748adaf5a086349b1a793798e097838dd80"},{"author":{"_account_id":6926,"name":"Bogdan Dobrelya","email":"bdobreli@redhat.com","username":"bogdando"},"change_message_id":"924a037d5d8e767172b12c8e01a40d001198fc5c","unresolved":false,"context_lines":[{"line_number":98,"context_line":"Wants\u003d%(wants)s"},{"line_number":99,"context_line":"[Service]"},{"line_number":100,"context_line":"Restart\u003d%(restart)s"},{"line_number":101,"context_line":"StartLimitIntervalSec\u003d0"},{"line_number":102,"context_line":"ExecStart\u003d%(start_cmd)s"},{"line_number":103,"context_line":"ExecStop\u003d/usr/bin/podman stop -t %(stop_grace_period)s %(name)s"},{"line_number":104,"context_line":"KillMode\u003dnone"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_25e5fadc","line":101,"in_reply_to":"7faddb67_dce40711","updated":"2019-08-12 15:24:54.000000000","message":"I can see an error Unknown lvalue \u0027StartLimitIntervalSec\u0027 in section \u0027Service\u0027\n\nso may be that should\u0027ve been \u0027StartLimitInterval\u0027","commit_id":"f60da748adaf5a086349b1a793798e097838dd80"}]}
