{"action":"created","comment":{"url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls/comments/53316530","id":53316530,"diff_hunk":"@@ -0,0 +1,107 @@\n+# standard library imports\n+import base64\n+import os.path\n+\n+# installed libraries imports\n+import winrm\n+\n+# our library imports\n+from cloudify import ctx\n+from cloudify.decorators import operation\n+\n+\n+@operation\n+def run_script(address, username, password, process, local_file_path,\n+               delete_after_running=True, remote_script_path=None, port=5985,\n+               protocol=\"http\", **kwargs):\n+\n+    remote_script_file_name = \"\\\\temp\" + os.path.splitext(local_file_path)[1]\n+\n+    conn = get_conn(protocol, address, password, username, port)\n+\n+    remote_shell_id = get_remote_shell_id(conn)\n+\n+    powershell_path = define_script_path(remote_script_path, False)\n+\n+    encoded_script = create_script_creation_command(\n+            local_file_path, powershell_path, remote_script_file_name)\n+\n+    # copy the script file\n+    ctx.logger.info('Create script file on remote machine')\n+    run_remote_command(remote_shell_id, 'powershell', '-encodedcommand',\n+                       ' ' + encoded_script, conn)\n+\n+    cmd_path = define_script_path(remote_script_path)\n+    ctx.logger.info('Runing the script on remote machine')\n+    run_remote_command(remote_shell_id, process, cmd_path,\n+                       remote_script_file_name, conn)\n+\n+    if delete_after_running:\n+        ctx.logger.info('Removing script file from remote machine')\n+        run_remote_command(remote_shell_id, 'del', cmd_path,\n+                           remote_script_file_name, conn)\n+\n+\n+@operation\n+def run_commands(commands, address, username, password,\n+                 process, port=5985, protocol=\"http\", **kwargs):","path":"winrm_plugin/tasks.py","position":47,"original_position":47,"commit_id":"2810808a5add36ea2d2821a69e660a2b975e4876","original_commit_id":"2810808a5add36ea2d2821a69e660a2b975e4876","user":{"login":"EarthmanT","id":9653571,"avatar_url":"https://avatars.githubusercontent.com/u/9653571?v=3","gravatar_id":"","url":"https://api.github.com/users/EarthmanT","html_url":"https://github.com/EarthmanT","followers_url":"https://api.github.com/users/EarthmanT/followers","following_url":"https://api.github.com/users/EarthmanT/following{/other_user}","gists_url":"https://api.github.com/users/EarthmanT/gists{/gist_id}","starred_url":"https://api.github.com/users/EarthmanT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EarthmanT/subscriptions","organizations_url":"https://api.github.com/users/EarthmanT/orgs","repos_url":"https://api.github.com/users/EarthmanT/repos","events_url":"https://api.github.com/users/EarthmanT/events{/privacy}","received_events_url":"https://api.github.com/users/EarthmanT/received_events","type":"User","site_admin":false},"body":"single quotes","created_at":"2016-02-18T14:01:20Z","updated_at":"2016-02-18T14:01:20Z","html_url":"https://github.com/cloudify-cosmo/cloudify-fabric-plugin/pull/32#discussion_r53316530","pull_request_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls/32","_links":{"self":{"href":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls/comments/53316530"},"html":{"href":"https://github.com/cloudify-cosmo/cloudify-fabric-plugin/pull/32#discussion_r53316530"},"pull_request":{"href":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls/32","id":59763054,"html_url":"https://github.com/cloudify-cosmo/cloudify-fabric-plugin/pull/32","diff_url":"https://github.com/cloudify-cosmo/cloudify-fabric-plugin/pull/32.diff","patch_url":"https://github.com/cloudify-cosmo/cloudify-fabric-plugin/pull/32.patch","issue_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/issues/32","number":32,"state":"open","locked":false,"title":"Cfy 4888 winrm support","user":{"login":"Havivw","id":14999446,"avatar_url":"https://avatars.githubusercontent.com/u/14999446?v=3","gravatar_id":"","url":"https://api.github.com/users/Havivw","html_url":"https://github.com/Havivw","followers_url":"https://api.github.com/users/Havivw/followers","following_url":"https://api.github.com/users/Havivw/following{/other_user}","gists_url":"https://api.github.com/users/Havivw/gists{/gist_id}","starred_url":"https://api.github.com/users/Havivw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Havivw/subscriptions","organizations_url":"https://api.github.com/users/Havivw/orgs","repos_url":"https://api.github.com/users/Havivw/repos","events_url":"https://api.github.com/users/Havivw/events{/privacy}","received_events_url":"https://api.github.com/users/Havivw/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-18T08:01:29Z","updated_at":"2016-02-18T14:01:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ff9bdc72689ae1951e9da12be7612d6aa432783","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls/32/commits","review_comments_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls/32/comments","review_comment_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/issues/32/comments","statuses_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/statuses/2810808a5add36ea2d2821a69e660a2b975e4876","head":{"label":"cloudify-cosmo:CFY-4888-winrm-support","ref":"CFY-4888-winrm-support","sha":"2810808a5add36ea2d2821a69e660a2b975e4876","user":{"login":"cloudify-cosmo","id":6260555,"avatar_url":"https://avatars.githubusercontent.com/u/6260555?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudify-cosmo","html_url":"https://github.com/cloudify-cosmo","followers_url":"https://api.github.com/users/cloudify-cosmo/followers","following_url":"https://api.github.com/users/cloudify-cosmo/following{/other_user}","gists_url":"https://api.github.com/users/cloudify-cosmo/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudify-cosmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudify-cosmo/subscriptions","organizations_url":"https://api.github.com/users/cloudify-cosmo/orgs","repos_url":"https://api.github.com/users/cloudify-cosmo/repos","events_url":"https://api.github.com/users/cloudify-cosmo/events{/privacy}","received_events_url":"https://api.github.com/users/cloudify-cosmo/received_events","type":"Organization","site_admin":false},"repo":{"id":20876193,"name":"cloudify-fabric-plugin","full_name":"cloudify-cosmo/cloudify-fabric-plugin","owner":{"login":"cloudify-cosmo","id":6260555,"avatar_url":"https://avatars.githubusercontent.com/u/6260555?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudify-cosmo","html_url":"https://github.com/cloudify-cosmo","followers_url":"https://api.github.com/users/cloudify-cosmo/followers","following_url":"https://api.github.com/users/cloudify-cosmo/following{/other_user}","gists_url":"https://api.github.com/users/cloudify-cosmo/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudify-cosmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudify-cosmo/subscriptions","organizations_url":"https://api.github.com/users/cloudify-cosmo/orgs","repos_url":"https://api.github.com/users/cloudify-cosmo/repos","events_url":"https://api.github.com/users/cloudify-cosmo/events{/privacy}","received_events_url":"https://api.github.com/users/cloudify-cosmo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudify-cosmo/cloudify-fabric-plugin","description":"For running fabric tasks or commands from the manager","fork":false,"url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin","forks_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/forks","keys_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/teams","hooks_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/hooks","issue_events_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/events","assignees_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/tags","blobs_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/languages","stargazers_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/stargazers","contributors_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/contributors","subscribers_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/subscribers","subscription_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/subscription","commits_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/merges","archive_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/downloads","issues_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/labels{/name}","releases_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/deployments","created_at":"2014-06-16T07:24:15Z","updated_at":"2016-02-02T19:32:36Z","pushed_at":"2016-02-18T12:59:21Z","git_url":"git://github.com/cloudify-cosmo/cloudify-fabric-plugin.git","ssh_url":"git@github.com:cloudify-cosmo/cloudify-fabric-plugin.git","clone_url":"https://github.com/cloudify-cosmo/cloudify-fabric-plugin.git","svn_url":"https://github.com/cloudify-cosmo/cloudify-fabric-plugin","homepage":null,"size":802,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":1,"forks":13,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"cloudify-cosmo:master","ref":"master","sha":"f7d3663563d9b3ac2448b1abba449b486ccca642","user":{"login":"cloudify-cosmo","id":6260555,"avatar_url":"https://avatars.githubusercontent.com/u/6260555?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudify-cosmo","html_url":"https://github.com/cloudify-cosmo","followers_url":"https://api.github.com/users/cloudify-cosmo/followers","following_url":"https://api.github.com/users/cloudify-cosmo/following{/other_user}","gists_url":"https://api.github.com/users/cloudify-cosmo/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudify-cosmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudify-cosmo/subscriptions","organizations_url":"https://api.github.com/users/cloudify-cosmo/orgs","repos_url":"https://api.github.com/users/cloudify-cosmo/repos","events_url":"https://api.github.com/users/cloudify-cosmo/events{/privacy}","received_events_url":"https://api.github.com/users/cloudify-cosmo/received_events","type":"Organization","site_admin":false},"repo":{"id":20876193,"name":"cloudify-fabric-plugin","full_name":"cloudify-cosmo/cloudify-fabric-plugin","owner":{"login":"cloudify-cosmo","id":6260555,"avatar_url":"https://avatars.githubusercontent.com/u/6260555?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudify-cosmo","html_url":"https://github.com/cloudify-cosmo","followers_url":"https://api.github.com/users/cloudify-cosmo/followers","following_url":"https://api.github.com/users/cloudify-cosmo/following{/other_user}","gists_url":"https://api.github.com/users/cloudify-cosmo/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudify-cosmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudify-cosmo/subscriptions","organizations_url":"https://api.github.com/users/cloudify-cosmo/orgs","repos_url":"https://api.github.com/users/cloudify-cosmo/repos","events_url":"https://api.github.com/users/cloudify-cosmo/events{/privacy}","received_events_url":"https://api.github.com/users/cloudify-cosmo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudify-cosmo/cloudify-fabric-plugin","description":"For running fabric tasks or commands from the manager","fork":false,"url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin","forks_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/forks","keys_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/teams","hooks_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/hooks","issue_events_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/events","assignees_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/tags","blobs_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/languages","stargazers_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/stargazers","contributors_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/contributors","subscribers_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/subscribers","subscription_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/subscription","commits_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/merges","archive_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/downloads","issues_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/labels{/name}","releases_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/deployments","created_at":"2014-06-16T07:24:15Z","updated_at":"2016-02-02T19:32:36Z","pushed_at":"2016-02-18T12:59:21Z","git_url":"git://github.com/cloudify-cosmo/cloudify-fabric-plugin.git","ssh_url":"git@github.com:cloudify-cosmo/cloudify-fabric-plugin.git","clone_url":"https://github.com/cloudify-cosmo/cloudify-fabric-plugin.git","svn_url":"https://github.com/cloudify-cosmo/cloudify-fabric-plugin","homepage":null,"size":802,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":1,"forks":13,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls/32"},"html":{"href":"https://github.com/cloudify-cosmo/cloudify-fabric-plugin/pull/32"},"issue":{"href":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/issues/32"},"comments":{"href":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/cloudify-cosmo/cloudify-fabric-plugin/statuses/2810808a5add36ea2d2821a69e660a2b975e4876"}}}}