{"action":"created","issue":{"url":"https://api.github.com/repos/zuazo/ssh_authorized_keys-cookbook/issues/9","repository_url":"https://api.github.com/repos/zuazo/ssh_authorized_keys-cookbook","labels_url":"https://api.github.com/repos/zuazo/ssh_authorized_keys-cookbook/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/zuazo/ssh_authorized_keys-cookbook/issues/9/comments","events_url":"https://api.github.com/repos/zuazo/ssh_authorized_keys-cookbook/issues/9/events","html_url":"https://github.com/zuazo/ssh_authorized_keys-cookbook/issues/9","id":181906896,"number":9,"title":"User cannot be lazily evaluated","user":{"login":"cdown","id":660663,"avatar_url":"https://avatars.githubusercontent.com/u/660663?v=3","gravatar_id":"","url":"https://api.github.com/users/cdown","html_url":"https://github.com/cdown","followers_url":"https://api.github.com/users/cdown/followers","following_url":"https://api.github.com/users/cdown/following{/other_user}","gists_url":"https://api.github.com/users/cdown/gists{/gist_id}","starred_url":"https://api.github.com/users/cdown/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdown/subscriptions","organizations_url":"https://api.github.com/users/cdown/orgs","repos_url":"https://api.github.com/users/cdown/repos","events_url":"https://api.github.com/users/cdown/events{/privacy}","received_events_url":"https://api.github.com/users/cdown/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/zuazo/ssh_authorized_keys-cookbook/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-09T19:50:40Z","updated_at":"2016-10-09T20:11:39Z","closed_at":null,"body":"When trying to evaluate a user which is a delayed resource, checks fail -- this check should be skipped if the user is being lazily evaluated:\r\n\r\nFor example:\r\n\r\n```\r\nssh_authorize_key 'Main user' do\r\n  user lazy { node['seedbox']['user'] }\r\n  key lazy { node['seedbox']['user_ssh_pubkey'] }\r\nend\r\n```\r\nresults in\r\n\r\n```\r\n==> default: ================================================================================\r\n==> default: Recipe Compile Error in /var/chef/cache/cookbooks/seedbox/recipes/default.rb\r\n==> default: ================================================================================\r\n==> default: \r\n==> default: \r\n==> default: Chef::Exceptions::ValidationFailed\r\n==> default: ----------------------------------\r\n==> default: ssh_authorize_key: user parameter must be a valid system user! You passed #<Chef::DelayedEvaluator:0x00000003302908@/var/chef/cache/cookbooks/seedbox/recipes/default.rb:11>.\r\n==> default: \r\n==> default: \r\n==> default: Cookbook Trace:\r\n==> default: ---------------\r\n==> default:   /var/chef/cache/cookbooks/ssh_authorized_keys/libraries/resource_helpers.rb:51:in `assert_user'\r\n==> default: \r\n==> default:   /var/chef/cache/cookbooks/ssh_authorized_keys/definitions/ssh_authorize_key.rb:26:in `block in from_file'\r\n==> default: \r\n==> default:   /var/chef/cache/cookbooks/seedbox/recipes/default.rb:10:in `from_file'\r\n==> default: \r\n==> default: \r\n==> default: Relevant File Content:\r\n==> default: ----------------------\r\n==> default: /var/chef/cache/cookbooks/ssh_authorized_keys/libraries/resource_helpers.rb:\r\n==> default: \r\n==> default: \r\n==> default: \r\n==> default:  44:      # Asserts that the user name is correct.\r\n==> default: \r\n==> default:  45:      #\r\n==> default: \r\n==> default:  46:      # @param user [String] user name.\r\n==> default: \r\n==> default:  47:      # @raise [Chef::Exceptions::ValidationFailed] if the user name is wrong.\r\n==> default: \r\n==> default:  48:      # @return void\r\n==> default: \r\n==> default:  49:      def assert_user(user)\r\n==> default: \r\n==> default:  50:        return if user.is_a?(String) && !user.empty?\r\n==> default: \r\n==> default:  51>>       fail Chef::Exceptions::ValidationFailed,\r\n==> default:  52:             'ssh_authorize_key: user parameter must be a valid system user! '\\\r\n==> default:  53:             \"You passed #{user.inspect}.\"\r\n==> default:  54:      end\r\n==> default:  55:  \r\n==> default:  56:      # Asserts that the SSH public key is correct.\r\n==> default:  57:      #\r\n==> default:  58:      # @param key [String] public key in base64.\r\n==> default:  59:      # @raise [Chef::Exceptions::ValidationFailed] if the key is wrong.\r\n==> default:  60:      # @return void\r\n==> default: \r\n==> default: Platform:\r\n==> default: ---------\r\n==> default: x86_64-linux\r\n==> default: \r\n==> default: \r\n```"},"comment":{"url":"https://api.github.com/repos/zuazo/ssh_authorized_keys-cookbook/issues/comments/252509485","html_url":"https://github.com/zuazo/ssh_authorized_keys-cookbook/issues/9#issuecomment-252509485","issue_url":"https://api.github.com/repos/zuazo/ssh_authorized_keys-cookbook/issues/9","id":252509485,"user":{"login":"zuazo","id":1878434,"avatar_url":"https://avatars.githubusercontent.com/u/1878434?v=3","gravatar_id":"","url":"https://api.github.com/users/zuazo","html_url":"https://github.com/zuazo","followers_url":"https://api.github.com/users/zuazo/followers","following_url":"https://api.github.com/users/zuazo/following{/other_user}","gists_url":"https://api.github.com/users/zuazo/gists{/gist_id}","starred_url":"https://api.github.com/users/zuazo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zuazo/subscriptions","organizations_url":"https://api.github.com/users/zuazo/orgs","repos_url":"https://api.github.com/users/zuazo/repos","events_url":"https://api.github.com/users/zuazo/events{/privacy}","received_events_url":"https://api.github.com/users/zuazo/received_events","type":"User","site_admin":false},"created_at":"2016-10-09T20:11:39Z","updated_at":"2016-10-09T20:11:39Z","body":"But if we skip the checks, what's the purpose of this cookbook? I mean, creating a template file for a *ssh_authorize_key* is too simple and I prefer to be this the purpose of the cookbook: To try to avoid generating an invalid file that could leave your server inaccessible.\r\n\r\nAnyway, I'm going to leave this open in case someone wants to implement it."}}
{"actor":{"display_login":"zuazo"}}