{"action":"created","comment":{"url":"https://api.github.com/repos/chef/chef/pulls/comments/46223219","id":46223219,"diff_hunk":"@@ -0,0 +1,255 @@\n+#\n+# Author:: Nate Walck (<nate.walck@gmail.com>)\n+# Copyright:: Copyright (c) 2015 Facebook, Inc.\n+# License:: Apache License, Version 2.0\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# 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+\n+require 'chef/log'\n+require 'chef/provider'\n+require 'chef/resource'\n+require 'chef/resource/file'\n+require 'uuidtools'\n+\n+class Chef\n+  class Provider\n+    class OsxProfile < Chef::Provider\n+      include Chef::Mixin::Command\n+      provides :osx_profile, os: \"darwin\"\n+      provides :osx_config_profile, os: \"darwin\"\n+\n+      def whyrun_supported?\n+        true\n+      end\n+\n+      def load_current_resource\n+        @current_resource = Chef::Resource::OsxProfile.new(@new_resource.name)\n+        @current_resource.profile_name(@new_resource.profile_name)\n+\n+        all_profiles = get_installed_profiles\n+        @new_resource.profile(\n+          @new_resource.profile ||\n+          @new_resource.profile_name\n+        )\n+\n+        @new_profile_hash = get_profile_hash(@new_resource.profile)\n+        @new_profile_hash['PayloadUUID'] =\n+          config_uuid(@new_profile_hash) if @new_profile_hash\n+\n+        if @new_profile_hash\n+          @new_profile_identifier = @new_profile_hash['PayloadIdentifier']\n+        else\n+          @new_profile_identifier = @new_resource.identifier ||\n+          @new_resource.profile_name\n+        end\n+\n+        current_profile = all_profiles['_computerlevel'].find {\n+          |item| item['ProfileIdentifier'] ==\n+             @new_profile_identifier\n+        }\n+        @current_resource.profile(current_profile)\n+\n+        @current_resource.installed(profile_installed?)","path":"lib/chef/provider/osx_profile.rb","position":63,"original_position":63,"commit_id":"465a4510b4c96b599a7760da546a10ba126b612f","original_commit_id":"465a4510b4c96b599a7760da546a10ba126b612f","user":{"login":"lamont-granquist","id":454857,"avatar_url":"https://avatars.githubusercontent.com/u/454857?v=3","gravatar_id":"","url":"https://api.github.com/users/lamont-granquist","html_url":"https://github.com/lamont-granquist","followers_url":"https://api.github.com/users/lamont-granquist/followers","following_url":"https://api.github.com/users/lamont-granquist/following{/other_user}","gists_url":"https://api.github.com/users/lamont-granquist/gists{/gist_id}","starred_url":"https://api.github.com/users/lamont-granquist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lamont-granquist/subscriptions","organizations_url":"https://api.github.com/users/lamont-granquist/orgs","repos_url":"https://api.github.com/users/lamont-granquist/repos","events_url":"https://api.github.com/users/lamont-granquist/events{/privacy}","received_events_url":"https://api.github.com/users/lamont-granquist/received_events","type":"User","site_admin":false},"body":"following up on the other comment in the resource.  this property on the resource needs to be deleted.   and just use `profile_installed?` directly.  you're not even setting the new_resource value so reporting is going to get the wrong values and round tripping state from the provider through the current_resource back to the provider again isn't useful.","created_at":"2015-12-01T00:01:21Z","updated_at":"2015-12-01T00:01:21Z","html_url":"https://github.com/chef/chef/pull/4078#discussion_r46223219","pull_request_url":"https://api.github.com/repos/chef/chef/pulls/4078","_links":{"self":{"href":"https://api.github.com/repos/chef/chef/pulls/comments/46223219"},"html":{"href":"https://github.com/chef/chef/pull/4078#discussion_r46223219"},"pull_request":{"href":"https://api.github.com/repos/chef/chef/pulls/4078"}}},"pull_request":{"url":"https://api.github.com/repos/chef/chef/pulls/4078","id":48262712,"html_url":"https://github.com/chef/chef/pull/4078","diff_url":"https://github.com/chef/chef/pull/4078.diff","patch_url":"https://github.com/chef/chef/pull/4078.patch","issue_url":"https://api.github.com/repos/chef/chef/issues/4078","number":4078,"state":"open","locked":false,"title":"Added profile provider for OS X","user":{"login":"natewalck","id":867868,"avatar_url":"https://avatars.githubusercontent.com/u/867868?v=3","gravatar_id":"","url":"https://api.github.com/users/natewalck","html_url":"https://github.com/natewalck","followers_url":"https://api.github.com/users/natewalck/followers","following_url":"https://api.github.com/users/natewalck/following{/other_user}","gists_url":"https://api.github.com/users/natewalck/gists{/gist_id}","starred_url":"https://api.github.com/users/natewalck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natewalck/subscriptions","organizations_url":"https://api.github.com/users/natewalck/orgs","repos_url":"https://api.github.com/users/natewalck/repos","events_url":"https://api.github.com/users/natewalck/events{/privacy}","received_events_url":"https://api.github.com/users/natewalck/received_events","type":"User","site_admin":false},"body":"New provider to install configuration profiles on OS X. \r\n\r\nOnce fully reviewed and approved, @jaymzh will merge the changes under his CLA.","created_at":"2015-10-20T21:48:55Z","updated_at":"2015-12-01T00:01:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bbe940cf75b46cc125391066ef665668fb069b22","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/chef/chef/pulls/4078/commits","review_comments_url":"https://api.github.com/repos/chef/chef/pulls/4078/comments","review_comment_url":"https://api.github.com/repos/chef/chef/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chef/chef/issues/4078/comments","statuses_url":"https://api.github.com/repos/chef/chef/statuses/465a4510b4c96b599a7760da546a10ba126b612f","head":{"label":"natewalck:profiles","ref":"profiles","sha":"465a4510b4c96b599a7760da546a10ba126b612f","user":{"login":"natewalck","id":867868,"avatar_url":"https://avatars.githubusercontent.com/u/867868?v=3","gravatar_id":"","url":"https://api.github.com/users/natewalck","html_url":"https://github.com/natewalck","followers_url":"https://api.github.com/users/natewalck/followers","following_url":"https://api.github.com/users/natewalck/following{/other_user}","gists_url":"https://api.github.com/users/natewalck/gists{/gist_id}","starred_url":"https://api.github.com/users/natewalck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natewalck/subscriptions","organizations_url":"https://api.github.com/users/natewalck/orgs","repos_url":"https://api.github.com/users/natewalck/repos","events_url":"https://api.github.com/users/natewalck/events{/privacy}","received_events_url":"https://api.github.com/users/natewalck/received_events","type":"User","site_admin":false},"repo":{"id":38067161,"name":"chef","full_name":"natewalck/chef","owner":{"login":"natewalck","id":867868,"avatar_url":"https://avatars.githubusercontent.com/u/867868?v=3","gravatar_id":"","url":"https://api.github.com/users/natewalck","html_url":"https://github.com/natewalck","followers_url":"https://api.github.com/users/natewalck/followers","following_url":"https://api.github.com/users/natewalck/following{/other_user}","gists_url":"https://api.github.com/users/natewalck/gists{/gist_id}","starred_url":"https://api.github.com/users/natewalck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natewalck/subscriptions","organizations_url":"https://api.github.com/users/natewalck/orgs","repos_url":"https://api.github.com/users/natewalck/repos","events_url":"https://api.github.com/users/natewalck/events{/privacy}","received_events_url":"https://api.github.com/users/natewalck/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/natewalck/chef","description":"A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.","fork":true,"url":"https://api.github.com/repos/natewalck/chef","forks_url":"https://api.github.com/repos/natewalck/chef/forks","keys_url":"https://api.github.com/repos/natewalck/chef/keys{/key_id}","collaborators_url":"https://api.github.com/repos/natewalck/chef/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/natewalck/chef/teams","hooks_url":"https://api.github.com/repos/natewalck/chef/hooks","issue_events_url":"https://api.github.com/repos/natewalck/chef/issues/events{/number}","events_url":"https://api.github.com/repos/natewalck/chef/events","assignees_url":"https://api.github.com/repos/natewalck/chef/assignees{/user}","branches_url":"https://api.github.com/repos/natewalck/chef/branches{/branch}","tags_url":"https://api.github.com/repos/natewalck/chef/tags","blobs_url":"https://api.github.com/repos/natewalck/chef/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/natewalck/chef/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/natewalck/chef/git/refs{/sha}","trees_url":"https://api.github.com/repos/natewalck/chef/git/trees{/sha}","statuses_url":"https://api.github.com/repos/natewalck/chef/statuses/{sha}","languages_url":"https://api.github.com/repos/natewalck/chef/languages","stargazers_url":"https://api.github.com/repos/natewalck/chef/stargazers","contributors_url":"https://api.github.com/repos/natewalck/chef/contributors","subscribers_url":"https://api.github.com/repos/natewalck/chef/subscribers","subscription_url":"https://api.github.com/repos/natewalck/chef/subscription","commits_url":"https://api.github.com/repos/natewalck/chef/commits{/sha}","git_commits_url":"https://api.github.com/repos/natewalck/chef/git/commits{/sha}","comments_url":"https://api.github.com/repos/natewalck/chef/comments{/number}","issue_comment_url":"https://api.github.com/repos/natewalck/chef/issues/comments{/number}","contents_url":"https://api.github.com/repos/natewalck/chef/contents/{+path}","compare_url":"https://api.github.com/repos/natewalck/chef/compare/{base}...{head}","merges_url":"https://api.github.com/repos/natewalck/chef/merges","archive_url":"https://api.github.com/repos/natewalck/chef/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/natewalck/chef/downloads","issues_url":"https://api.github.com/repos/natewalck/chef/issues{/number}","pulls_url":"https://api.github.com/repos/natewalck/chef/pulls{/number}","milestones_url":"https://api.github.com/repos/natewalck/chef/milestones{/number}","notifications_url":"https://api.github.com/repos/natewalck/chef/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/natewalck/chef/labels{/name}","releases_url":"https://api.github.com/repos/natewalck/chef/releases{/id}","created_at":"2015-06-25T18:40:20Z","updated_at":"2015-06-25T18:40:28Z","pushed_at":"2015-11-18T17:57:49Z","git_url":"git://github.com/natewalck/chef.git","ssh_url":"git@github.com:natewalck/chef.git","clone_url":"https://github.com/natewalck/chef.git","svn_url":"https://github.com/natewalck/chef","homepage":"http://www.chef.io/chef/","size":81900,"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":"chef:master","ref":"master","sha":"d42285ad34b3991842b1866fbbb3511465f054bc","user":{"login":"chef","id":29740,"avatar_url":"https://avatars.githubusercontent.com/u/29740?v=3","gravatar_id":"","url":"https://api.github.com/users/chef","html_url":"https://github.com/chef","followers_url":"https://api.github.com/users/chef/followers","following_url":"https://api.github.com/users/chef/following{/other_user}","gists_url":"https://api.github.com/users/chef/gists{/gist_id}","starred_url":"https://api.github.com/users/chef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chef/subscriptions","organizations_url":"https://api.github.com/users/chef/orgs","repos_url":"https://api.github.com/users/chef/repos","events_url":"https://api.github.com/users/chef/events{/privacy}","received_events_url":"https://api.github.com/users/chef/received_events","type":"Organization","site_admin":false},"repo":{"id":108278,"name":"chef","full_name":"chef/chef","owner":{"login":"chef","id":29740,"avatar_url":"https://avatars.githubusercontent.com/u/29740?v=3","gravatar_id":"","url":"https://api.github.com/users/chef","html_url":"https://github.com/chef","followers_url":"https://api.github.com/users/chef/followers","following_url":"https://api.github.com/users/chef/following{/other_user}","gists_url":"https://api.github.com/users/chef/gists{/gist_id}","starred_url":"https://api.github.com/users/chef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chef/subscriptions","organizations_url":"https://api.github.com/users/chef/orgs","repos_url":"https://api.github.com/users/chef/repos","events_url":"https://api.github.com/users/chef/events{/privacy}","received_events_url":"https://api.github.com/users/chef/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chef/chef","description":"A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.","fork":false,"url":"https://api.github.com/repos/chef/chef","forks_url":"https://api.github.com/repos/chef/chef/forks","keys_url":"https://api.github.com/repos/chef/chef/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chef/chef/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chef/chef/teams","hooks_url":"https://api.github.com/repos/chef/chef/hooks","issue_events_url":"https://api.github.com/repos/chef/chef/issues/events{/number}","events_url":"https://api.github.com/repos/chef/chef/events","assignees_url":"https://api.github.com/repos/chef/chef/assignees{/user}","branches_url":"https://api.github.com/repos/chef/chef/branches{/branch}","tags_url":"https://api.github.com/repos/chef/chef/tags","blobs_url":"https://api.github.com/repos/chef/chef/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chef/chef/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chef/chef/git/refs{/sha}","trees_url":"https://api.github.com/repos/chef/chef/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chef/chef/statuses/{sha}","languages_url":"https://api.github.com/repos/chef/chef/languages","stargazers_url":"https://api.github.com/repos/chef/chef/stargazers","contributors_url":"https://api.github.com/repos/chef/chef/contributors","subscribers_url":"https://api.github.com/repos/chef/chef/subscribers","subscription_url":"https://api.github.com/repos/chef/chef/subscription","commits_url":"https://api.github.com/repos/chef/chef/commits{/sha}","git_commits_url":"https://api.github.com/repos/chef/chef/git/commits{/sha}","comments_url":"https://api.github.com/repos/chef/chef/comments{/number}","issue_comment_url":"https://api.github.com/repos/chef/chef/issues/comments{/number}","contents_url":"https://api.github.com/repos/chef/chef/contents/{+path}","compare_url":"https://api.github.com/repos/chef/chef/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chef/chef/merges","archive_url":"https://api.github.com/repos/chef/chef/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chef/chef/downloads","issues_url":"https://api.github.com/repos/chef/chef/issues{/number}","pulls_url":"https://api.github.com/repos/chef/chef/pulls{/number}","milestones_url":"https://api.github.com/repos/chef/chef/milestones{/number}","notifications_url":"https://api.github.com/repos/chef/chef/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chef/chef/labels{/name}","releases_url":"https://api.github.com/repos/chef/chef/releases{/id}","created_at":"2009-01-15T20:40:48Z","updated_at":"2015-11-30T22:20:31Z","pushed_at":"2015-11-30T23:12:46Z","git_url":"git://github.com/chef/chef.git","ssh_url":"git@github.com:chef/chef.git","clone_url":"https://github.com/chef/chef.git","svn_url":"https://github.com/chef/chef","homepage":"http://www.chef.io/chef/","size":94748,"stargazers_count":3928,"watchers_count":3928,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1618,"mirror_url":null,"open_issues_count":406,"forks":1618,"open_issues":406,"watchers":3928,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chef/chef/pulls/4078"},"html":{"href":"https://github.com/chef/chef/pull/4078"},"issue":{"href":"https://api.github.com/repos/chef/chef/issues/4078"},"comments":{"href":"https://api.github.com/repos/chef/chef/issues/4078/comments"},"review_comments":{"href":"https://api.github.com/repos/chef/chef/pulls/4078/comments"},"review_comment":{"href":"https://api.github.com/repos/chef/chef/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chef/chef/pulls/4078/commits"},"statuses":{"href":"https://api.github.com/repos/chef/chef/statuses/465a4510b4c96b599a7760da546a10ba126b612f"}}}}