{"action":"created","issue":{"url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/issues/435","labels_url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/issues/435/labels{/name}","comments_url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/issues/435/comments","events_url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/issues/435/events","html_url":"https://github.com/puppetlabs/puppetlabs-stdlib/pull/435","id":67693951,"number":435,"title":"Added an second argument to getvar for a optional default","user":{"login":"solarkennedy","id":370205,"avatar_url":"https://avatars.githubusercontent.com/u/370205?v=3","gravatar_id":"","url":"https://api.github.com/users/solarkennedy","html_url":"https://github.com/solarkennedy","followers_url":"https://api.github.com/users/solarkennedy/followers","following_url":"https://api.github.com/users/solarkennedy/following{/other_user}","gists_url":"https://api.github.com/users/solarkennedy/gists{/gist_id}","starred_url":"https://api.github.com/users/solarkennedy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solarkennedy/subscriptions","organizations_url":"https://api.github.com/users/solarkennedy/orgs","repos_url":"https://api.github.com/users/solarkennedy/repos","events_url":"https://api.github.com/users/solarkennedy/events{/privacy}","received_events_url":"https://api.github.com/users/solarkennedy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-10T22:12:53Z","updated_at":"2015-04-15T22:58:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/pulls/435","html_url":"https://github.com/puppetlabs/puppetlabs-stdlib/pull/435","diff_url":"https://github.com/puppetlabs/puppetlabs-stdlib/pull/435.diff","patch_url":"https://github.com/puppetlabs/puppetlabs-stdlib/pull/435.patch"},"body":"In a lot of our puppet code we do stuff like this:\r\n\r\n```puppet\r\n$something = getvar('maybe_this_exists')\r\nif $something {\r\n  $something_real = $something\r\n} else {\r\n  $something_real = 'some_default'\r\n}\r\n```\r\n\r\nThis PR makes it so we can say this instead:\r\n```puppet\r\n$something = getvar('maybe_this_exists', 'some_default')\r\n```\r\n\r\nThis mimics the python behavior (which I like) \r\nhttps://docs.python.org/2/library/stdtypes.html#dict.get\r\n\r\nI'm pretty sure I got the tests right?\r\n\r\ncc @hashbrowncipher @bobtfish "},"comment":{"url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/issues/comments/93592063","html_url":"https://github.com/puppetlabs/puppetlabs-stdlib/pull/435#issuecomment-93592063","issue_url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/issues/435","id":93592063,"user":{"login":"solarkennedy","id":370205,"avatar_url":"https://avatars.githubusercontent.com/u/370205?v=3","gravatar_id":"","url":"https://api.github.com/users/solarkennedy","html_url":"https://github.com/solarkennedy","followers_url":"https://api.github.com/users/solarkennedy/followers","following_url":"https://api.github.com/users/solarkennedy/following{/other_user}","gists_url":"https://api.github.com/users/solarkennedy/gists{/gist_id}","starred_url":"https://api.github.com/users/solarkennedy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solarkennedy/subscriptions","organizations_url":"https://api.github.com/users/solarkennedy/orgs","repos_url":"https://api.github.com/users/solarkennedy/repos","events_url":"https://api.github.com/users/solarkennedy/events{/privacy}","received_events_url":"https://api.github.com/users/solarkennedy/received_events","type":"User","site_admin":false},"created_at":"2015-04-15T22:58:58Z","updated_at":"2015-04-15T22:58:58Z","body":"Ok. How about now?"}}