GitHub PullRequestReviewCommentEvent at 2014-09-26 20:56:04
Repository: puppet-scripts
Actor: des4maisons
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls/comments/18113240","id":18113240,"diff_hunk":"@@ -5,71 +5,125 @@ PUBLIC_CONFDIR=\"<%= @public_confdir %>\"\n DEPLOYMENT_KEY=\"<%= @deployment_private_key_loc %>\"\n PUBLIC_REPO_URL=\"<%= @public_repo_url %>\"\n PRIVATE_REPO_URL=\"<%= @private_repo_url %>\"\n-GIT_BRANCH=\"<%= @git_branch %>\"\n+PUBLIC_GIT_BRANCH=\"master\"\n+PRIVATE_GIT_BRANCH=\"master\"\n myname=`basename \"$0\"`\n \n-fyi() {\n-  echo \"$myname: FYI:\" \"$@\"\n+# Determine if this script is running interactively or not\n+/usr/bin/tty -s\n+INTERACTIVE=$?\n+\n+# pipefail is useful\n+set -o pipefail\n+\n+info() {\n+  # This allows us to use this bash function as a pipe destination which makes\n+  # logging slightly easier\n+  while read INPUT; do\n+    /usr/bin/logger --id --priority local3.info --tag ${myname} \"INFO: $INPUT\"\n+    if [ \"$INTERACTIVE\" -eq 0 ]; then\n+      echo \"INFO: $INPUT\"\n+    fi\n+  done\n }\n \n error() {\n-  echo 1>&2 \"$myname:\" \"$@\"\n-}\n-\n-fatal() {\n-  error \"$@\"\n+  /usr/bin/logger --id --stderr --priority local3.err --tag ${myname} \"ERROR: $@\"\n   exit 1\n }\n \n usage() {\n-  fatal \"usage: $myname\"\n+  echo \"usage: ${myname} [-r branch_name] [-u branch_name]\"\n+  echo \"  -r branch_name: Override 'master' on the PRIVATE branch with this value\"\n+  echo \"  -u branch_name: Override 'master' on the PUBLIC branch with this value\"\n+  exit 1\n }\n \n-\n git_clone_update() {\n   local localdir=\"$1\"\n   local remoterepo=\"$2\"\n+  local branch=\"$3\"\n \n-  # Clone/update the private puppet repo\n-  if [ -e \"${localdir}/.git\" ]; then\n-\n-    # Assumption here is that if the .git directory exists, the clone step as\n-    # already been completed\n-    cd \"${localdir}\" \\\n-      && /usr/bin/git fetch origin \\\n-      && /usr/bin/git reset --hard \"origin/${GIT_BRANCH}\" \\\n-      && /usr/bin/git checkout \"${GIT_BRANCH}\" \\\n-      && /usr/bin/git submodule init \\\n-      && /usr/bin/git submodule update\n+  # Note: If ‘|&’ is used, the standard error of command1 is connected to\n+  # command2’s standard input through the pipe; it is shorthand for 2>&1 |.\n+  # This implicit redirection of the standard error is performed after any\n+  # redirections specified by the command.\n+  # Source: http://www.gnu.org/software/bash/manual/bash.html#Pipelines\n \n-  else\n-\n-    # Assumption: the .git directory does not exist, so most likely hasn't been\n-    # cloned as yet\n+  # Assumption: the .git directory does not exist, so most likely hasn't been\n+  # cloned as yet\n+  if [ ! -e \"${localdir}/.git\" ]; then\n     /usr/bin/git clone \\\n       \"${remoterepo}\" \\\n-      \"${localdir}\"\n+      \"${localdir}\" \\\n+      |& info\n+\n+    # What we really care about here is the return status of the first command.\n+    # Note that PIPESTATUS[0] stores the exit code of the first command in the\n+    # (piped) chain since we 'set -o pipefail' earlier.\n+    retval=${PIPESTATUS[0]}\n+    if [ $retval != 0 ]; then return $retval; fi\n+  fi\n \n-    # Clone any/all submodules as well\n-    cd \"${localdir}\" \\\n-      && /usr/bin/git checkout \"${GIT_BRANCH}\" \\\n-      && /usr/bin/git submodule init \\\n-      && /usr/bin/git submodule update\n+  cd \"${localdir}\" && /usr/bin/git fetch --all |& info\n+  retval=${PIPESTATUS[0]}\n+  if [ $retval != 0 ]; then return $retval; fi\n \n-  fi\n+  cd \"${localdir}\" && /usr/bin/git reset --hard \"origin/${branch}\" |& info\n+  retval=${PIPESTATUS[0]}\n+  if [ $retval != 0 ]; then return $retval; fi\n+\n+  cd \"${localdir}\" && /usr/bin/git checkout --force \"${branch}\" |& info\n+  retval=${PIPESTATUS[0]}\n+  if [ $retval != 0 ]; then return $retval; fi\n+\n+  cd \"${localdir}\" && /usr/bin/git submodule sync |& info\n+  retval=${PIPESTATUS[0]}\n+  if [ $retval != 0 ]; then return $retval; fi\n+\n+  cd \"${localdir}\" && /usr/bin/git submodule update --recursive |& info\n+  retval=${PIPESTATUS[0]}\n+  if [ $retval != 0 ]; then return $retval; fi","path":"modules/puppetclient/templates/puppull.erb","position":114,"original_position":114,"commit_id":"1b47f27850f818e557a65c6691a28a827a636bb2","original_commit_id":"1b47f27850f818e557a65c6691a28a827a636bb2","user":{"login":"des4maisons","id":684904,"avatar_url":"https://avatars.githubusercontent.com/u/684904?v=2","gravatar_id":"","url":"https://api.github.com/users/des4maisons","html_url":"https://github.com/des4maisons","followers_url":"https://api.github.com/users/des4maisons/followers","following_url":"https://api.github.com/users/des4maisons/following{/other_user}","gists_url":"https://api.github.com/users/des4maisons/gists{/gist_id}","starred_url":"https://api.github.com/users/des4maisons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/des4maisons/subscriptions","organizations_url":"https://api.github.com/users/des4maisons/orgs","repos_url":"https://api.github.com/users/des4maisons/repos","events_url":"https://api.github.com/users/des4maisons/events{/privacy}","received_events_url":"https://api.github.com/users/des4maisons/received_events","type":"User","site_admin":false},"body":"same here, unfortunate repetition.","created_at":"2014-09-26T20:56:04Z","updated_at":"2014-09-26T20:56:04Z","html_url":"https://github.com/marvinpinto/puppet-scripts/pull/4#discussion_r18113240","pull_request_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls/comments/18113240"},"html":{"href":"https://github.com/marvinpinto/puppet-scripts/pull/4#discussion_r18113240"},"pull_request":{"href":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls/4","id":21872576,"html_url":"https://github.com/marvinpinto/puppet-scripts/pull/4","diff_url":"https://github.com/marvinpinto/puppet-scripts/pull/4.diff","patch_url":"https://github.com/marvinpinto/puppet-scripts/pull/4.patch","issue_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/issues/4","number":4,"state":"open","locked":false,"title":"Few enhancements to 'puppull'","user":{"login":"marvinpinto","id":1159942,"avatar_url":"https://avatars.githubusercontent.com/u/1159942?v=2","gravatar_id":"","url":"https://api.github.com/users/marvinpinto","html_url":"https://github.com/marvinpinto","followers_url":"https://api.github.com/users/marvinpinto/followers","following_url":"https://api.github.com/users/marvinpinto/following{/other_user}","gists_url":"https://api.github.com/users/marvinpinto/gists{/gist_id}","starred_url":"https://api.github.com/users/marvinpinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marvinpinto/subscriptions","organizations_url":"https://api.github.com/users/marvinpinto/orgs","repos_url":"https://api.github.com/users/marvinpinto/repos","events_url":"https://api.github.com/users/marvinpinto/events{/privacy}","received_events_url":"https://api.github.com/users/marvinpinto/received_events","type":"User","site_admin":false},"body":"- Syslog output wherever appropriate\r\n- Accept branch arguments via the command line","created_at":"2014-09-26T20:15:34Z","updated_at":"2014-09-26T20:56:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"183cd29ba2afdb4794ee763640a1b8681b20a88e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls/4/commits","review_comments_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls/4/comments","review_comment_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls/comments/{number}","comments_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/issues/4/comments","statuses_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/statuses/1b47f27850f818e557a65c6691a28a827a636bb2","head":{"label":"marvinpinto:puppull-branch-argument","ref":"puppull-branch-argument","sha":"1b47f27850f818e557a65c6691a28a827a636bb2","user":{"login":"marvinpinto","id":1159942,"avatar_url":"https://avatars.githubusercontent.com/u/1159942?v=2","gravatar_id":"","url":"https://api.github.com/users/marvinpinto","html_url":"https://github.com/marvinpinto","followers_url":"https://api.github.com/users/marvinpinto/followers","following_url":"https://api.github.com/users/marvinpinto/following{/other_user}","gists_url":"https://api.github.com/users/marvinpinto/gists{/gist_id}","starred_url":"https://api.github.com/users/marvinpinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marvinpinto/subscriptions","organizations_url":"https://api.github.com/users/marvinpinto/orgs","repos_url":"https://api.github.com/users/marvinpinto/repos","events_url":"https://api.github.com/users/marvinpinto/events{/privacy}","received_events_url":"https://api.github.com/users/marvinpinto/received_events","type":"User","site_admin":false},"repo":{"id":21816966,"name":"puppet-scripts","full_name":"marvinpinto/puppet-scripts","owner":{"login":"marvinpinto","id":1159942,"avatar_url":"https://avatars.githubusercontent.com/u/1159942?v=2","gravatar_id":"","url":"https://api.github.com/users/marvinpinto","html_url":"https://github.com/marvinpinto","followers_url":"https://api.github.com/users/marvinpinto/followers","following_url":"https://api.github.com/users/marvinpinto/following{/other_user}","gists_url":"https://api.github.com/users/marvinpinto/gists{/gist_id}","starred_url":"https://api.github.com/users/marvinpinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marvinpinto/subscriptions","organizations_url":"https://api.github.com/users/marvinpinto/orgs","repos_url":"https://api.github.com/users/marvinpinto/repos","events_url":"https://api.github.com/users/marvinpinto/events{/privacy}","received_events_url":"https://api.github.com/users/marvinpinto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marvinpinto/puppet-scripts","description":"","fork":false,"url":"https://api.github.com/repos/marvinpinto/puppet-scripts","forks_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/forks","keys_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/teams","hooks_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/hooks","issue_events_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/events","assignees_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/tags","blobs_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/languages","stargazers_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/stargazers","contributors_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/contributors","subscribers_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/subscribers","subscription_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/subscription","commits_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/issues/comments/{number}","contents_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/merges","archive_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/downloads","issues_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/labels{/name}","releases_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/releases{/id}","created_at":"2014-07-14T11:13:14Z","updated_at":"2014-09-14T21:57:19Z","pushed_at":"2014-09-26T20:27:46Z","git_url":"git://github.com/marvinpinto/puppet-scripts.git","ssh_url":"git@github.com:marvinpinto/puppet-scripts.git","clone_url":"https://github.com/marvinpinto/puppet-scripts.git","svn_url":"https://github.com/marvinpinto/puppet-scripts","homepage":null,"size":350,"stargazers_count":0,"watchers_count":0,"language":"Perl","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"marvinpinto:master","ref":"master","sha":"85b1c758ef1355a79d4e2f9a28dfa24f4cb42347","user":{"login":"marvinpinto","id":1159942,"avatar_url":"https://avatars.githubusercontent.com/u/1159942?v=2","gravatar_id":"","url":"https://api.github.com/users/marvinpinto","html_url":"https://github.com/marvinpinto","followers_url":"https://api.github.com/users/marvinpinto/followers","following_url":"https://api.github.com/users/marvinpinto/following{/other_user}","gists_url":"https://api.github.com/users/marvinpinto/gists{/gist_id}","starred_url":"https://api.github.com/users/marvinpinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marvinpinto/subscriptions","organizations_url":"https://api.github.com/users/marvinpinto/orgs","repos_url":"https://api.github.com/users/marvinpinto/repos","events_url":"https://api.github.com/users/marvinpinto/events{/privacy}","received_events_url":"https://api.github.com/users/marvinpinto/received_events","type":"User","site_admin":false},"repo":{"id":21816966,"name":"puppet-scripts","full_name":"marvinpinto/puppet-scripts","owner":{"login":"marvinpinto","id":1159942,"avatar_url":"https://avatars.githubusercontent.com/u/1159942?v=2","gravatar_id":"","url":"https://api.github.com/users/marvinpinto","html_url":"https://github.com/marvinpinto","followers_url":"https://api.github.com/users/marvinpinto/followers","following_url":"https://api.github.com/users/marvinpinto/following{/other_user}","gists_url":"https://api.github.com/users/marvinpinto/gists{/gist_id}","starred_url":"https://api.github.com/users/marvinpinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marvinpinto/subscriptions","organizations_url":"https://api.github.com/users/marvinpinto/orgs","repos_url":"https://api.github.com/users/marvinpinto/repos","events_url":"https://api.github.com/users/marvinpinto/events{/privacy}","received_events_url":"https://api.github.com/users/marvinpinto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marvinpinto/puppet-scripts","description":"","fork":false,"url":"https://api.github.com/repos/marvinpinto/puppet-scripts","forks_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/forks","keys_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/teams","hooks_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/hooks","issue_events_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/events","assignees_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/tags","blobs_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/languages","stargazers_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/stargazers","contributors_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/contributors","subscribers_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/subscribers","subscription_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/subscription","commits_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/issues/comments/{number}","contents_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/merges","archive_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/downloads","issues_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/labels{/name}","releases_url":"https://api.github.com/repos/marvinpinto/puppet-scripts/releases{/id}","created_at":"2014-07-14T11:13:14Z","updated_at":"2014-09-14T21:57:19Z","pushed_at":"2014-09-26T20:27:46Z","git_url":"git://github.com/marvinpinto/puppet-scripts.git","ssh_url":"git@github.com:marvinpinto/puppet-scripts.git","clone_url":"https://github.com/marvinpinto/puppet-scripts.git","svn_url":"https://github.com/marvinpinto/puppet-scripts","homepage":null,"size":350,"stargazers_count":0,"watchers_count":0,"language":"Perl","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls/4"},"html":{"href":"https://github.com/marvinpinto/puppet-scripts/pull/4"},"issue":{"href":"https://api.github.com/repos/marvinpinto/puppet-scripts/issues/4"},"comments":{"href":"https://api.github.com/repos/marvinpinto/puppet-scripts/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/marvinpinto/puppet-scripts/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/marvinpinto/puppet-scripts/statuses/1b47f27850f818e557a65c6691a28a827a636bb2"}}}}