{"action":"created","comment":{"url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls/comments/23607878","id":23607878,"diff_hunk":"@@ -10,6 +10,7 @@ module Puppet::Parser::Functions\n     raise(Puppet::ParseError, 'mysql_password(): Wrong number of arguments ' +\n       \"given (#{args.size} for 1)\") if args.size != 1\n \n-    '*' + Digest::SHA1.hexdigest(Digest::SHA1.digest(args[0])).upcase\n+    # Return the hash or an empty string for an empty argument\n+    args[0].length > 0 ? '*' + Digest::SHA1.hexdigest(Digest::SHA1.digest(args[0])).upcase : ''","path":"lib/puppet/parser/functions/mysql_password.rb","position":6,"original_position":6,"commit_id":"070a06c6e281eb4b3213218835cb62d632250c22","original_commit_id":"070a06c6e281eb4b3213218835cb62d632250c22","user":{"login":"igalic","id":497249,"avatar_url":"https://avatars.githubusercontent.com/u/497249?v=3","gravatar_id":"","url":"https://api.github.com/users/igalic","html_url":"https://github.com/igalic","followers_url":"https://api.github.com/users/igalic/followers","following_url":"https://api.github.com/users/igalic/following{/other_user}","gists_url":"https://api.github.com/users/igalic/gists{/gist_id}","starred_url":"https://api.github.com/users/igalic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igalic/subscriptions","organizations_url":"https://api.github.com/users/igalic/orgs","repos_url":"https://api.github.com/users/igalic/repos","events_url":"https://api.github.com/users/igalic/events{/privacy}","received_events_url":"https://api.github.com/users/igalic/received_events","type":"User","site_admin":false},"body":"```ruby\r\n  return '' if args[0].empty?\r\n  '*' + Digest::SHA1.hexdigest(Digest::SHA1.digest(args[0])).upcase\r\nend\r\n```\r\nstrikes me as more readable/rubylike.\r\n(and doesn't need a comment to explain what it does ;)","created_at":"2015-01-27T13:44:07Z","updated_at":"2015-01-27T13:44:07Z","html_url":"https://github.com/puppetlabs/puppetlabs-mysql/pull/646#discussion_r23607878","pull_request_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls/646","_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls/comments/23607878"},"html":{"href":"https://github.com/puppetlabs/puppetlabs-mysql/pull/646#discussion_r23607878"},"pull_request":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls/646"}}},"pull_request":{"url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls/646","id":27990955,"html_url":"https://github.com/puppetlabs/puppetlabs-mysql/pull/646","diff_url":"https://github.com/puppetlabs/puppetlabs-mysql/pull/646.diff","patch_url":"https://github.com/puppetlabs/puppetlabs-mysql/pull/646.patch","issue_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/issues/646","number":646,"state":"open","locked":false,"title":"Return an empty string for an empty input.","user":{"login":"dveeden","id":1272980,"avatar_url":"https://avatars.githubusercontent.com/u/1272980?v=3","gravatar_id":"","url":"https://api.github.com/users/dveeden","html_url":"https://github.com/dveeden","followers_url":"https://api.github.com/users/dveeden/followers","following_url":"https://api.github.com/users/dveeden/following{/other_user}","gists_url":"https://api.github.com/users/dveeden/gists{/gist_id}","starred_url":"https://api.github.com/users/dveeden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dveeden/subscriptions","organizations_url":"https://api.github.com/users/dveeden/orgs","repos_url":"https://api.github.com/users/dveeden/repos","events_url":"https://api.github.com/users/dveeden/events{/privacy}","received_events_url":"https://api.github.com/users/dveeden/received_events","type":"User","site_admin":false},"body":"https://tickets.puppetlabs.com/browse/MODULES-1676\r\n\r\nThis is identical to what PASSWORD('') in MySQL does:\r\n\r\n```\r\n5.6.22-debug-log> CREATE USER 'testpwd'@'localhost' IDENTIFIED BY 'foo';\r\nQuery OK, 0 rows affected (0.03 sec)\r\n\r\n5.6.22-debug-log> SELECT User,Host,Password FROM mysql.user WHERE\r\nUser='testpwd';\r\n+---------+-----------+-------------------------------------------+\r\n| User    | Host      | Password                                  |\r\n+---------+-----------+-------------------------------------------+\r\n| testpwd | localhost | *F3A2A51A9B0F2BE2468926B4132313728C250DBF |\r\n+---------+-----------+-------------------------------------------+\r\n1 row in set (0.01 sec)\r\n\r\n5.6.22-debug-log> SET PASSWORD FOR 'testpwd'@'localhost' = PASSWORD('');\r\nQuery OK, 0 rows affected (0.00 sec)\r\n\r\n5.6.22-debug-log> SELECT User,Host,Password FROM mysql.user WHERE\r\nUser='testpwd';\r\n+---------+-----------+----------+\r\n| User    | Host      | Password |\r\n+---------+-----------+----------+\r\n| testpwd | localhost |          |\r\n+---------+-----------+----------+\r\n1 row in set (0.00 sec)\r\n```","created_at":"2015-01-25T11:41:16Z","updated_at":"2015-01-27T13:44:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3eedf32d3159806076fbd158cf2d5d391e34b591","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls/646/commits","review_comments_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls/646/comments","review_comment_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls/comments/{number}","comments_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/issues/646/comments","statuses_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/statuses/070a06c6e281eb4b3213218835cb62d632250c22","head":{"label":"dveeden:emptypwd","ref":"emptypwd","sha":"070a06c6e281eb4b3213218835cb62d632250c22","user":{"login":"dveeden","id":1272980,"avatar_url":"https://avatars.githubusercontent.com/u/1272980?v=3","gravatar_id":"","url":"https://api.github.com/users/dveeden","html_url":"https://github.com/dveeden","followers_url":"https://api.github.com/users/dveeden/followers","following_url":"https://api.github.com/users/dveeden/following{/other_user}","gists_url":"https://api.github.com/users/dveeden/gists{/gist_id}","starred_url":"https://api.github.com/users/dveeden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dveeden/subscriptions","organizations_url":"https://api.github.com/users/dveeden/orgs","repos_url":"https://api.github.com/users/dveeden/repos","events_url":"https://api.github.com/users/dveeden/events{/privacy}","received_events_url":"https://api.github.com/users/dveeden/received_events","type":"User","site_admin":false},"repo":{"id":29060126,"name":"puppetlabs-mysql","full_name":"dveeden/puppetlabs-mysql","owner":{"login":"dveeden","id":1272980,"avatar_url":"https://avatars.githubusercontent.com/u/1272980?v=3","gravatar_id":"","url":"https://api.github.com/users/dveeden","html_url":"https://github.com/dveeden","followers_url":"https://api.github.com/users/dveeden/followers","following_url":"https://api.github.com/users/dveeden/following{/other_user}","gists_url":"https://api.github.com/users/dveeden/gists{/gist_id}","starred_url":"https://api.github.com/users/dveeden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dveeden/subscriptions","organizations_url":"https://api.github.com/users/dveeden/orgs","repos_url":"https://api.github.com/users/dveeden/repos","events_url":"https://api.github.com/users/dveeden/events{/privacy}","received_events_url":"https://api.github.com/users/dveeden/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dveeden/puppetlabs-mysql","description":"MySQL Puppet Module / Manifests + Types & Providers","fork":true,"url":"https://api.github.com/repos/dveeden/puppetlabs-mysql","forks_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/forks","keys_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/teams","hooks_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/hooks","issue_events_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/issues/events{/number}","events_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/events","assignees_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/assignees{/user}","branches_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/branches{/branch}","tags_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/tags","blobs_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/git/refs{/sha}","trees_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/statuses/{sha}","languages_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/languages","stargazers_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/stargazers","contributors_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/contributors","subscribers_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/subscribers","subscription_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/subscription","commits_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/commits{/sha}","git_commits_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/git/commits{/sha}","comments_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/comments{/number}","issue_comment_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/issues/comments/{number}","contents_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/contents/{+path}","compare_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/merges","archive_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/downloads","issues_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/issues{/number}","pulls_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/pulls{/number}","milestones_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/milestones{/number}","notifications_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/labels{/name}","releases_url":"https://api.github.com/repos/dveeden/puppetlabs-mysql/releases{/id}","created_at":"2015-01-10T14:49:44Z","updated_at":"2015-01-26T13:54:05Z","pushed_at":"2015-01-27T13:40:17Z","git_url":"git://github.com/dveeden/puppetlabs-mysql.git","ssh_url":"git@github.com:dveeden/puppetlabs-mysql.git","clone_url":"https://github.com/dveeden/puppetlabs-mysql.git","svn_url":"https://github.com/dveeden/puppetlabs-mysql","homepage":"","size":1203,"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":"06236544384efa27059fe0a1f36bcf81f5797cfc","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":1797486,"name":"puppetlabs-mysql","full_name":"puppetlabs/puppetlabs-mysql","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-mysql","description":"MySQL Puppet Module / Manifests + Types & Providers","fork":false,"url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql","forks_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/forks","keys_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/teams","hooks_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/hooks","issue_events_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/issues/events{/number}","events_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/events","assignees_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/assignees{/user}","branches_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/branches{/branch}","tags_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/tags","blobs_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/git/refs{/sha}","trees_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/statuses/{sha}","languages_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/languages","stargazers_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/stargazers","contributors_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/contributors","subscribers_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/subscribers","subscription_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/subscription","commits_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/commits{/sha}","git_commits_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/git/commits{/sha}","comments_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/comments{/number}","issue_comment_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/issues/comments/{number}","contents_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/contents/{+path}","compare_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/merges","archive_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/downloads","issues_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/issues{/number}","pulls_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls{/number}","milestones_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/milestones{/number}","notifications_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/labels{/name}","releases_url":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/releases{/id}","created_at":"2011-05-25T06:10:41Z","updated_at":"2015-01-27T13:39:41Z","pushed_at":"2015-01-27T13:39:40Z","git_url":"git://github.com/puppetlabs/puppetlabs-mysql.git","ssh_url":"git@github.com:puppetlabs/puppetlabs-mysql.git","clone_url":"https://github.com/puppetlabs/puppetlabs-mysql.git","svn_url":"https://github.com/puppetlabs/puppetlabs-mysql","homepage":"","size":3903,"stargazers_count":333,"watchers_count":333,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":506,"mirror_url":null,"open_issues_count":67,"forks":506,"open_issues":67,"watchers":333,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls/646"},"html":{"href":"https://github.com/puppetlabs/puppetlabs-mysql/pull/646"},"issue":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/issues/646"},"comments":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/issues/646/comments"},"review_comments":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls/646/comments"},"review_comment":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/pulls/646/commits"},"statuses":{"href":"https://api.github.com/repos/puppetlabs/puppetlabs-mysql/statuses/070a06c6e281eb4b3213218835cb62d632250c22"}}}}