{"action":"created","comment":{"url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls/comments/36546215","id":36546215,"diff_hunk":"@@ -0,0 +1,80 @@\n+#! /usr/bin/env ruby\n+require 'spec_helper'\n+require 'puppet/type'\n+require 'puppet/type/base_dsc'\n+require 'fileutils'\n+require 'puppet/file_system'\n+\n+describe Puppet::Type.type(:base_dsc).provider(:powershell), :if => Puppet.features.microsoft_windows? do\n+\n+  # Override initialize so we don't call the symlink set\n+  class Puppet::Type::Base_dsc::ProviderPowershell\n+    def initialize(value={})\n+      super(value)\n+    end\n+  end\n+\n+  let (:resource) { Puppet::Type.type(:base_dsc).new(:provider => :powershell, :name => \"windows_provider\") }\n+  let (:provider) { resource.provider }\n+\n+  let (:top_level_path) do\n+    Dir.mktmpdir('dsc_playground')\n+  end\n+  let (:path) { top_level_path }\n+  let (:program_files) { \"#{path}\\\\Program Files\"}\n+  let (:vendored_modules_symlink_path){ \"#{program_files}\\\\WindowsPowerShell\\\\Modules\\\\PuppetVendoredModules\" }\n+\n+  context \".set_symlink_folder\" do\n+    before :each do\n+      Win32::Registry.any_instance.expects(:[]).with('ProgramFilesDir').returns(program_files).at_most(10)\n+      Puppet::FileSystem.unlink(vendored_modules_symlink_path) if Puppet::FileSystem.symlink?(vendored_modules_symlink_path)\n+      system(\"rmdir /s /q \\\"#{program_files}\\\"\") if ::File.directory?(program_files)\n+      #FileUtils.rm_r(program_files) if ::File.directory?(program_files)","path":"spec/integration/puppet/provider/powershell_spec.rb","position":null,"original_position":32,"commit_id":"9a725fe9aa038bf3a2ebff4cdee59a492fadd54a","original_commit_id":"53c03307546950374a2f8359162fb740cd8399cd","user":{"login":"ferventcoder","id":63502,"avatar_url":"https://avatars.githubusercontent.com/u/63502?v=3","gravatar_id":"","url":"https://api.github.com/users/ferventcoder","html_url":"https://github.com/ferventcoder","followers_url":"https://api.github.com/users/ferventcoder/followers","following_url":"https://api.github.com/users/ferventcoder/following{/other_user}","gists_url":"https://api.github.com/users/ferventcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/ferventcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferventcoder/subscriptions","organizations_url":"https://api.github.com/users/ferventcoder/orgs","repos_url":"https://api.github.com/users/ferventcoder/repos","events_url":"https://api.github.com/users/ferventcoder/events{/privacy}","received_events_url":"https://api.github.com/users/ferventcoder/received_events","type":"User","site_admin":false},"body":"And cleaned up.","created_at":"2015-08-07T18:20:44Z","updated_at":"2015-08-07T18:20:44Z","html_url":"https://github.com/puppetlabs/puppetlabs-dsc/pull/49#discussion_r36546215","pull_request_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls/49","_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls/comments/36546215"},"html":{"href":"https://github.com/puppetlabs/puppetlabs-dsc/pull/49#discussion_r36546215"},"pull_request":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls/49","id":41703159,"html_url":"https://github.com/puppetlabs/puppetlabs-dsc/pull/49","diff_url":"https://github.com/puppetlabs/puppetlabs-dsc/pull/49.diff","patch_url":"https://github.com/puppetlabs/puppetlabs-dsc/pull/49.patch","issue_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/issues/49","number":49,"state":"open","locked":false,"title":"(MODULES-2175) Create vendored symlink with Ruby","user":{"login":"ferventcoder","id":63502,"avatar_url":"https://avatars.githubusercontent.com/u/63502?v=3","gravatar_id":"","url":"https://api.github.com/users/ferventcoder","html_url":"https://github.com/ferventcoder","followers_url":"https://api.github.com/users/ferventcoder/followers","following_url":"https://api.github.com/users/ferventcoder/following{/other_user}","gists_url":"https://api.github.com/users/ferventcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/ferventcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferventcoder/subscriptions","organizations_url":"https://api.github.com/users/ferventcoder/orgs","repos_url":"https://api.github.com/users/ferventcoder/repos","events_url":"https://api.github.com/users/ferventcoder/events{/privacy}","received_events_url":"https://api.github.com/users/ferventcoder/received_events","type":"User","site_admin":false},"body":"Symlinks created the first time during a PowerShell operation don't\r\nalways allow the symlink to be used immediately by PowerShell DSC\r\nduring the same run.\r\n\r\nPrefer instead to create the symlink natively in Ruby. This has\r\nthe advantage that PowerShell modules brought in by the symlink\r\nshould be ready to be used by the time DSC runs.\r\n\r\nPrefer to create the link only once. If the symlink already\r\nexists but points to the wrong location, or if a file/folder\r\nexists where the symlink should be, ensure that the symlink is\r\nrecreated to the proper location.\r\n\r\nWhen determining the path for the symlink, check the registry\r\nwithout redirection to determine where the Program Files\r\ndirectory is located. `C:\\Program Files\\WindowsPowerShell\\Modules`\r\nis the preferred location for Machine-level PowerShell Modules and\r\nthe location where other tools, e.g. PowerShell-Get, also put\r\nmodules during installation.","created_at":"2015-08-05T17:15:45Z","updated_at":"2015-08-07T18:20:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"449ac99dc6ff3b74f75ac5d2613e3d1dfce2ae1e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls/49/commits","review_comments_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls/49/comments","review_comment_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/issues/49/comments","statuses_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/statuses/9a725fe9aa038bf3a2ebff4cdee59a492fadd54a","head":{"label":"ferventcoder:ticket/master/MODULES-2175_symlinks","ref":"ticket/master/MODULES-2175_symlinks","sha":"9a725fe9aa038bf3a2ebff4cdee59a492fadd54a","user":{"login":"ferventcoder","id":63502,"avatar_url":"https://avatars.githubusercontent.com/u/63502?v=3","gravatar_id":"","url":"https://api.github.com/users/ferventcoder","html_url":"https://github.com/ferventcoder","followers_url":"https://api.github.com/users/ferventcoder/followers","following_url":"https://api.github.com/users/ferventcoder/following{/other_user}","gists_url":"https://api.github.com/users/ferventcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/ferventcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferventcoder/subscriptions","organizations_url":"https://api.github.com/users/ferventcoder/orgs","repos_url":"https://api.github.com/users/ferventcoder/repos","events_url":"https://api.github.com/users/ferventcoder/events{/privacy}","received_events_url":"https://api.github.com/users/ferventcoder/received_events","type":"User","site_admin":false},"repo":{"id":24077358,"name":"puppetlabs-dsc","full_name":"ferventcoder/puppetlabs-dsc","owner":{"login":"ferventcoder","id":63502,"avatar_url":"https://avatars.githubusercontent.com/u/63502?v=3","gravatar_id":"","url":"https://api.github.com/users/ferventcoder","html_url":"https://github.com/ferventcoder","followers_url":"https://api.github.com/users/ferventcoder/followers","following_url":"https://api.github.com/users/ferventcoder/following{/other_user}","gists_url":"https://api.github.com/users/ferventcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/ferventcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferventcoder/subscriptions","organizations_url":"https://api.github.com/users/ferventcoder/orgs","repos_url":"https://api.github.com/users/ferventcoder/repos","events_url":"https://api.github.com/users/ferventcoder/events{/privacy}","received_events_url":"https://api.github.com/users/ferventcoder/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ferventcoder/puppetlabs-dsc","description":"Puppet module for PowerShell Desired State Configuration (DSC) integration","fork":true,"url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc","forks_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/forks","keys_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/teams","hooks_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/hooks","issue_events_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/issues/events{/number}","events_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/events","assignees_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/assignees{/user}","branches_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/branches{/branch}","tags_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/tags","blobs_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/git/refs{/sha}","trees_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/statuses/{sha}","languages_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/languages","stargazers_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/stargazers","contributors_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/contributors","subscribers_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/subscribers","subscription_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/subscription","commits_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/commits{/sha}","git_commits_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/git/commits{/sha}","comments_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/comments{/number}","issue_comment_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/issues/comments{/number}","contents_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/contents/{+path}","compare_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/merges","archive_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/downloads","issues_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/issues{/number}","pulls_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/pulls{/number}","milestones_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/milestones{/number}","notifications_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/labels{/name}","releases_url":"https://api.github.com/repos/ferventcoder/puppetlabs-dsc/releases{/id}","created_at":"2014-09-15T23:11:59Z","updated_at":"2015-08-06T17:40:41Z","pushed_at":"2015-08-07T18:20:20Z","git_url":"git://github.com/ferventcoder/puppetlabs-dsc.git","ssh_url":"git@github.com:ferventcoder/puppetlabs-dsc.git","clone_url":"https://github.com/ferventcoder/puppetlabs-dsc.git","svn_url":"https://github.com/ferventcoder/puppetlabs-dsc","homepage":"","size":4974,"stargazers_count":0,"watchers_count":0,"language":"PowerShell","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"puppetlabs:master","ref":"master","sha":"ed3cb513a59824823d1021d499ae5cfbd4fef162","user":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":21090303,"name":"puppetlabs-dsc","full_name":"puppetlabs/puppetlabs-dsc","owner":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/puppetlabs/puppetlabs-dsc","description":"Puppet module for PowerShell Desired State Configuration (DSC) integration","fork":false,"url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc","forks_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/forks","keys_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/teams","hooks_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/hooks","issue_events_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/issues/events{/number}","events_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/events","assignees_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/assignees{/user}","branches_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/branches{/branch}","tags_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/tags","blobs_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/git/refs{/sha}","trees_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/statuses/{sha}","languages_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/languages","stargazers_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/stargazers","contributors_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/contributors","subscribers_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/subscribers","subscription_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/subscription","commits_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/commits{/sha}","git_commits_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/git/commits{/sha}","comments_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/comments{/number}","issue_comment_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/issues/comments{/number}","contents_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/contents/{+path}","compare_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/merges","archive_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/downloads","issues_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/issues{/number}","pulls_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls{/number}","milestones_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/milestones{/number}","notifications_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/labels{/name}","releases_url":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/releases{/id}","created_at":"2014-06-22T09:42:33Z","updated_at":"2015-08-06T15:29:06Z","pushed_at":"2015-08-07T18:20:20Z","git_url":"git://github.com/puppetlabs/puppetlabs-dsc.git","ssh_url":"git@github.com:puppetlabs/puppetlabs-dsc.git","clone_url":"https://github.com/puppetlabs/puppetlabs-dsc.git","svn_url":"https://github.com/puppetlabs/puppetlabs-dsc","homepage":"","size":5784,"stargazers_count":17,"watchers_count":17,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":6,"forks":8,"open_issues":6,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls/49"},"html":{"href":"https://github.com/puppetlabs/puppetlabs-dsc/pull/49"},"issue":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/issues/49"},"comments":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-dsc/statuses/9a725fe9aa038bf3a2ebff4cdee59a492fadd54a"}}}}