{"action":"created","comment":{"url":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls/comments/64195589","id":64195589,"diff_hunk":"@@ -0,0 +1,118 @@\n+\n+import os\n+\n+\n+def show_help(x):\n+    x.p.msg(\"\\n 008-export-campaign:\\n\", False)\n+    x.p.msg(\" applet for exporting the campaign as file to a folder\\n\", False)\n+    x.p.msg(\"\\n usage:\\n\", False)\n+    x.p.msg(\" - exec 008-export-campaign: [host] campaign_name:\\\"[string]\\\" \"\n+            \"path:\\\"[file_descriptor]\\\"\\n\", False)\n+    x.p.msg(\"\\n examples:\\n\", False)\n+    x.p.msg(\" - exec 008-export-campaign: alpha campaign_name:\\\"test\\\" \"\n+            \"path:\\\"./campaign_1\\\"\\n\", False)\n+    x.p.msg(\" - exec 008-export-campaign: alpha campaign_name:\\\"001-test\\\" \"\n+            \"path:\\\"/home/alpha/bin/net-applet-shuffler/campaigns/test/\"\n+            \"campaign.save\\\"\", False)\n+\n+\n+def print_wrong_usage(x):\n+    x.p.err(\"error: wrong usage\\n\")\n+    x.p.err(\"use: [host] \"\n+            \"campaign_name:\\\"[string]\\\" \"\n+            \"path:\\\"[file_descriptor]\\\"\\n\")\n+\n+\n+def save_campaign_file(x, dic):\n+    # read campaign path file\n+    campaign_file_path = os.path.join(os.path.dirname(__file__), \"./../../\",\n+                                      \"campaigns\", dic[\"campaign_name\"],\n+                                      \"run.py\")\n+    print(campaign_file_path)\n+    campaign_file = open(campaign_file_path, \"r\")\n+    campaign_string = campaign_file.read()\n+    campaign_file.close()\n+    # make sure target path exists\n+    x.ssh.exec(dic[\"host_ip_control\"], dic[\"host_user\"],\n+               \"mkdir -p {}\".format(dic[\"file_path\"]))\n+    # save campaign file\n+    campaign_file = open(os.path.join(dic[\"file_path\"], dic[\"file_name\"]), \"w\")\n+    campaign_file.write(campaign_string)\n+    campaign_file.close()\n+    return True\n+\n+\n+def create_file_path(x, file_descriptor, absolute, dic):\n+    file_path = str()\n+    file_name = str()\n+    # note: the current file path is two levels below nas\n+    # path and file name shuffling magic\n+    if not absolute:\n+        current_file_dir = os.path.dirname(__file__)\n+        # nas file path + dir and filename to dst file\n+        file_path_full = os.path.join(current_file_dir + \"/../../\",\n+                                      file_descriptor)\n+        file_path_split = file_path_full.split(\"/\")","path":"applets/008-export-campaign/applet.py","position":55,"original_position":55,"commit_id":"a3319e8602a1d26ba1b775c1751310bc0d211131","original_commit_id":"a3319e8602a1d26ba1b775c1751310bc0d211131","user":{"login":"hgn","id":46653,"avatar_url":"https://avatars.githubusercontent.com/u/46653?v=3","gravatar_id":"","url":"https://api.github.com/users/hgn","html_url":"https://github.com/hgn","followers_url":"https://api.github.com/users/hgn/followers","following_url":"https://api.github.com/users/hgn/following{/other_user}","gists_url":"https://api.github.com/users/hgn/gists{/gist_id}","starred_url":"https://api.github.com/users/hgn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgn/subscriptions","organizations_url":"https://api.github.com/users/hgn/orgs","repos_url":"https://api.github.com/users/hgn/repos","events_url":"https://api.github.com/users/hgn/events{/privacy}","received_events_url":"https://api.github.com/users/hgn/received_events","type":"User","site_admin":false},"body":"\"/\" -> os.path.sep? I mean it is linux anyway and can be done in your way, but I am not soooo[TM] happy","created_at":"2016-05-23T09:50:18Z","updated_at":"2016-05-23T09:50:18Z","html_url":"https://github.com/hgn/net-applet-shuffler/pull/29#discussion_r64195589","pull_request_url":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls/29","_links":{"self":{"href":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls/comments/64195589"},"html":{"href":"https://github.com/hgn/net-applet-shuffler/pull/29#discussion_r64195589"},"pull_request":{"href":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls/29"}}},"pull_request":{"url":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls/29","id":70849756,"html_url":"https://github.com/hgn/net-applet-shuffler/pull/29","diff_url":"https://github.com/hgn/net-applet-shuffler/pull/29.diff","patch_url":"https://github.com/hgn/net-applet-shuffler/pull/29.patch","issue_url":"https://api.github.com/repos/hgn/net-applet-shuffler/issues/29","number":29,"state":"open","locked":false,"title":"Adding campaign export applet and minor adjustments","user":{"login":"danielmgit","id":17489942,"avatar_url":"https://avatars.githubusercontent.com/u/17489942?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmgit","html_url":"https://github.com/danielmgit","followers_url":"https://api.github.com/users/danielmgit/followers","following_url":"https://api.github.com/users/danielmgit/following{/other_user}","gists_url":"https://api.github.com/users/danielmgit/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmgit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmgit/subscriptions","organizations_url":"https://api.github.com/users/danielmgit/orgs","repos_url":"https://api.github.com/users/danielmgit/repos","events_url":"https://api.github.com/users/danielmgit/events{/privacy}","received_events_url":"https://api.github.com/users/danielmgit/received_events","type":"User","site_admin":false},"body":"Minor adjustments to current setup.","created_at":"2016-05-20T12:51:53Z","updated_at":"2016-05-23T09:50:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"734555c9a22b2257e40864d5614ddc294fab1779","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls/29/commits","review_comments_url":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls/29/comments","review_comment_url":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hgn/net-applet-shuffler/issues/29/comments","statuses_url":"https://api.github.com/repos/hgn/net-applet-shuffler/statuses/a3319e8602a1d26ba1b775c1751310bc0d211131","head":{"label":"danielmgit:master","ref":"master","sha":"a3319e8602a1d26ba1b775c1751310bc0d211131","user":{"login":"danielmgit","id":17489942,"avatar_url":"https://avatars.githubusercontent.com/u/17489942?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmgit","html_url":"https://github.com/danielmgit","followers_url":"https://api.github.com/users/danielmgit/followers","following_url":"https://api.github.com/users/danielmgit/following{/other_user}","gists_url":"https://api.github.com/users/danielmgit/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmgit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmgit/subscriptions","organizations_url":"https://api.github.com/users/danielmgit/orgs","repos_url":"https://api.github.com/users/danielmgit/repos","events_url":"https://api.github.com/users/danielmgit/events{/privacy}","received_events_url":"https://api.github.com/users/danielmgit/received_events","type":"User","site_admin":false},"repo":{"id":52860139,"name":"net-applet-shuffler","full_name":"danielmgit/net-applet-shuffler","owner":{"login":"danielmgit","id":17489942,"avatar_url":"https://avatars.githubusercontent.com/u/17489942?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmgit","html_url":"https://github.com/danielmgit","followers_url":"https://api.github.com/users/danielmgit/followers","following_url":"https://api.github.com/users/danielmgit/following{/other_user}","gists_url":"https://api.github.com/users/danielmgit/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmgit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmgit/subscriptions","organizations_url":"https://api.github.com/users/danielmgit/orgs","repos_url":"https://api.github.com/users/danielmgit/repos","events_url":"https://api.github.com/users/danielmgit/events{/privacy}","received_events_url":"https://api.github.com/users/danielmgit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danielmgit/net-applet-shuffler","description":"","fork":true,"url":"https://api.github.com/repos/danielmgit/net-applet-shuffler","forks_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/forks","keys_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/teams","hooks_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/hooks","issue_events_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/issues/events{/number}","events_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/events","assignees_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/assignees{/user}","branches_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/branches{/branch}","tags_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/tags","blobs_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/git/refs{/sha}","trees_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/statuses/{sha}","languages_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/languages","stargazers_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/stargazers","contributors_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/contributors","subscribers_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/subscribers","subscription_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/subscription","commits_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/commits{/sha}","git_commits_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/git/commits{/sha}","comments_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/comments{/number}","issue_comment_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/issues/comments{/number}","contents_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/contents/{+path}","compare_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/merges","archive_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/downloads","issues_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/issues{/number}","pulls_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/pulls{/number}","milestones_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/milestones{/number}","notifications_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/labels{/name}","releases_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/releases{/id}","deployments_url":"https://api.github.com/repos/danielmgit/net-applet-shuffler/deployments","created_at":"2016-03-01T08:17:53Z","updated_at":"2016-03-01T08:17:54Z","pushed_at":"2016-05-23T07:51:25Z","git_url":"git://github.com/danielmgit/net-applet-shuffler.git","ssh_url":"git@github.com:danielmgit/net-applet-shuffler.git","clone_url":"https://github.com/danielmgit/net-applet-shuffler.git","svn_url":"https://github.com/danielmgit/net-applet-shuffler","homepage":null,"size":274,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"hgn:master","ref":"master","sha":"734ba6d50e9e5aecb684d45297d73d438b86b8f1","user":{"login":"hgn","id":46653,"avatar_url":"https://avatars.githubusercontent.com/u/46653?v=3","gravatar_id":"","url":"https://api.github.com/users/hgn","html_url":"https://github.com/hgn","followers_url":"https://api.github.com/users/hgn/followers","following_url":"https://api.github.com/users/hgn/following{/other_user}","gists_url":"https://api.github.com/users/hgn/gists{/gist_id}","starred_url":"https://api.github.com/users/hgn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgn/subscriptions","organizations_url":"https://api.github.com/users/hgn/orgs","repos_url":"https://api.github.com/users/hgn/repos","events_url":"https://api.github.com/users/hgn/events{/privacy}","received_events_url":"https://api.github.com/users/hgn/received_events","type":"User","site_admin":false},"repo":{"id":51778101,"name":"net-applet-shuffler","full_name":"hgn/net-applet-shuffler","owner":{"login":"hgn","id":46653,"avatar_url":"https://avatars.githubusercontent.com/u/46653?v=3","gravatar_id":"","url":"https://api.github.com/users/hgn","html_url":"https://github.com/hgn","followers_url":"https://api.github.com/users/hgn/followers","following_url":"https://api.github.com/users/hgn/following{/other_user}","gists_url":"https://api.github.com/users/hgn/gists{/gist_id}","starred_url":"https://api.github.com/users/hgn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgn/subscriptions","organizations_url":"https://api.github.com/users/hgn/orgs","repos_url":"https://api.github.com/users/hgn/repos","events_url":"https://api.github.com/users/hgn/events{/privacy}","received_events_url":"https://api.github.com/users/hgn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hgn/net-applet-shuffler","description":"","fork":false,"url":"https://api.github.com/repos/hgn/net-applet-shuffler","forks_url":"https://api.github.com/repos/hgn/net-applet-shuffler/forks","keys_url":"https://api.github.com/repos/hgn/net-applet-shuffler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hgn/net-applet-shuffler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hgn/net-applet-shuffler/teams","hooks_url":"https://api.github.com/repos/hgn/net-applet-shuffler/hooks","issue_events_url":"https://api.github.com/repos/hgn/net-applet-shuffler/issues/events{/number}","events_url":"https://api.github.com/repos/hgn/net-applet-shuffler/events","assignees_url":"https://api.github.com/repos/hgn/net-applet-shuffler/assignees{/user}","branches_url":"https://api.github.com/repos/hgn/net-applet-shuffler/branches{/branch}","tags_url":"https://api.github.com/repos/hgn/net-applet-shuffler/tags","blobs_url":"https://api.github.com/repos/hgn/net-applet-shuffler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hgn/net-applet-shuffler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hgn/net-applet-shuffler/git/refs{/sha}","trees_url":"https://api.github.com/repos/hgn/net-applet-shuffler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hgn/net-applet-shuffler/statuses/{sha}","languages_url":"https://api.github.com/repos/hgn/net-applet-shuffler/languages","stargazers_url":"https://api.github.com/repos/hgn/net-applet-shuffler/stargazers","contributors_url":"https://api.github.com/repos/hgn/net-applet-shuffler/contributors","subscribers_url":"https://api.github.com/repos/hgn/net-applet-shuffler/subscribers","subscription_url":"https://api.github.com/repos/hgn/net-applet-shuffler/subscription","commits_url":"https://api.github.com/repos/hgn/net-applet-shuffler/commits{/sha}","git_commits_url":"https://api.github.com/repos/hgn/net-applet-shuffler/git/commits{/sha}","comments_url":"https://api.github.com/repos/hgn/net-applet-shuffler/comments{/number}","issue_comment_url":"https://api.github.com/repos/hgn/net-applet-shuffler/issues/comments{/number}","contents_url":"https://api.github.com/repos/hgn/net-applet-shuffler/contents/{+path}","compare_url":"https://api.github.com/repos/hgn/net-applet-shuffler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hgn/net-applet-shuffler/merges","archive_url":"https://api.github.com/repos/hgn/net-applet-shuffler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hgn/net-applet-shuffler/downloads","issues_url":"https://api.github.com/repos/hgn/net-applet-shuffler/issues{/number}","pulls_url":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls{/number}","milestones_url":"https://api.github.com/repos/hgn/net-applet-shuffler/milestones{/number}","notifications_url":"https://api.github.com/repos/hgn/net-applet-shuffler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hgn/net-applet-shuffler/labels{/name}","releases_url":"https://api.github.com/repos/hgn/net-applet-shuffler/releases{/id}","deployments_url":"https://api.github.com/repos/hgn/net-applet-shuffler/deployments","created_at":"2016-02-15T19:00:41Z","updated_at":"2016-02-17T09:32:55Z","pushed_at":"2016-05-23T07:51:25Z","git_url":"git://github.com/hgn/net-applet-shuffler.git","ssh_url":"git@github.com:hgn/net-applet-shuffler.git","clone_url":"https://github.com/hgn/net-applet-shuffler.git","svn_url":"https://github.com/hgn/net-applet-shuffler","homepage":null,"size":274,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls/29"},"html":{"href":"https://github.com/hgn/net-applet-shuffler/pull/29"},"issue":{"href":"https://api.github.com/repos/hgn/net-applet-shuffler/issues/29"},"comments":{"href":"https://api.github.com/repos/hgn/net-applet-shuffler/issues/29/comments"},"review_comments":{"href":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls/29/comments"},"review_comment":{"href":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hgn/net-applet-shuffler/pulls/29/commits"},"statuses":{"href":"https://api.github.com/repos/hgn/net-applet-shuffler/statuses/a3319e8602a1d26ba1b775c1751310bc0d211131"}}}}
{"actor":{"display_login":"hgn"}}