{"action":"created","issue":{"url":"https://api.github.com/repos/chef/chef-provisioning/issues/366","labels_url":"https://api.github.com/repos/chef/chef-provisioning/issues/366/labels{/name}","comments_url":"https://api.github.com/repos/chef/chef-provisioning/issues/366/comments","events_url":"https://api.github.com/repos/chef/chef-provisioning/issues/366/events","html_url":"https://github.com/chef/chef-provisioning/pull/366","id":89864408,"number":366,"title":"expose machine_spec.from_image to allocate_machine","user":{"login":"mwrock","id":655165,"avatar_url":"https://avatars.githubusercontent.com/u/655165?v=3","gravatar_id":"","url":"https://api.github.com/users/mwrock","html_url":"https://github.com/mwrock","followers_url":"https://api.github.com/users/mwrock/followers","following_url":"https://api.github.com/users/mwrock/following{/other_user}","gists_url":"https://api.github.com/users/mwrock/gists{/gist_id}","starred_url":"https://api.github.com/users/mwrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwrock/subscriptions","organizations_url":"https://api.github.com/users/mwrock/orgs","repos_url":"https://api.github.com/users/mwrock/repos","events_url":"https://api.github.com/users/mwrock/events{/privacy}","received_events_url":"https://api.github.com/users/mwrock/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chef/chef-provisioning/labels/Feedback%20Requested","name":"Feedback Requested","color":"d4c5f9"},{"url":"https://api.github.com/repos/chef/chef-provisioning/labels/Signed%20CLA","name":"Signed CLA","color":"ededed"},{"url":"https://api.github.com/repos/chef/chef-provisioning/labels/Triaged","name":"Triaged","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-21T04:45:50Z","updated_at":"2015-06-30T20:59:41Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/chef/chef-provisioning/pulls/366","html_url":"https://github.com/chef/chef-provisioning/pull/366","diff_url":"https://github.com/chef/chef-provisioning/pull/366.diff","patch_url":"https://github.com/chef/chef-provisioning/pull/366.patch"},"body":"Currently `from_image` is added to the `machine_spec` immediately after `allocate_machine`. I'm not sure if that was by design. I can think of scenarios where one would want to know if the machine is being created from an image from allocate_machine. This is possible using this hack:\r\n\r\n```ruby\r\ncase action_handler\r\nwhen Chef::Provisioning::AddPrefixActionHandler # From machine_batch\r\n  machines = action_handler.action_handler.provider.new_resource.machines\r\n  this_machine = machines.select { |m| m.name == machine_spec.name}.first\r\n  this_machine.from_image\r\nelse # from machine\r\n  action_handler.provider.new_resource.from_image\r\nend\r\n```\r\nThis feels a bit evil.\r\n\r\nThis PR sets the `machine_spec.from_image` in the `machine` `load_current_resource` which also allows the value to be set just once instead of both the `machine` and `machine_batch` resources."},"comment":{"url":"https://api.github.com/repos/chef/chef-provisioning/issues/comments/117340465","html_url":"https://github.com/chef/chef-provisioning/pull/366#issuecomment-117340465","issue_url":"https://api.github.com/repos/chef/chef-provisioning/issues/366","id":117340465,"user":{"login":"tyler-ball","id":2481463,"avatar_url":"https://avatars.githubusercontent.com/u/2481463?v=3","gravatar_id":"","url":"https://api.github.com/users/tyler-ball","html_url":"https://github.com/tyler-ball","followers_url":"https://api.github.com/users/tyler-ball/followers","following_url":"https://api.github.com/users/tyler-ball/following{/other_user}","gists_url":"https://api.github.com/users/tyler-ball/gists{/gist_id}","starred_url":"https://api.github.com/users/tyler-ball/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tyler-ball/subscriptions","organizations_url":"https://api.github.com/users/tyler-ball/orgs","repos_url":"https://api.github.com/users/tyler-ball/repos","events_url":"https://api.github.com/users/tyler-ball/events{/privacy}","received_events_url":"https://api.github.com/users/tyler-ball/received_events","type":"User","site_admin":false},"created_at":"2015-06-30T20:59:41Z","updated_at":"2015-06-30T20:59:41Z","body":"@jkeiser It seems like you are saying: if the machine hasn't converged yet and we add the `from_image` attribute to the spec, then the spec no longer represents actual state - it would represent desired state.  \r\n\r\n@mwrock In driver.rb you don't have access to `new_resource` correct?  Otherwise you could just check `new_resource.from_image`."}}