{"action":"created","issue":{"url":"https://api.github.com/repos/capistrano/capistrano/issues/1427","repository_url":"https://api.github.com/repos/capistrano/capistrano","labels_url":"https://api.github.com/repos/capistrano/capistrano/issues/1427/labels{/name}","comments_url":"https://api.github.com/repos/capistrano/capistrano/issues/1427/comments","events_url":"https://api.github.com/repos/capistrano/capistrano/issues/1427/events","html_url":"https://github.com/capistrano/capistrano/issues/1427","id":72961993,"number":1427,"title":"Setting user per-host isn't working","user":{"login":"maxim","id":7758,"avatar_url":"https://avatars.githubusercontent.com/u/7758?v=3","gravatar_id":"","url":"https://api.github.com/users/maxim","html_url":"https://github.com/maxim","followers_url":"https://api.github.com/users/maxim/followers","following_url":"https://api.github.com/users/maxim/following{/other_user}","gists_url":"https://api.github.com/users/maxim/gists{/gist_id}","starred_url":"https://api.github.com/users/maxim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxim/subscriptions","organizations_url":"https://api.github.com/users/maxim/orgs","repos_url":"https://api.github.com/users/maxim/repos","events_url":"https://api.github.com/users/maxim/events{/privacy}","received_events_url":"https://api.github.com/users/maxim/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/capistrano/capistrano/labels/bug?","name":"bug?","color":"fbca04"},{"url":"https://api.github.com/repos/capistrano/capistrano/labels/you%20can%20help!","name":"you can help!","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2015-05-04T08:40:09Z","updated_at":"2016-10-14T00:40:15Z","closed_at":null,"body":"*This worked in 3.2.1, and broke in 3.4.0.*\r\n\r\nSay I set user per-host likes this:\r\n\r\n```ruby\r\n# production stage\r\nserver 'foo.example.org', user: 'deployer', roles: [:util]\r\nrole :util_exec, 'foo.example.org', user: 'runner', no_release: true\r\n```\r\n\r\nnotice that it's the same server hostname is in 2 different roles, with 2 different users\r\nthen I run the task `cap production debug` that's implemented like this:\r\n\r\n```ruby\r\ntask(:debug) {\r\n  on(primary :util) do\r\n    puts capture('whoami')\r\n  end\r\n}\r\n```\r\n\r\nIt prints the runner user (which is equal to my local username) instead of the expected `'deployer'`."},"comment":{"url":"https://api.github.com/repos/capistrano/capistrano/issues/comments/253679371","html_url":"https://github.com/capistrano/capistrano/issues/1427#issuecomment-253679371","issue_url":"https://api.github.com/repos/capistrano/capistrano/issues/1427","id":253679371,"user":{"login":"mattbrictson","id":189693,"avatar_url":"https://avatars.githubusercontent.com/u/189693?v=3","gravatar_id":"","url":"https://api.github.com/users/mattbrictson","html_url":"https://github.com/mattbrictson","followers_url":"https://api.github.com/users/mattbrictson/followers","following_url":"https://api.github.com/users/mattbrictson/following{/other_user}","gists_url":"https://api.github.com/users/mattbrictson/gists{/gist_id}","starred_url":"https://api.github.com/users/mattbrictson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattbrictson/subscriptions","organizations_url":"https://api.github.com/users/mattbrictson/orgs","repos_url":"https://api.github.com/users/mattbrictson/repos","events_url":"https://api.github.com/users/mattbrictson/events{/privacy}","received_events_url":"https://api.github.com/users/mattbrictson/received_events","type":"User","site_admin":false},"created_at":"2016-10-14T00:40:15Z","updated_at":"2016-10-14T00:40:15Z","body":"Hmm. I would prefer not to add a setting.\r\n\r\nInstead, what if we internally track a \"key\" for each server which is the string that was used to originally declare it. We always match on this key. (That means we could use a Hash, rather than looping through servers using `matches?`.)\r\n\r\nFor example:\r\n\r\n```ruby\r\nserver \"db01\", :roles => %w(db) # key is \"db01\"\r\nserver \"app@host\", :roles => %w(app) # key is \"app@host\"\r\n\r\n# This merges a new property onto db01 since the keys match\r\nserver \"db01\", :primary => true\r\n\r\n# This creates a new server, since the keys do not match\r\nserver \"web@host\", :roles => %w(app)\r\n```\r\n\r\nAnother example:\r\n\r\n```ruby\r\n# The key in both cases is \"server1\", so the properties are merged\r\nrole :redis, %w{server1 server2 server3 server4}, redis: { port: 6379, slave: true}\r\nserver 'server1', redis: { slave: false }\r\n```\r\n\r\nThis might make everyone happy. Thoughts?"}}
{"actor":{"display_login":"mattbrictson"}}