{"action":"created","comment":{"url":"https://api.github.com/repos/puppetlabs/puppet/pulls/comments/28347265","id":28347265,"diff_hunk":"@@ -1528,4 +1528,161 @@ def pretty_transaction_error(transaction)\n \n     raise \"Got #{status_failures.length} failure(s) while applying: #{status_fail_msg}\"\n   end\n+\n+  describe \"copying a file that is a link to a file\" do\n+    let(:target) { tmpfile('target') }\n+    let(:link) { tmpfile('link') }\n+    let(:copy) { tmpfile('copy') }\n+    it \"should copy the target of the link if :links => follow\" do\n+      catalog.add_resource described_class.new(\n+        :name => target,\n+        :ensure => \"present\",\n+        :content => \"Jenny I got your number / I need to make you mine\")\n+      catalog.add_resource described_class.new(\n+        :name => link,\n+        :ensure => \"link\",\n+        :target => target)\n+      catalog.add_resource described_class.new(\n+        :name => copy,\n+        :ensure => \"present\",\n+        :source => link,\n+        :links => \"follow\")\n+      catalog.apply\n+      expect(File.ftype(target)).to eq(File.ftype(copy))","path":"spec/integration/type/file_spec.rb","position":24,"original_position":24,"commit_id":"caa496ecaca852c99c594789b07b8d0c3b169e33","original_commit_id":"caa496ecaca852c99c594789b07b8d0c3b169e33","user":{"login":"joshcooper","id":737664,"avatar_url":"https://avatars.githubusercontent.com/u/737664?v=3","gravatar_id":"","url":"https://api.github.com/users/joshcooper","html_url":"https://github.com/joshcooper","followers_url":"https://api.github.com/users/joshcooper/followers","following_url":"https://api.github.com/users/joshcooper/following{/other_user}","gists_url":"https://api.github.com/users/joshcooper/gists{/gist_id}","starred_url":"https://api.github.com/users/joshcooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshcooper/subscriptions","organizations_url":"https://api.github.com/users/joshcooper/orgs","repos_url":"https://api.github.com/users/joshcooper/repos","events_url":"https://api.github.com/users/joshcooper/events{/privacy}","received_events_url":"https://api.github.com/users/joshcooper/received_events","type":"User","site_admin":false},"body":"Yep, `File.ftype` on Windows works for files and directories, but not symlinks on systems that support them:\r\n\r\n```\r\nC:\\work\\puppet> bundle exec puppet resource file C:\\work\\puppet\\link ensure=link target=c:\\work\\puppet\\target\r\nNotice: /File[C:\\work\\puppet\\link]/ensure: created\r\nfile { 'C:\\work\\puppet\\link':\r\n  ensure => 'link',\r\n  target => 'c:\\work\\puppet\\target',\r\n}\r\nC:\\work\\puppet> bundle exec irb\r\nirb(main):001:0> File.ftype('c:\\work\\puppet\\link')\r\n=> \"file\"\r\nirb(main):002:0> require 'puppet'\r\n=> true\r\nirb(main):003:0> Puppet::FileSystem.symlink?('c:\\work\\puppet\\link')\r\n=> true\r\n```\r\n\r\nAnd actually a better way of doing this would be to use:\r\n\r\n```\r\nirb(main):008:0> Puppet::FileSystem.lstat('c:\\work\\puppet\\link').ftype\r\n=> \"link\"\r\n```","created_at":"2015-04-14T17:07:38Z","updated_at":"2015-04-14T17:07:38Z","html_url":"https://github.com/puppetlabs/puppet/pull/3806#discussion_r28347265","pull_request_url":"https://api.github.com/repos/puppetlabs/puppet/pulls/3806","_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/comments/28347265"},"html":{"href":"https://github.com/puppetlabs/puppet/pull/3806#discussion_r28347265"},"pull_request":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/3806"}}},"pull_request":{"url":"https://api.github.com/repos/puppetlabs/puppet/pulls/3806","id":33006758,"html_url":"https://github.com/puppetlabs/puppet/pull/3806","diff_url":"https://github.com/puppetlabs/puppet/pull/3806.diff","patch_url":"https://github.com/puppetlabs/puppet/pull/3806.patch","issue_url":"https://api.github.com/repos/puppetlabs/puppet/issues/3806","number":3806,"state":"open","locked":false,"title":"(PUP-4343) Add test(s) for file resource links attribute","user":{"login":"kurtwall","id":5178160,"avatar_url":"https://avatars.githubusercontent.com/u/5178160?v=3","gravatar_id":"","url":"https://api.github.com/users/kurtwall","html_url":"https://github.com/kurtwall","followers_url":"https://api.github.com/users/kurtwall/followers","following_url":"https://api.github.com/users/kurtwall/following{/other_user}","gists_url":"https://api.github.com/users/kurtwall/gists{/gist_id}","starred_url":"https://api.github.com/users/kurtwall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kurtwall/subscriptions","organizations_url":"https://api.github.com/users/kurtwall/orgs","repos_url":"https://api.github.com/users/kurtwall/repos","events_url":"https://api.github.com/users/kurtwall/events{/privacy}","received_events_url":"https://api.github.com/users/kurtwall/received_events","type":"User","site_admin":false},"body":"The File resource is unevenly tested in acceptance and spec. This adds tests for the links attribute.","created_at":"2015-04-09T23:37:43Z","updated_at":"2015-04-14T17:07:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"162fae632afc5ea0c20649862d4f924f77540030","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/puppetlabs/puppet/pulls/3806/commits","review_comments_url":"https://api.github.com/repos/puppetlabs/puppet/pulls/3806/comments","review_comment_url":"https://api.github.com/repos/puppetlabs/puppet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/puppetlabs/puppet/issues/3806/comments","statuses_url":"https://api.github.com/repos/puppetlabs/puppet/statuses/caa496ecaca852c99c594789b07b8d0c3b169e33","head":{"label":"kurtwall:PUP-4343","ref":"PUP-4343","sha":"caa496ecaca852c99c594789b07b8d0c3b169e33","user":{"login":"kurtwall","id":5178160,"avatar_url":"https://avatars.githubusercontent.com/u/5178160?v=3","gravatar_id":"","url":"https://api.github.com/users/kurtwall","html_url":"https://github.com/kurtwall","followers_url":"https://api.github.com/users/kurtwall/followers","following_url":"https://api.github.com/users/kurtwall/following{/other_user}","gists_url":"https://api.github.com/users/kurtwall/gists{/gist_id}","starred_url":"https://api.github.com/users/kurtwall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kurtwall/subscriptions","organizations_url":"https://api.github.com/users/kurtwall/orgs","repos_url":"https://api.github.com/users/kurtwall/repos","events_url":"https://api.github.com/users/kurtwall/events{/privacy}","received_events_url":"https://api.github.com/users/kurtwall/received_events","type":"User","site_admin":false},"repo":{"id":33679696,"name":"puppet","full_name":"kurtwall/puppet","owner":{"login":"kurtwall","id":5178160,"avatar_url":"https://avatars.githubusercontent.com/u/5178160?v=3","gravatar_id":"","url":"https://api.github.com/users/kurtwall","html_url":"https://github.com/kurtwall","followers_url":"https://api.github.com/users/kurtwall/followers","following_url":"https://api.github.com/users/kurtwall/following{/other_user}","gists_url":"https://api.github.com/users/kurtwall/gists{/gist_id}","starred_url":"https://api.github.com/users/kurtwall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kurtwall/subscriptions","organizations_url":"https://api.github.com/users/kurtwall/orgs","repos_url":"https://api.github.com/users/kurtwall/repos","events_url":"https://api.github.com/users/kurtwall/events{/privacy}","received_events_url":"https://api.github.com/users/kurtwall/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kurtwall/puppet","description":"Server automation framework and application","fork":true,"url":"https://api.github.com/repos/kurtwall/puppet","forks_url":"https://api.github.com/repos/kurtwall/puppet/forks","keys_url":"https://api.github.com/repos/kurtwall/puppet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kurtwall/puppet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kurtwall/puppet/teams","hooks_url":"https://api.github.com/repos/kurtwall/puppet/hooks","issue_events_url":"https://api.github.com/repos/kurtwall/puppet/issues/events{/number}","events_url":"https://api.github.com/repos/kurtwall/puppet/events","assignees_url":"https://api.github.com/repos/kurtwall/puppet/assignees{/user}","branches_url":"https://api.github.com/repos/kurtwall/puppet/branches{/branch}","tags_url":"https://api.github.com/repos/kurtwall/puppet/tags","blobs_url":"https://api.github.com/repos/kurtwall/puppet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kurtwall/puppet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kurtwall/puppet/git/refs{/sha}","trees_url":"https://api.github.com/repos/kurtwall/puppet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kurtwall/puppet/statuses/{sha}","languages_url":"https://api.github.com/repos/kurtwall/puppet/languages","stargazers_url":"https://api.github.com/repos/kurtwall/puppet/stargazers","contributors_url":"https://api.github.com/repos/kurtwall/puppet/contributors","subscribers_url":"https://api.github.com/repos/kurtwall/puppet/subscribers","subscription_url":"https://api.github.com/repos/kurtwall/puppet/subscription","commits_url":"https://api.github.com/repos/kurtwall/puppet/commits{/sha}","git_commits_url":"https://api.github.com/repos/kurtwall/puppet/git/commits{/sha}","comments_url":"https://api.github.com/repos/kurtwall/puppet/comments{/number}","issue_comment_url":"https://api.github.com/repos/kurtwall/puppet/issues/comments{/number}","contents_url":"https://api.github.com/repos/kurtwall/puppet/contents/{+path}","compare_url":"https://api.github.com/repos/kurtwall/puppet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kurtwall/puppet/merges","archive_url":"https://api.github.com/repos/kurtwall/puppet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kurtwall/puppet/downloads","issues_url":"https://api.github.com/repos/kurtwall/puppet/issues{/number}","pulls_url":"https://api.github.com/repos/kurtwall/puppet/pulls{/number}","milestones_url":"https://api.github.com/repos/kurtwall/puppet/milestones{/number}","notifications_url":"https://api.github.com/repos/kurtwall/puppet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kurtwall/puppet/labels{/name}","releases_url":"https://api.github.com/repos/kurtwall/puppet/releases{/id}","created_at":"2015-04-09T16:22:04Z","updated_at":"2015-04-09T16:22:16Z","pushed_at":"2015-04-09T23:00:04Z","git_url":"git://github.com/kurtwall/puppet.git","ssh_url":"git@github.com:kurtwall/puppet.git","clone_url":"https://github.com/kurtwall/puppet.git","svn_url":"https://github.com/kurtwall/puppet","homepage":"http://www.puppetlabs.com/puppet/introduction/","size":46650,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"puppetlabs:master","ref":"master","sha":"d2fdb63ad03513451c7fb4eabc1fd967a5cecd2e","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":910744,"name":"puppet","full_name":"puppetlabs/puppet","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/puppet","description":"Server automation framework and application","fork":false,"url":"https://api.github.com/repos/puppetlabs/puppet","forks_url":"https://api.github.com/repos/puppetlabs/puppet/forks","keys_url":"https://api.github.com/repos/puppetlabs/puppet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/puppetlabs/puppet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/puppetlabs/puppet/teams","hooks_url":"https://api.github.com/repos/puppetlabs/puppet/hooks","issue_events_url":"https://api.github.com/repos/puppetlabs/puppet/issues/events{/number}","events_url":"https://api.github.com/repos/puppetlabs/puppet/events","assignees_url":"https://api.github.com/repos/puppetlabs/puppet/assignees{/user}","branches_url":"https://api.github.com/repos/puppetlabs/puppet/branches{/branch}","tags_url":"https://api.github.com/repos/puppetlabs/puppet/tags","blobs_url":"https://api.github.com/repos/puppetlabs/puppet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/puppetlabs/puppet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/puppetlabs/puppet/git/refs{/sha}","trees_url":"https://api.github.com/repos/puppetlabs/puppet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/puppetlabs/puppet/statuses/{sha}","languages_url":"https://api.github.com/repos/puppetlabs/puppet/languages","stargazers_url":"https://api.github.com/repos/puppetlabs/puppet/stargazers","contributors_url":"https://api.github.com/repos/puppetlabs/puppet/contributors","subscribers_url":"https://api.github.com/repos/puppetlabs/puppet/subscribers","subscription_url":"https://api.github.com/repos/puppetlabs/puppet/subscription","commits_url":"https://api.github.com/repos/puppetlabs/puppet/commits{/sha}","git_commits_url":"https://api.github.com/repos/puppetlabs/puppet/git/commits{/sha}","comments_url":"https://api.github.com/repos/puppetlabs/puppet/comments{/number}","issue_comment_url":"https://api.github.com/repos/puppetlabs/puppet/issues/comments{/number}","contents_url":"https://api.github.com/repos/puppetlabs/puppet/contents/{+path}","compare_url":"https://api.github.com/repos/puppetlabs/puppet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/puppetlabs/puppet/merges","archive_url":"https://api.github.com/repos/puppetlabs/puppet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/puppetlabs/puppet/downloads","issues_url":"https://api.github.com/repos/puppetlabs/puppet/issues{/number}","pulls_url":"https://api.github.com/repos/puppetlabs/puppet/pulls{/number}","milestones_url":"https://api.github.com/repos/puppetlabs/puppet/milestones{/number}","notifications_url":"https://api.github.com/repos/puppetlabs/puppet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/puppetlabs/puppet/labels{/name}","releases_url":"https://api.github.com/repos/puppetlabs/puppet/releases{/id}","created_at":"2010-09-14T19:26:44Z","updated_at":"2015-04-14T14:07:19Z","pushed_at":"2015-04-14T14:36:20Z","git_url":"git://github.com/puppetlabs/puppet.git","ssh_url":"git@github.com:puppetlabs/puppet.git","clone_url":"https://github.com/puppetlabs/puppet.git","svn_url":"https://github.com/puppetlabs/puppet","homepage":"http://www.puppetlabs.com/puppet/introduction/","size":111798,"stargazers_count":3166,"watchers_count":3166,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1342,"mirror_url":null,"open_issues_count":40,"forks":1342,"open_issues":40,"watchers":3166,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/3806"},"html":{"href":"https://github.com/puppetlabs/puppet/pull/3806"},"issue":{"href":"https://api.github.com/repos/puppetlabs/puppet/issues/3806"},"comments":{"href":"https://api.github.com/repos/puppetlabs/puppet/issues/3806/comments"},"review_comments":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/3806/comments"},"review_comment":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/3806/commits"},"statuses":{"href":"https://api.github.com/repos/puppetlabs/puppet/statuses/caa496ecaca852c99c594789b07b8d0c3b169e33"}}}}