{"action":"created","comment":{"url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls/comments/76738529","id":76738529,"diff_hunk":"@@ -0,0 +1,94 @@\n+\"\"\"\n+Licensed to the Apache Software Foundation (ASF) under one\n+or more contributor license agreements.  See the NOTICE file\n+distributed with this work for additional information\n+regarding copyright ownership.  The ASF licenses this file\n+to you under the Apache License, Version 2.0 (the\n+\"License\"); you may not use this file except in compliance\n+with the License.  You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+\n+Ambari Agent\n+\n+\"\"\"\n+\n+import sys\n+import os\n+import logging\n+from resource_management import *\n+from resource_management.libraries.functions.check_process_status import check_process_status\n+from resource_management.libraries.resources.hdfs_resource import HdfsResource\n+from resource_management.core.resources.service import Service\n+\n+class DtRtsClient(Script):\n+  def install(self, env):\n+    import params\n+    env.set_params(params)\n+    self.install_datatorrent_repo()\n+    self.install_packages(env)\n+    self.add_hdfs_folder(env)\n+    self.add_user_homeDir(env)\n+\n+  def configure(self, env, upgrade_type=None):\n+    import params\n+    env.set_params(params)\n+    Execute(\"export DT_USER_ARG={0} && DT_GROUP_ARG={1} && DT_BASE_DIR_ARG={2} && DT_GATEWAY_ADDRESS_ARG={3}\".format(params.DT_USER_ARG, params.DT_GROUP_ARG, params.DT_BASE_DIR_ARG, params.DT_GATEWAY_ADDRESS_ARG))\n+    Execute(\"export DT_HADOOP_ARG={0} && DT_ENV_EXPORT_ARG={1} && DT_SITE_ARG={2} && CUSTOM_ENV_ARG={3}\".format(params.DT_HADOOP_ARG, params.DT_ENV_EXPORT_ARG, params.DT_SITE_ARG, params.CUSTOM_ENV_ARG))\n+\n+  def stop(self, env):\n+    import params\n+    env.set_params(params)\n+    Service('dtgateway', action='stop')\n+\n+  def start(self, env):\n+    import params\n+    env.set_params(params)\n+    Service('dtgateway', action='start')\n+\n+  def status(self, env):\n+    check_process_status('/var/run/datatorrent/dtgateway.pid')\n+\n+  def install_datatorrent_repo(self):\n+      import os\n+      import platform\n+      distribution = platform.linux_distribution()[0].lower()\n+      if distribution.lower() in ['centos', 'redhat'] and not os.path.exists('/etc/yum.repos.d/datatorrent.repo'):\n+          Execute('wget -O /etc/yum.repos.d/datatorrent.repo https://www.datatorrent.com/downloads/repos/yum/repo/datatorrent-rts.repo 2>/dev/null || curl -o /etc/yum.repos.d/datatorrent.repo https://www.datatorrent.com/downloads/repos/yum/repo/datatorrent-rts.repo')\n+          Execute('wget https://www.datatorrent.com/downloads/repos/apt/keyFile 2>/dev/null || curl -sO https://www.datatorrent.com/downloads/repos/apt/keyFile')\n+          Execute('rpm --import keyFile')\n+      elif distribution.lower() in ['ubuntu'] and not os.path.exists('/etc/apt/sources.list.d/datatorrent.list'):\n+          Execute('echo \"deb https://www.datatorrent.com/downloads/repos/apt/ /\" > /etc/apt/sources.list.d/datatorrent.list')\n+          Execute('wget -O - https://www.datatorrent.com/downloads/repos/apt/keyFile | apt-key add - 2>/dev/null || sudo curl -o - https://www.datatorrent.com/downloads/repos/apt/keyFile | apt-key add -')\n+          Execute('apt-get update')\n+\n+  def add_hdfs_folder(self, env):\n+      import params\n+      import os\n+      env.set_params(params)\n+      homeDir = '/user/' + params.DT_USER_ARG\n+      params.HdfsResource(homeDir,\n+                        type=\"directory\",\n+                        action=\"create_on_execute\",\n+                        owner=params.DT_USER_ARG,\n+                        group=params.DT_GROUP_ARG,\n+                        mode=0755,\n+                        recursive_chown=True,\n+                        recursive_chmod=True\n+                        )\n+\n+  def add_user_homeDir(self, env):","path":"package/scripts/dtrts_client.py","position":86,"original_position":86,"commit_id":"ab2e6e87036f4955d41142c2013b7e2cb905adeb","original_commit_id":"ab2e6e87036f4955d41142c2013b7e2cb905adeb","user":{"login":"bhupeshchawda","id":8895284,"avatar_url":"https://avatars.githubusercontent.com/u/8895284?v=3","gravatar_id":"","url":"https://api.github.com/users/bhupeshchawda","html_url":"https://github.com/bhupeshchawda","followers_url":"https://api.github.com/users/bhupeshchawda/followers","following_url":"https://api.github.com/users/bhupeshchawda/following{/other_user}","gists_url":"https://api.github.com/users/bhupeshchawda/gists{/gist_id}","starred_url":"https://api.github.com/users/bhupeshchawda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhupeshchawda/subscriptions","organizations_url":"https://api.github.com/users/bhupeshchawda/orgs","repos_url":"https://api.github.com/users/bhupeshchawda/repos","events_url":"https://api.github.com/users/bhupeshchawda/events{/privacy}","received_events_url":"https://api.github.com/users/bhupeshchawda/received_events","type":"User","site_admin":false},"body":"I'll suggest to check this once. I think this should already exist.","created_at":"2016-08-30T06:50:08Z","updated_at":"2016-08-30T06:50:08Z","html_url":"https://github.com/DataTorrent/ambari-datatorrent-service/pull/1#discussion_r76738529","pull_request_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls/comments/76738529"},"html":{"href":"https://github.com/DataTorrent/ambari-datatorrent-service/pull/1#discussion_r76738529"},"pull_request":{"href":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls/1","id":75779969,"html_url":"https://github.com/DataTorrent/ambari-datatorrent-service/pull/1","diff_url":"https://github.com/DataTorrent/ambari-datatorrent-service/pull/1.diff","patch_url":"https://github.com/DataTorrent/ambari-datatorrent-service/pull/1.patch","issue_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/issues/1","number":1,"state":"open","locked":false,"title":"SPOI-7414: Add ambari service to install datatorrent-rts","user":{"login":"DT-Priyanka","id":8776018,"avatar_url":"https://avatars.githubusercontent.com/u/8776018?v=3","gravatar_id":"","url":"https://api.github.com/users/DT-Priyanka","html_url":"https://github.com/DT-Priyanka","followers_url":"https://api.github.com/users/DT-Priyanka/followers","following_url":"https://api.github.com/users/DT-Priyanka/following{/other_user}","gists_url":"https://api.github.com/users/DT-Priyanka/gists{/gist_id}","starred_url":"https://api.github.com/users/DT-Priyanka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DT-Priyanka/subscriptions","organizations_url":"https://api.github.com/users/DT-Priyanka/orgs","repos_url":"https://api.github.com/users/DT-Priyanka/repos","events_url":"https://api.github.com/users/DT-Priyanka/events{/privacy}","received_events_url":"https://api.github.com/users/DT-Priyanka/received_events","type":"User","site_admin":false},"body":"Ambari service code to install datatorrent-rts service on hadoop cluster managed by Ambari. Please refer README on details on how service works.\r\nThe code is supported on Ambari version 2.2.0\r\n\r\nGuidelines to write service: http://www.slideshare.net/hortonworks/201503-partnerworkshopambari\r\nhttps://cwiki.apache.org/confluence/display/AMBARI/Defining+a+Custom+Stack+and+Services","created_at":"2016-06-30T08:37:32Z","updated_at":"2016-08-30T06:50:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8abd3f76052debbbe8529501d8cae0a4abf9f030","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls/1/commits","review_comments_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls/1/comments","review_comment_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/issues/1/comments","statuses_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/statuses/ab2e6e87036f4955d41142c2013b7e2cb905adeb","head":{"label":"DT-Priyanka:SPOI-7414-ambari-service","ref":"SPOI-7414-ambari-service","sha":"ab2e6e87036f4955d41142c2013b7e2cb905adeb","user":{"login":"DT-Priyanka","id":8776018,"avatar_url":"https://avatars.githubusercontent.com/u/8776018?v=3","gravatar_id":"","url":"https://api.github.com/users/DT-Priyanka","html_url":"https://github.com/DT-Priyanka","followers_url":"https://api.github.com/users/DT-Priyanka/followers","following_url":"https://api.github.com/users/DT-Priyanka/following{/other_user}","gists_url":"https://api.github.com/users/DT-Priyanka/gists{/gist_id}","starred_url":"https://api.github.com/users/DT-Priyanka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DT-Priyanka/subscriptions","organizations_url":"https://api.github.com/users/DT-Priyanka/orgs","repos_url":"https://api.github.com/users/DT-Priyanka/repos","events_url":"https://api.github.com/users/DT-Priyanka/events{/privacy}","received_events_url":"https://api.github.com/users/DT-Priyanka/received_events","type":"User","site_admin":false},"repo":{"id":62280209,"name":"ambari-datatorrent-service","full_name":"DT-Priyanka/ambari-datatorrent-service","owner":{"login":"DT-Priyanka","id":8776018,"avatar_url":"https://avatars.githubusercontent.com/u/8776018?v=3","gravatar_id":"","url":"https://api.github.com/users/DT-Priyanka","html_url":"https://github.com/DT-Priyanka","followers_url":"https://api.github.com/users/DT-Priyanka/followers","following_url":"https://api.github.com/users/DT-Priyanka/following{/other_user}","gists_url":"https://api.github.com/users/DT-Priyanka/gists{/gist_id}","starred_url":"https://api.github.com/users/DT-Priyanka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DT-Priyanka/subscriptions","organizations_url":"https://api.github.com/users/DT-Priyanka/orgs","repos_url":"https://api.github.com/users/DT-Priyanka/repos","events_url":"https://api.github.com/users/DT-Priyanka/events{/privacy}","received_events_url":"https://api.github.com/users/DT-Priyanka/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DT-Priyanka/ambari-datatorrent-service","description":null,"fork":true,"url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service","forks_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/forks","keys_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/teams","hooks_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/hooks","issue_events_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/issues/events{/number}","events_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/events","assignees_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/assignees{/user}","branches_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/branches{/branch}","tags_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/tags","blobs_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/statuses/{sha}","languages_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/languages","stargazers_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/stargazers","contributors_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/contributors","subscribers_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/subscribers","subscription_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/subscription","commits_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/contents/{+path}","compare_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/merges","archive_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/downloads","issues_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/issues{/number}","pulls_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/pulls{/number}","milestones_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/milestones{/number}","notifications_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/labels{/name}","releases_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/releases{/id}","deployments_url":"https://api.github.com/repos/DT-Priyanka/ambari-datatorrent-service/deployments","created_at":"2016-06-30T04:49:46Z","updated_at":"2016-06-24T17:02:07Z","pushed_at":"2016-08-19T06:41:44Z","git_url":"git://github.com/DT-Priyanka/ambari-datatorrent-service.git","ssh_url":"git@github.com:DT-Priyanka/ambari-datatorrent-service.git","clone_url":"https://github.com/DT-Priyanka/ambari-datatorrent-service.git","svn_url":"https://github.com/DT-Priyanka/ambari-datatorrent-service","homepage":null,"size":590,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"DataTorrent:master","ref":"master","sha":"1ae08513b950e8063a282bc588ea815224b75c98","user":{"login":"DataTorrent","id":4400063,"avatar_url":"https://avatars.githubusercontent.com/u/4400063?v=3","gravatar_id":"","url":"https://api.github.com/users/DataTorrent","html_url":"https://github.com/DataTorrent","followers_url":"https://api.github.com/users/DataTorrent/followers","following_url":"https://api.github.com/users/DataTorrent/following{/other_user}","gists_url":"https://api.github.com/users/DataTorrent/gists{/gist_id}","starred_url":"https://api.github.com/users/DataTorrent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataTorrent/subscriptions","organizations_url":"https://api.github.com/users/DataTorrent/orgs","repos_url":"https://api.github.com/users/DataTorrent/repos","events_url":"https://api.github.com/users/DataTorrent/events{/privacy}","received_events_url":"https://api.github.com/users/DataTorrent/received_events","type":"Organization","site_admin":false},"repo":{"id":61899543,"name":"ambari-datatorrent-service","full_name":"DataTorrent/ambari-datatorrent-service","owner":{"login":"DataTorrent","id":4400063,"avatar_url":"https://avatars.githubusercontent.com/u/4400063?v=3","gravatar_id":"","url":"https://api.github.com/users/DataTorrent","html_url":"https://github.com/DataTorrent","followers_url":"https://api.github.com/users/DataTorrent/followers","following_url":"https://api.github.com/users/DataTorrent/following{/other_user}","gists_url":"https://api.github.com/users/DataTorrent/gists{/gist_id}","starred_url":"https://api.github.com/users/DataTorrent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataTorrent/subscriptions","organizations_url":"https://api.github.com/users/DataTorrent/orgs","repos_url":"https://api.github.com/users/DataTorrent/repos","events_url":"https://api.github.com/users/DataTorrent/events{/privacy}","received_events_url":"https://api.github.com/users/DataTorrent/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DataTorrent/ambari-datatorrent-service","description":null,"fork":false,"url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service","forks_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/forks","keys_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/teams","hooks_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/hooks","issue_events_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/issues/events{/number}","events_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/events","assignees_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/assignees{/user}","branches_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/branches{/branch}","tags_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/tags","blobs_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/statuses/{sha}","languages_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/languages","stargazers_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/stargazers","contributors_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/contributors","subscribers_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/subscribers","subscription_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/subscription","commits_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/contents/{+path}","compare_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/merges","archive_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/downloads","issues_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/issues{/number}","pulls_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls{/number}","milestones_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/milestones{/number}","notifications_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/labels{/name}","releases_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/releases{/id}","deployments_url":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/deployments","created_at":"2016-06-24T17:02:07Z","updated_at":"2016-06-24T17:02:07Z","pushed_at":"2016-08-19T06:41:45Z","git_url":"git://github.com/DataTorrent/ambari-datatorrent-service.git","ssh_url":"git@github.com:DataTorrent/ambari-datatorrent-service.git","clone_url":"https://github.com/DataTorrent/ambari-datatorrent-service.git","svn_url":"https://github.com/DataTorrent/ambari-datatorrent-service","homepage":null,"size":4,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls/1"},"html":{"href":"https://github.com/DataTorrent/ambari-datatorrent-service/pull/1"},"issue":{"href":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/issues/1"},"comments":{"href":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/DataTorrent/ambari-datatorrent-service/statuses/ab2e6e87036f4955d41142c2013b7e2cb905adeb"}}}}
{"actor":{"display_login":"bhupeshchawda"}}