)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":14760,"name":"John L. Villalovos","email":"openstack.org@sodarock.com","username":"jlvillal"},"change_message_id":"b60aea61a4eb7e161a35d98e60937f7c42aaba5d","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Update authorized_keys with new key only"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Add ironic_ssh pub key to authorized_keys file only if it is"},{"line_number":10,"context_line":"not present there."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: Idc1603d7f6d849d9c1a745b6d50d75ceb414d5c9"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"fa0719c6_78794f93","line":10,"updated":"2016-03-21 19:02:46.000000000","message":"Why is this wanted?\n\nCan we get a reason for why this is needed?","commit_id":"bdaaba47465ef6514bdaafb2e12d27f123082d71"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"f347de1950e48667304a8041fd1f6d737dd87e21","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Update authorized_keys with new key only"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Add ironic_ssh pub key to authorized_keys file only if it is"},{"line_number":10,"context_line":"not present there."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: Idc1603d7f6d849d9c1a745b6d50d75ceb414d5c9"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"fa0719c6_78a66fc2","line":10,"in_reply_to":"fa0719c6_78794f93","updated":"2016-03-21 19:15:55.000000000","message":"This is needed to avoid key duplication in authorized_keys file.","commit_id":"bdaaba47465ef6514bdaafb2e12d27f123082d71"},{"author":{"_account_id":14760,"name":"John L. Villalovos","email":"openstack.org@sodarock.com","username":"jlvillal"},"change_message_id":"c211886033eaec81f81de9c95dc9fc2cbd34ef4c","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Update authorized_keys with new key only"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Add ironic_ssh pub key to authorized_keys file only if it is"},{"line_number":10,"context_line":"not present there."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: Idc1603d7f6d849d9c1a745b6d50d75ceb414d5c9"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"fa0719c6_ee6ab219","line":10,"updated":"2016-03-21 21:34:47.000000000","message":"Why is this wanted?\n\nCan we get a reason for why this is needed in the commit message?","commit_id":"5a2241e7d1f7bb2ccc861c959af13254012d5e37"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"0b887dffc317972937a695afc7318bcbc0b9fc18","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Update authorized_keys with new key only"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Add ironic_ssh pub key to authorized_keys file only if it is"},{"line_number":10,"context_line":"not present there."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: Idc1603d7f6d849d9c1a745b6d50d75ceb414d5c9"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"fa0719c6_334b5f89","line":10,"in_reply_to":"fa0719c6_ee6ab219","updated":"2016-03-22 10:29:59.000000000","message":"Done","commit_id":"5a2241e7d1f7bb2ccc861c959af13254012d5e37"}],"devstack/lib/ironic":[{"author":{"_account_id":14760,"name":"John L. Villalovos","email":"openstack.org@sodarock.com","username":"jlvillal"},"change_message_id":"ba023c124f6ef3677605670d238c6a0592e829c7","unresolved":false,"context_lines":[{"line_number":829,"context_line":"        fi"},{"line_number":830,"context_line":"        echo -e \u0027n\\n\u0027 | ssh-keygen -q -t rsa -P \u0027\u0027 -f $IRONIC_KEY_FILE"},{"line_number":831,"context_line":"    fi"},{"line_number":832,"context_line":"    if [[ -f $IRONIC_AUTHORIZED_KEYS_FILE ]]; then"},{"line_number":833,"context_line":"        cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE"},{"line_number":834,"context_line":"    else"},{"line_number":835,"context_line":"        local key"}],"source_content_type":"application/x-shellscript","patch_set":3,"id":"fa0719c6_1842d33e","line":832,"updated":"2016-03-21 19:02:11.000000000","message":"Seems like this should be a NOT \u0027!\u0027","commit_id":"bdaaba47465ef6514bdaafb2e12d27f123082d71"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"f347de1950e48667304a8041fd1f6d737dd87e21","unresolved":false,"context_lines":[{"line_number":829,"context_line":"        fi"},{"line_number":830,"context_line":"        echo -e \u0027n\\n\u0027 | ssh-keygen -q -t rsa -P \u0027\u0027 -f $IRONIC_KEY_FILE"},{"line_number":831,"context_line":"    fi"},{"line_number":832,"context_line":"    if [[ -f $IRONIC_AUTHORIZED_KEYS_FILE ]]; then"},{"line_number":833,"context_line":"        cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE"},{"line_number":834,"context_line":"    else"},{"line_number":835,"context_line":"        local key"}],"source_content_type":"application/x-shellscript","patch_set":3,"id":"fa0719c6_389d1766","line":832,"in_reply_to":"fa0719c6_1842d33e","updated":"2016-03-21 19:15:55.000000000","message":"you are right, i missed !","commit_id":"bdaaba47465ef6514bdaafb2e12d27f123082d71"},{"author":{"_account_id":6610,"name":"Zhenguo Niu","email":"Niu.ZGlinux@gmail.com","username":"niu-zglinux"},"change_message_id":"09a4cb0ec7b7337e720615a41e623380e3e91d8d","unresolved":false,"context_lines":[{"line_number":834,"context_line":"    else"},{"line_number":835,"context_line":"        local key"},{"line_number":836,"context_line":"        key\u003d$(cat $IRONIC_KEY_FILE.pub)"},{"line_number":837,"context_line":"        grep -vq \"$key\" $IRONIC_AUTHORIZED_KEYS_FILE \u0026\u0026 (cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE)"},{"line_number":838,"context_line":"    fi"},{"line_number":839,"context_line":"}"},{"line_number":840,"context_line":""}],"source_content_type":"application/x-shellscript","patch_set":4,"id":"fa0719c6_e563e83f","line":837,"range":{"start_line":837,"start_character":8,"end_line":837,"end_character":15},"updated":"2016-03-22 03:10:10.000000000","message":"this will select the non-matching lines, so you will add ironic_ssh pub key to authorized_keys file only if a non-mathing key present there? I suspect you want to check the key not present there.","commit_id":"5a2241e7d1f7bb2ccc861c959af13254012d5e37"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"7d9f9459349f5fcab5607950a801c95a2b0ba2db","unresolved":false,"context_lines":[{"line_number":834,"context_line":"    else"},{"line_number":835,"context_line":"        local key"},{"line_number":836,"context_line":"        key\u003d$(cat $IRONIC_KEY_FILE.pub)"},{"line_number":837,"context_line":"        grep -vq \"$key\" $IRONIC_AUTHORIZED_KEYS_FILE \u0026\u0026 (cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE)"},{"line_number":838,"context_line":"    fi"},{"line_number":839,"context_line":"}"},{"line_number":840,"context_line":""}],"source_content_type":"application/x-shellscript","patch_set":4,"id":"fa0719c6_7342f711","line":837,"range":{"start_line":837,"start_character":8,"end_line":837,"end_character":15},"in_reply_to":"fa0719c6_7c9f7150","updated":"2016-03-22 10:17:33.000000000","message":"I\u0027m not a bash expert but testing locally here I see the same results as @Zhenguo. What about:\n\ngrep -q $key $IRONIC_AUTHORIZED_KEYS_FILE || cat $IRONIC_KEY_FILE.pub \u003e\u003e $IRONIC_AUTHORIZED_KEYS_FILE\n\n(not tested)","commit_id":"5a2241e7d1f7bb2ccc861c959af13254012d5e37"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"0b887dffc317972937a695afc7318bcbc0b9fc18","unresolved":false,"context_lines":[{"line_number":834,"context_line":"    else"},{"line_number":835,"context_line":"        local key"},{"line_number":836,"context_line":"        key\u003d$(cat $IRONIC_KEY_FILE.pub)"},{"line_number":837,"context_line":"        grep -vq \"$key\" $IRONIC_AUTHORIZED_KEYS_FILE \u0026\u0026 (cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE)"},{"line_number":838,"context_line":"    fi"},{"line_number":839,"context_line":"}"},{"line_number":840,"context_line":""}],"source_content_type":"application/x-shellscript","patch_set":4,"id":"fa0719c6_53025370","line":837,"range":{"start_line":837,"start_character":8,"end_line":837,"end_character":15},"in_reply_to":"fa0719c6_7c9f7150","updated":"2016-03-22 10:29:59.000000000","message":"right if we have at least one non matching line grep -vq will return True.","commit_id":"5a2241e7d1f7bb2ccc861c959af13254012d5e37"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"cfee7fc1833e979a02fa115e55034f43f416cad0","unresolved":false,"context_lines":[{"line_number":834,"context_line":"    else"},{"line_number":835,"context_line":"        local key"},{"line_number":836,"context_line":"        key\u003d$(cat $IRONIC_KEY_FILE.pub)"},{"line_number":837,"context_line":"        grep -vq \"$key\" $IRONIC_AUTHORIZED_KEYS_FILE \u0026\u0026 (cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE)"},{"line_number":838,"context_line":"    fi"},{"line_number":839,"context_line":"}"},{"line_number":840,"context_line":""}],"source_content_type":"application/x-shellscript","patch_set":4,"id":"fa0719c6_fc50a10c","line":837,"range":{"start_line":837,"start_character":8,"end_line":837,"end_character":15},"in_reply_to":"fa0719c6_e563e83f","updated":"2016-03-22 07:07:23.000000000","message":"ssh-key will be added only if it doesn\u0027t exist in authorized_keys\n\n$ cat /tmp/123\nfoo\n$ grep -vq \"foo\" /tmp/123 \u0026\u0026 echo \"True\"    \n$ grep -vq \"bar\" /tmp/123 \u0026\u0026 echo \"True\"\nTrue","commit_id":"5a2241e7d1f7bb2ccc861c959af13254012d5e37"},{"author":{"_account_id":6610,"name":"Zhenguo Niu","email":"Niu.ZGlinux@gmail.com","username":"niu-zglinux"},"change_message_id":"d59432b91a7b6a09c0d0cac8ccaa7a959a4ace44","unresolved":false,"context_lines":[{"line_number":834,"context_line":"    else"},{"line_number":835,"context_line":"        local key"},{"line_number":836,"context_line":"        key\u003d$(cat $IRONIC_KEY_FILE.pub)"},{"line_number":837,"context_line":"        grep -vq \"$key\" $IRONIC_AUTHORIZED_KEYS_FILE \u0026\u0026 (cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE)"},{"line_number":838,"context_line":"    fi"},{"line_number":839,"context_line":"}"},{"line_number":840,"context_line":""}],"source_content_type":"application/x-shellscript","patch_set":4,"id":"fa0719c6_7c9f7150","line":837,"range":{"start_line":837,"start_character":8,"end_line":837,"end_character":15},"in_reply_to":"fa0719c6_fc50a10c","updated":"2016-03-22 07:25:54.000000000","message":"as I commented, \u0027grep -v\u0027 will select the non-matching lines.\n\n$ cat /tmp/123\nfoo\nbar\n$ grep -vq \"foo\" /tmp/123 \u0026\u0026 echo \"True\"\nTrue","commit_id":"5a2241e7d1f7bb2ccc861c959af13254012d5e37"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"abf93f2fd065068edf800cc549c48103cbcee01e","unresolved":false,"context_lines":[{"line_number":834,"context_line":"    else"},{"line_number":835,"context_line":"        local key"},{"line_number":836,"context_line":"        key\u003d$(cat $IRONIC_KEY_FILE.pub)"},{"line_number":837,"context_line":"        grep -q \"$key\" $IRONIC_AUTHORIZED_KEYS_FILE || (cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE)"},{"line_number":838,"context_line":"    fi"},{"line_number":839,"context_line":"}"},{"line_number":840,"context_line":""}],"source_content_type":"application/x-shellscript","patch_set":6,"id":"fa0719c6_ceb51832","line":837,"range":{"start_line":837,"start_character":56,"end_line":837,"end_character":80},"updated":"2016-03-22 10:37:33.000000000","message":"echo \"$key\" | tee -a ... ?","commit_id":"d0f1834a324dfd7e2b80e6438420dcd2ef35ea59"},{"author":{"_account_id":5805,"name":"Chris Krelle","email":"nobodycam@gmail.com","username":"nobodycam"},"change_message_id":"9602cbd28315ad5ed5f943b05d6a14fb3bf5c5b0","unresolved":false,"context_lines":[{"line_number":824,"context_line":"        mkdir -p $HOME/.ssh"},{"line_number":825,"context_line":"        chmod 700 $HOME/.ssh"},{"line_number":826,"context_line":"    fi"},{"line_number":827,"context_line":"    if [[ ! -e $IRONIC_KEY_FILE ]]; then"},{"line_number":828,"context_line":"        if [[ ! -d $(dirname $IRONIC_KEY_FILE) ]]; then"},{"line_number":829,"context_line":"            mkdir -p $(dirname $IRONIC_KEY_FILE)"},{"line_number":830,"context_line":"        fi"}],"source_content_type":"application/x-shellscript","patch_set":7,"id":"fa0719c6_dc95c4e4","line":827,"range":{"start_line":827,"start_character":15,"end_line":827,"end_character":31},"updated":"2016-03-22 15:00:41.000000000","message":"just a note, maybe for a follow up. we test for the private key but use the public key below. I have seen cases where the public key was not placed along with the private, so it may be worth testing for the public key file.","commit_id":"b4135830d8942412c3687ef86f2983974c97e799"},{"author":{"_account_id":14760,"name":"John L. Villalovos","email":"openstack.org@sodarock.com","username":"jlvillal"},"change_message_id":"26ca299fb44015455229ade4ce523be6575e081f","unresolved":false,"context_lines":[{"line_number":830,"context_line":"        fi"},{"line_number":831,"context_line":"        echo -e \u0027n\\n\u0027 | ssh-keygen -q -t rsa -P \u0027\u0027 -f $IRONIC_KEY_FILE"},{"line_number":832,"context_line":"    fi"},{"line_number":833,"context_line":"    if [[ ! -f $IRONIC_AUTHORIZED_KEYS_FILE ]]; then"},{"line_number":834,"context_line":"        cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE"},{"line_number":835,"context_line":"    else"},{"line_number":836,"context_line":"        local key"}],"source_content_type":"application/x-shellscript","patch_set":7,"id":"da0c15f0_513c4f2f","line":833,"updated":"2016-03-24 21:39:20.000000000","message":"Maybe I\u0027m bike shedding, as I\u0027ve been known to-do.\n\nBut what if it was just:\n\n cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE\n # Remove any duplicate entries\n sort -o $IRONIC_AUTHORIZED_KEYS_FILE -u $IRONIC_AUTHORIZED_KEYS_FILE","commit_id":"b4135830d8942412c3687ef86f2983974c97e799"},{"author":{"_account_id":14760,"name":"John L. Villalovos","email":"openstack.org@sodarock.com","username":"jlvillal"},"change_message_id":"37da68cfb8a5c5b1c2d4ef760fe9ee5224cbde05","unresolved":false,"context_lines":[{"line_number":830,"context_line":"        fi"},{"line_number":831,"context_line":"        echo -e \u0027n\\n\u0027 | ssh-keygen -q -t rsa -P \u0027\u0027 -f $IRONIC_KEY_FILE"},{"line_number":832,"context_line":"    fi"},{"line_number":833,"context_line":"    if [[ ! -f $IRONIC_AUTHORIZED_KEYS_FILE ]]; then"},{"line_number":834,"context_line":"        cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE"},{"line_number":835,"context_line":"    else"},{"line_number":836,"context_line":"        local key"}],"source_content_type":"application/x-shellscript","patch_set":7,"id":"da0c15f0_2c7cde71","line":833,"in_reply_to":"da0c15f0_513c4f2f","updated":"2016-03-24 21:55:47.000000000","message":"From:  info sort\n\n‘-o OUTPUT-FILE’\n ‘--output\u003dOUTPUT-FILE’\n      Write output to OUTPUT-FILE instead of standard output.  Normally,\n      ‘sort’ reads all input before opening OUTPUT-FILE, so you can\n      safely sort a file in place by using commands like ‘sort -o F F’\n      and ‘cat F | sort -o F’.  However, ‘sort’ with ‘--merge’ (‘-m’) can\n      open the output file before reading all input, so a command like\n      ‘cat F | sort -m -o F - G’ is not safe as ‘sort’ might start\n      writing ‘F’ before ‘cat’ is done reading it.\n\n      On newer systems, ‘-o’ cannot appear after an input file if\n      ‘POSIXLY_CORRECT’ is set, e.g., ‘sort F -o F’.  Portable scripts\n     should specify ‘-o OUTPUT-FILE’ before any input files.","commit_id":"b4135830d8942412c3687ef86f2983974c97e799"},{"author":{"_account_id":7933,"name":"Philippe Godin","email":"godp1301@gmail.com","username":"godp1301"},"change_message_id":"ededad0913aa0b40bc646406fdf40f52ac55cd74","unresolved":false,"context_lines":[{"line_number":830,"context_line":"        fi"},{"line_number":831,"context_line":"        echo -e \u0027n\\n\u0027 | ssh-keygen -q -t rsa -P \u0027\u0027 -f $IRONIC_KEY_FILE"},{"line_number":832,"context_line":"    fi"},{"line_number":833,"context_line":"    if [[ ! -f $IRONIC_AUTHORIZED_KEYS_FILE ]]; then"},{"line_number":834,"context_line":"        cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE"},{"line_number":835,"context_line":"    else"},{"line_number":836,"context_line":"        local key"},{"line_number":837,"context_line":"        key\u003d$(cat $IRONIC_KEY_FILE.pub)"},{"line_number":838,"context_line":"        grep -q \"$key\" $IRONIC_AUTHORIZED_KEYS_FILE || (cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE)"},{"line_number":839,"context_line":"    fi"},{"line_number":840,"context_line":"}"},{"line_number":841,"context_line":""},{"line_number":842,"context_line":"function ironic_ssh_check {"}],"source_content_type":"application/x-shellscript","patch_set":7,"id":"fa0719c6_6f2dc745","line":839,"range":{"start_line":833,"start_character":1,"end_line":839,"end_character":6},"updated":"2016-03-22 19:47:53.000000000","message":"minor but there is a few usages of cat $IRONIC_KEY_FILE.pub in a few lines.","commit_id":"b4135830d8942412c3687ef86f2983974c97e799"}]}
