{"action":"created","issue":{"url":"https://api.github.com/repos/remind101/stacker/issues/214","repository_url":"https://api.github.com/repos/remind101/stacker","labels_url":"https://api.github.com/repos/remind101/stacker/issues/214/labels{/name}","comments_url":"https://api.github.com/repos/remind101/stacker/issues/214/comments","events_url":"https://api.github.com/repos/remind101/stacker/issues/214/events","html_url":"https://github.com/remind101/stacker/issues/214","id":174434535,"number":214,"title":"Lookups can no longer return complex objects","user":{"login":"ttarhan","id":149096,"avatar_url":"https://avatars.githubusercontent.com/u/149096?v=3","gravatar_id":"","url":"https://api.github.com/users/ttarhan","html_url":"https://github.com/ttarhan","followers_url":"https://api.github.com/users/ttarhan/followers","following_url":"https://api.github.com/users/ttarhan/following{/other_user}","gists_url":"https://api.github.com/users/ttarhan/gists{/gist_id}","starred_url":"https://api.github.com/users/ttarhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ttarhan/subscriptions","organizations_url":"https://api.github.com/users/ttarhan/orgs","repos_url":"https://api.github.com/users/ttarhan/repos","events_url":"https://api.github.com/users/ttarhan/events{/privacy}","received_events_url":"https://api.github.com/users/ttarhan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-01T04:32:55Z","updated_at":"2016-09-01T17:23:20Z","closed_at":null,"body":"While working on the ${file. ...} lookup, I ran into an issue: the lookups serve as simple string substitution. The file lookup needs to return troposphere objects (Base64 or GenericHelperFn) to return the required JSON structure:\r\n\r\n         { \"Fn::Join\" : [\"\", [\r\n           \"#!/bin/sh\\naws s3 sync s3://\",\r\n           {\"Ref\" : \"BucketName\"},\r\n           \"/somepath /somepath\"\r\n         ]] }\r\n\r\nwhich cannot be represented as a String. I'm not sure where to go from here, as this worked fine with translators (since they could return any object), but it's broken with the current implementation of lookups."},"comment":{"url":"https://api.github.com/repos/remind101/stacker/issues/comments/244149933","html_url":"https://github.com/remind101/stacker/issues/214#issuecomment-244149933","issue_url":"https://api.github.com/repos/remind101/stacker/issues/214","id":244149933,"user":{"login":"mhahn","id":704593,"avatar_url":"https://avatars.githubusercontent.com/u/704593?v=3","gravatar_id":"","url":"https://api.github.com/users/mhahn","html_url":"https://github.com/mhahn","followers_url":"https://api.github.com/users/mhahn/followers","following_url":"https://api.github.com/users/mhahn/following{/other_user}","gists_url":"https://api.github.com/users/mhahn/gists{/gist_id}","starred_url":"https://api.github.com/users/mhahn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhahn/subscriptions","organizations_url":"https://api.github.com/users/mhahn/orgs","repos_url":"https://api.github.com/users/mhahn/repos","events_url":"https://api.github.com/users/mhahn/events{/privacy}","received_events_url":"https://api.github.com/users/mhahn/received_events","type":"User","site_admin":false},"created_at":"2016-09-01T17:23:20Z","updated_at":"2016-09-01T17:23:20Z","body":"I need to think about this a little more.\r\n\r\nWe need to change: https://github.com/remind101/stacker/blob/master/stacker/variables.py#L26 to support this.\r\n\r\noff the top of my head, one option (which would break nested lookups):\r\n\r\n- determine what lookups are within the string\r\n- if any of the lookups have a non-string value, that should be returned and all the others will be ignored. Any wrapping lookup would be a noop.\r\n\r\nie. if you had something like `${custom ${file ...}}`, since file returns an object, `custom` would never get called.\r\n\r\nI was thinking another option could be storing a map between any non-string lookup value and a UUID. We could replace the UUID in the string and then nested lookups could lookup the value when they get invoked, but there are too many cases where that gets weird, ie:\r\n\r\n`${custom ${file ...},${output someStack::someOutput}}`\r\n\r\nif that resolved to something like: `${custom _lookup-res:123456,Output Value}` I'm not sure how useful that would be.\r\n\r\nRight now the input for a lookup handle is unstructured, you get whatever string value is present. We could add more structure and treat the input value as something that will be resolved to `args` and `kwargs`. In the above example, we would split the input value on `,` and then invoke `custom` with:\r\n\r\n`custom([<result of file lookup>, \"Output Value\"])`\r\n\r\nI may be thinking about this too much though."}}
{"actor":{"display_login":"mhahn"}}