{"action":"created","comment":{"url":"https://api.github.com/repos/Metaswitch/ellis/pulls/comments/45718423","id":45718423,"diff_hunk":"@@ -36,15 +36,12 @@\n \n . /etc/clearwater/config\n \n-if [ -n \"$hs_provisioning_hostname\" ] && [ -n \"$home_domain\" ] && [ -n \"$xdms_hostname\" ] && [ -n \"$local_ip\" ]\n-then\n-  function escape { echo $1 | sed -e 's/\\//\\\\\\//g' ; }\n-  sed -e 's/^LOCAL_IP = .*$/LOCAL_IP = \"'$(escape $local_ip)'\"/g' \\\n-      -e 's/^\\(SIP_DIGEST_REALM\\) = .*$/\\1 = \"'$(escape $home_domain)'\"/g' \\\n-      -e 's/^\\(HOMESTEAD_URL\\) = .*$/\\1 = \"'$(escape $hs_provisioning_hostname)'\"/g' \\\n-      -e 's/^\\(XDM_URL\\) = .*$/\\1 = \"'$(escape $xdms_hostname)'\"/g' \\\n-      -e 's/^\\(LOGS_DIR\\) = .*$/\\1 = \"\\/var\\/log\\/clearwater-prov-tools\"/g' \\\n-      </usr/share/clearwater/clearwater-prov-tools/local_settings.py >/tmp/local_settings.py.$$\n-  \n-  mv /tmp/local_settings.py.$$ /usr/share/clearwater/clearwater-prov-tools/env/lib/python2.7/site-packages/clearwater_prov_tools-0.1-py2.7.egg/metaswitch/ellis/local_settings.py\n-fi\n+function escape { echo $1 | sed -e 's/\\//\\\\\\//g' ; }\n+sed -e 's/^LOCAL_IP = \\(.*\\)$/LOCAL_IP = \"'$(escape \"${local_ip:-\\2}\")'\"/g' \\\n+  -e 's/^\\(SIP_DIGEST_REALM\\) = \\(.*\\)$/\\1 = \"'$(escape \"${home_domain:-\\2}\")'\"/g' \\","path":"clearwater-prov-tools.root/usr/share/clearwater/infrastructure/scripts/clearwater-prov-tools","position":18,"original_position":18,"commit_id":"7b5db7981f9973a6176f85313757aba2c6021fc2","original_commit_id":"7b5db7981f9973a6176f85313757aba2c6021fc2","user":{"login":"Tom-Rees","id":12893820,"avatar_url":"https://avatars.githubusercontent.com/u/12893820?v=3","gravatar_id":"","url":"https://api.github.com/users/Tom-Rees","html_url":"https://github.com/Tom-Rees","followers_url":"https://api.github.com/users/Tom-Rees/followers","following_url":"https://api.github.com/users/Tom-Rees/following{/other_user}","gists_url":"https://api.github.com/users/Tom-Rees/gists{/gist_id}","starred_url":"https://api.github.com/users/Tom-Rees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tom-Rees/subscriptions","organizations_url":"https://api.github.com/users/Tom-Rees/orgs","repos_url":"https://api.github.com/users/Tom-Rees/repos","events_url":"https://api.github.com/users/Tom-Rees/events{/privacy}","received_events_url":"https://api.github.com/users/Tom-Rees/received_events","type":"User","site_admin":false},"body":"The \\2 is not affected by the escape function due to not containing a '/'. It's protected from bash un-escaping by the double quotes.\r\n\r\nThis does double-quote the old settings, which is a bit rubbish. I think I'll re-write this section to make it clearer how/why it works.","created_at":"2015-11-24T10:31:17Z","updated_at":"2015-11-24T10:31:17Z","html_url":"https://github.com/Metaswitch/ellis/pull/148#discussion_r45718423","pull_request_url":"https://api.github.com/repos/Metaswitch/ellis/pulls/148","_links":{"self":{"href":"https://api.github.com/repos/Metaswitch/ellis/pulls/comments/45718423"},"html":{"href":"https://github.com/Metaswitch/ellis/pull/148#discussion_r45718423"},"pull_request":{"href":"https://api.github.com/repos/Metaswitch/ellis/pulls/148"}}},"pull_request":{"url":"https://api.github.com/repos/Metaswitch/ellis/pulls/148","id":51552799,"html_url":"https://github.com/Metaswitch/ellis/pull/148","diff_url":"https://github.com/Metaswitch/ellis/pull/148.diff","patch_url":"https://github.com/Metaswitch/ellis/pull/148.patch","issue_url":"https://api.github.com/repos/Metaswitch/ellis/issues/148","number":148,"state":"open","locked":false,"title":"[Reviewer Andy] Improve prov-tools local_settings creation. Fixes #144","user":{"login":"Tom-Rees","id":12893820,"avatar_url":"https://avatars.githubusercontent.com/u/12893820?v=3","gravatar_id":"","url":"https://api.github.com/users/Tom-Rees","html_url":"https://github.com/Tom-Rees","followers_url":"https://api.github.com/users/Tom-Rees/followers","following_url":"https://api.github.com/users/Tom-Rees/following{/other_user}","gists_url":"https://api.github.com/users/Tom-Rees/gists{/gist_id}","starred_url":"https://api.github.com/users/Tom-Rees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tom-Rees/subscriptions","organizations_url":"https://api.github.com/users/Tom-Rees/orgs","repos_url":"https://api.github.com/users/Tom-Rees/repos","events_url":"https://api.github.com/users/Tom-Rees/events{/privacy}","received_events_url":"https://api.github.com/users/Tom-Rees/received_events","type":"User","site_admin":false},"body":"Hi Andy,\r\n\r\nThis is a proposed fix for #144. I've tested it on our test system. Please could you review?\r\n\r\nI am a little concerned that this change means that the 'local_settings' file is always created by this script and thus we will always overwrite the defaults in 'settings.py' such as 'XDM_URL=homer.cw-ngv.com:7888' with E.g. 'XDM_URL=MUST_BE_CONFIGURED' and so this change may have consequences that I've not considered.\r\n\r\nI think that making it clear when these values have not been configured manually is a good thing, but I don't know if you rely on the defaults currently in use. \r\n\r\n\r\n\r\n","created_at":"2015-11-23T17:20:26Z","updated_at":"2015-11-24T10:31:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"de9b92b55d61f7b4beb9e415b18e6d5ca1e50341","assignee":{"login":"Tom-Rees","id":12893820,"avatar_url":"https://avatars.githubusercontent.com/u/12893820?v=3","gravatar_id":"","url":"https://api.github.com/users/Tom-Rees","html_url":"https://github.com/Tom-Rees","followers_url":"https://api.github.com/users/Tom-Rees/followers","following_url":"https://api.github.com/users/Tom-Rees/following{/other_user}","gists_url":"https://api.github.com/users/Tom-Rees/gists{/gist_id}","starred_url":"https://api.github.com/users/Tom-Rees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tom-Rees/subscriptions","organizations_url":"https://api.github.com/users/Tom-Rees/orgs","repos_url":"https://api.github.com/users/Tom-Rees/repos","events_url":"https://api.github.com/users/Tom-Rees/events{/privacy}","received_events_url":"https://api.github.com/users/Tom-Rees/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/Metaswitch/ellis/pulls/148/commits","review_comments_url":"https://api.github.com/repos/Metaswitch/ellis/pulls/148/comments","review_comment_url":"https://api.github.com/repos/Metaswitch/ellis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Metaswitch/ellis/issues/148/comments","statuses_url":"https://api.github.com/repos/Metaswitch/ellis/statuses/7b5db7981f9973a6176f85313757aba2c6021fc2","head":{"label":"Metaswitch:improve_python_settings_overwrite","ref":"improve_python_settings_overwrite","sha":"7b5db7981f9973a6176f85313757aba2c6021fc2","user":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"repo":{"id":9912997,"name":"ellis","full_name":"Metaswitch/ellis","owner":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Metaswitch/ellis","description":"Clearwater provisioning server","fork":false,"url":"https://api.github.com/repos/Metaswitch/ellis","forks_url":"https://api.github.com/repos/Metaswitch/ellis/forks","keys_url":"https://api.github.com/repos/Metaswitch/ellis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Metaswitch/ellis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Metaswitch/ellis/teams","hooks_url":"https://api.github.com/repos/Metaswitch/ellis/hooks","issue_events_url":"https://api.github.com/repos/Metaswitch/ellis/issues/events{/number}","events_url":"https://api.github.com/repos/Metaswitch/ellis/events","assignees_url":"https://api.github.com/repos/Metaswitch/ellis/assignees{/user}","branches_url":"https://api.github.com/repos/Metaswitch/ellis/branches{/branch}","tags_url":"https://api.github.com/repos/Metaswitch/ellis/tags","blobs_url":"https://api.github.com/repos/Metaswitch/ellis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Metaswitch/ellis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Metaswitch/ellis/git/refs{/sha}","trees_url":"https://api.github.com/repos/Metaswitch/ellis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Metaswitch/ellis/statuses/{sha}","languages_url":"https://api.github.com/repos/Metaswitch/ellis/languages","stargazers_url":"https://api.github.com/repos/Metaswitch/ellis/stargazers","contributors_url":"https://api.github.com/repos/Metaswitch/ellis/contributors","subscribers_url":"https://api.github.com/repos/Metaswitch/ellis/subscribers","subscription_url":"https://api.github.com/repos/Metaswitch/ellis/subscription","commits_url":"https://api.github.com/repos/Metaswitch/ellis/commits{/sha}","git_commits_url":"https://api.github.com/repos/Metaswitch/ellis/git/commits{/sha}","comments_url":"https://api.github.com/repos/Metaswitch/ellis/comments{/number}","issue_comment_url":"https://api.github.com/repos/Metaswitch/ellis/issues/comments{/number}","contents_url":"https://api.github.com/repos/Metaswitch/ellis/contents/{+path}","compare_url":"https://api.github.com/repos/Metaswitch/ellis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Metaswitch/ellis/merges","archive_url":"https://api.github.com/repos/Metaswitch/ellis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Metaswitch/ellis/downloads","issues_url":"https://api.github.com/repos/Metaswitch/ellis/issues{/number}","pulls_url":"https://api.github.com/repos/Metaswitch/ellis/pulls{/number}","milestones_url":"https://api.github.com/repos/Metaswitch/ellis/milestones{/number}","notifications_url":"https://api.github.com/repos/Metaswitch/ellis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Metaswitch/ellis/labels{/name}","releases_url":"https://api.github.com/repos/Metaswitch/ellis/releases{/id}","created_at":"2013-05-07T13:53:13Z","updated_at":"2015-04-15T10:08:11Z","pushed_at":"2015-11-24T10:19:27Z","git_url":"git://github.com/Metaswitch/ellis.git","ssh_url":"git@github.com:Metaswitch/ellis.git","clone_url":"https://github.com/Metaswitch/ellis.git","svn_url":"https://github.com/Metaswitch/ellis","homepage":null,"size":1133,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":9,"forks":9,"open_issues":9,"watchers":5,"default_branch":"dev"}},"base":{"label":"Metaswitch:dev","ref":"dev","sha":"047f36e83264e7379446c03a537b52b992a04969","user":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"repo":{"id":9912997,"name":"ellis","full_name":"Metaswitch/ellis","owner":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Metaswitch/ellis","description":"Clearwater provisioning server","fork":false,"url":"https://api.github.com/repos/Metaswitch/ellis","forks_url":"https://api.github.com/repos/Metaswitch/ellis/forks","keys_url":"https://api.github.com/repos/Metaswitch/ellis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Metaswitch/ellis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Metaswitch/ellis/teams","hooks_url":"https://api.github.com/repos/Metaswitch/ellis/hooks","issue_events_url":"https://api.github.com/repos/Metaswitch/ellis/issues/events{/number}","events_url":"https://api.github.com/repos/Metaswitch/ellis/events","assignees_url":"https://api.github.com/repos/Metaswitch/ellis/assignees{/user}","branches_url":"https://api.github.com/repos/Metaswitch/ellis/branches{/branch}","tags_url":"https://api.github.com/repos/Metaswitch/ellis/tags","blobs_url":"https://api.github.com/repos/Metaswitch/ellis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Metaswitch/ellis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Metaswitch/ellis/git/refs{/sha}","trees_url":"https://api.github.com/repos/Metaswitch/ellis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Metaswitch/ellis/statuses/{sha}","languages_url":"https://api.github.com/repos/Metaswitch/ellis/languages","stargazers_url":"https://api.github.com/repos/Metaswitch/ellis/stargazers","contributors_url":"https://api.github.com/repos/Metaswitch/ellis/contributors","subscribers_url":"https://api.github.com/repos/Metaswitch/ellis/subscribers","subscription_url":"https://api.github.com/repos/Metaswitch/ellis/subscription","commits_url":"https://api.github.com/repos/Metaswitch/ellis/commits{/sha}","git_commits_url":"https://api.github.com/repos/Metaswitch/ellis/git/commits{/sha}","comments_url":"https://api.github.com/repos/Metaswitch/ellis/comments{/number}","issue_comment_url":"https://api.github.com/repos/Metaswitch/ellis/issues/comments{/number}","contents_url":"https://api.github.com/repos/Metaswitch/ellis/contents/{+path}","compare_url":"https://api.github.com/repos/Metaswitch/ellis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Metaswitch/ellis/merges","archive_url":"https://api.github.com/repos/Metaswitch/ellis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Metaswitch/ellis/downloads","issues_url":"https://api.github.com/repos/Metaswitch/ellis/issues{/number}","pulls_url":"https://api.github.com/repos/Metaswitch/ellis/pulls{/number}","milestones_url":"https://api.github.com/repos/Metaswitch/ellis/milestones{/number}","notifications_url":"https://api.github.com/repos/Metaswitch/ellis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Metaswitch/ellis/labels{/name}","releases_url":"https://api.github.com/repos/Metaswitch/ellis/releases{/id}","created_at":"2013-05-07T13:53:13Z","updated_at":"2015-04-15T10:08:11Z","pushed_at":"2015-11-24T10:19:27Z","git_url":"git://github.com/Metaswitch/ellis.git","ssh_url":"git@github.com:Metaswitch/ellis.git","clone_url":"https://github.com/Metaswitch/ellis.git","svn_url":"https://github.com/Metaswitch/ellis","homepage":null,"size":1133,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":9,"forks":9,"open_issues":9,"watchers":5,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Metaswitch/ellis/pulls/148"},"html":{"href":"https://github.com/Metaswitch/ellis/pull/148"},"issue":{"href":"https://api.github.com/repos/Metaswitch/ellis/issues/148"},"comments":{"href":"https://api.github.com/repos/Metaswitch/ellis/issues/148/comments"},"review_comments":{"href":"https://api.github.com/repos/Metaswitch/ellis/pulls/148/comments"},"review_comment":{"href":"https://api.github.com/repos/Metaswitch/ellis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Metaswitch/ellis/pulls/148/commits"},"statuses":{"href":"https://api.github.com/repos/Metaswitch/ellis/statuses/7b5db7981f9973a6176f85313757aba2c6021fc2"}}}}