)]}'
{"ocf/NovaEvacuate":[{"author":{"_account_id":2394,"name":"Adam Spiers","email":"aspiers@suse.com","username":"adam.spiers"},"change_message_id":"cbbec1cf571105219075be8b5e3388e93422d010","unresolved":false,"context_lines":[{"line_number":256,"context_line":""},{"line_number":257,"context_line":"    handle_evacuations $("},{"line_number":258,"context_line":"        attrd_updater -n evacuate -A \\"},{"line_number":259,"context_line":"            2\u003e\u00261 | grep -v \"attribute does not exist\" 1\u003e\u00262 |"},{"line_number":260,"context_line":"            sed \u0027s/ value\u003d\"\"/ value\u003d\"no\"/\u0027 |"},{"line_number":261,"context_line":"            tr \u0027\u003d\"\u0027 \u0027  \u0027 |"},{"line_number":262,"context_line":"            awk \u0027{print $4\" \"$6}\u0027"}],"source_content_type":"application/x-shellscript","patch_set":1,"id":"5aef4532_50d7ac4a","line":259,"updated":"2016-03-09 14:59:12.000000000","message":"Are you sure this works?  I would expect it to merge STDERR into STDOUT, then do the grep -v, then redirect both back to STDERR, meaning that the rest of the pipeline from sed onwards doesn\u0027t receive anything on STDOUT.  And some quick tests seem to confirm this prediction.","commit_id":"f04e494d3762bf4dc486375cb858eb6631364baf"},{"author":{"_account_id":17243,"name":"Norbert Illes","email":"norbert.e.illes@ericsson.com","username":"nilles"},"change_message_id":"155d619ab5a75a9724179ca79b10307e1c9d173d","unresolved":false,"context_lines":[{"line_number":256,"context_line":""},{"line_number":257,"context_line":"    handle_evacuations $("},{"line_number":258,"context_line":"        attrd_updater -n evacuate -A \\"},{"line_number":259,"context_line":"            2\u003e\u00261 | grep -v \"attribute does not exist\" 1\u003e\u00262 |"},{"line_number":260,"context_line":"            sed \u0027s/ value\u003d\"\"/ value\u003d\"no\"/\u0027 |"},{"line_number":261,"context_line":"            tr \u0027\u003d\"\u0027 \u0027  \u0027 |"},{"line_number":262,"context_line":"            awk \u0027{print $4\" \"$6}\u0027"}],"source_content_type":"application/x-shellscript","patch_set":1,"id":"5aef4532_fd4a0c25","line":259,"in_reply_to":"5aef4532_50d7ac4a","updated":"2016-03-09 15:42:31.000000000","message":"You\u0027re right, I forgot to test it with an existing evacuate attribute.\nLesson learned again!","commit_id":"f04e494d3762bf4dc486375cb858eb6631364baf"},{"author":{"_account_id":2394,"name":"Adam Spiers","email":"aspiers@suse.com","username":"adam.spiers"},"change_message_id":"52396a1f67d918b251fa5cccded89cd365c14334","unresolved":false,"context_lines":[{"line_number":256,"context_line":""},{"line_number":257,"context_line":"    handle_evacuations $("},{"line_number":258,"context_line":"        attrd_updater -n evacuate -A \\"},{"line_number":259,"context_line":"            2\u003e\u00261 | grep -v \"attribute does not exist\" |"},{"line_number":260,"context_line":"            sed \u0027s/ value\u003d\"\"/ value\u003d\"no\"/\u0027 |"},{"line_number":261,"context_line":"            tr \u0027\u003d\"\u0027 \u0027  \u0027 |"},{"line_number":262,"context_line":"            awk \u0027{print $4\" \"$6}\u0027"}],"source_content_type":"application/x-shellscript","patch_set":2,"id":"5aef4532_fe30f957","line":259,"updated":"2016-03-10 17:14:09.000000000","message":"Now the problem is that any other error on stderr of attrd_updater (except for \"attribute does not exist\") will be incorrectly passed through the sed/tr/awk.","commit_id":"621f814e75a3dddf96bf711794753df3815d6015"},{"author":{"_account_id":2394,"name":"Adam Spiers","email":"aspiers@suse.com","username":"adam.spiers"},"change_message_id":"ae24caac7f4a66162a1b373f5a19818877accf56","unresolved":false,"context_lines":[{"line_number":256,"context_line":""},{"line_number":257,"context_line":"    handle_evacuations $("},{"line_number":258,"context_line":"        attrd_updater -n evacuate -A \\"},{"line_number":259,"context_line":"            2\u003e\u00261 | grep -v \"attribute does not exist\" |"},{"line_number":260,"context_line":"            sed \u0027s/ value\u003d\"\"/ value\u003d\"no\"/\u0027 |"},{"line_number":261,"context_line":"            tr \u0027\u003d\"\u0027 \u0027  \u0027 |"},{"line_number":262,"context_line":"            awk \u0027{print $4\" \"$6}\u0027"}],"source_content_type":"application/x-shellscript","patch_set":2,"id":"1af94dfe_22f491f0","line":259,"in_reply_to":"3afc51ec_6d634cb2","updated":"2016-03-16 17:52:06.000000000","message":"Yes exactly, you\u0027ve got it now :-)  I guess the filter_stderr function does make it a bit clearer what\u0027s going on.  I think those redirections deserve some extra comments though, to explain how it works.  Probably also worth linking to BashFAQ/047 in the commit message, if not in the comments.","commit_id":"621f814e75a3dddf96bf711794753df3815d6015"},{"author":{"_account_id":17243,"name":"Norbert Illes","email":"norbert.e.illes@ericsson.com","username":"nilles"},"change_message_id":"a8e293980171d6068f4780ff034e1d950d971153","unresolved":false,"context_lines":[{"line_number":256,"context_line":""},{"line_number":257,"context_line":"    handle_evacuations $("},{"line_number":258,"context_line":"        attrd_updater -n evacuate -A \\"},{"line_number":259,"context_line":"            2\u003e\u00261 | grep -v \"attribute does not exist\" |"},{"line_number":260,"context_line":"            sed \u0027s/ value\u003d\"\"/ value\u003d\"no\"/\u0027 |"},{"line_number":261,"context_line":"            tr \u0027\u003d\"\u0027 \u0027  \u0027 |"},{"line_number":262,"context_line":"            awk \u0027{print $4\" \"$6}\u0027"}],"source_content_type":"application/x-shellscript","patch_set":2,"id":"3afc51ec_6d634cb2","line":259,"in_reply_to":"5aef4532_fe30f957","updated":"2016-03-16 15:19:32.000000000","message":"Ok, I\u0027m getting to understand the problem. The stdout of attrd_updater needs to be piped to further processing, while stderr only needs to be filtered...\n\nTo filter stderr, it should be passed to grep somehow, then the stdout of grep should be redirected back to stderr again.\nI could do this with:\n\n attrd_updater -n evacuate -A | 2\u003e\u00261 | grep -v \"attribute does not exist\"  1\u003e\u00262\n\nThe problem with that is both stdout and stderr passed to grep, and there is no way to distinguish which one was on attrd_updater\u0027s stderr or stdout.\nBut if I redirect the stdout of attrd_updater to a new file descriptor, stdout will not be piped to grep, and I can use this new file descriptor as an input for sed.\nI mean something like this:\n\n ...\nhandle_evacuations $(\n    exec 3\u003e\u00261\n    (attrd_updater -n evacuate -A \\\n        2\u003e\u00261 1\u003e\u00263 | grep -v \"attribute does not exist\") 3\u003e\u00261 1\u003e\u00262  |\n        sed \u0027s/ value\u003d\"\"/ value\u003d\"no\"/\u0027 |\n ...\n\nI believe this would do the job, but it\u0027s also makes the code quite messy and hard to understand, so maybe it would worth moving the the whole filtering logic to a separate function, for example:\n\nfilter_stderr() {\n    command\u003d$1\n    shift\n    filter\u003d$@\n    ($command 2\u003e\u00261 1\u003e\u00263  | grep -v \"$filter\") 3\u003e\u00261 1\u003e\u00262\n}\n\nWith this function the make the handle_evacuations section would look like this:\n\nhandle_evacuations $(\n    filter_stderr \u0027attrd_updater -n evacuate -A\u0027 \u0027attribute does not exist\u0027  |\n    sed \u0027s/ value\u003d\"\"/ value\u003d\"no\"/\u0027 |\n...\n\nIs this sounds like a way forward?","commit_id":"621f814e75a3dddf96bf711794753df3815d6015"}]}
