{"action":"created","issue":{"url":"https://api.github.com/repos/test-kitchen/kitchen-ec2/issues/238","repository_url":"https://api.github.com/repos/test-kitchen/kitchen-ec2","labels_url":"https://api.github.com/repos/test-kitchen/kitchen-ec2/issues/238/labels{/name}","comments_url":"https://api.github.com/repos/test-kitchen/kitchen-ec2/issues/238/comments","events_url":"https://api.github.com/repos/test-kitchen/kitchen-ec2/issues/238/events","html_url":"https://github.com/test-kitchen/kitchen-ec2/issues/238","id":140183879,"number":238,"title":"Add support for provision_command","user":{"login":"thompsm","id":15791470,"avatar_url":"https://avatars.githubusercontent.com/u/15791470?v=3","gravatar_id":"","url":"https://api.github.com/users/thompsm","html_url":"https://github.com/thompsm","followers_url":"https://api.github.com/users/thompsm/followers","following_url":"https://api.github.com/users/thompsm/following{/other_user}","gists_url":"https://api.github.com/users/thompsm/gists{/gist_id}","starred_url":"https://api.github.com/users/thompsm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thompsm/subscriptions","organizations_url":"https://api.github.com/users/thompsm/orgs","repos_url":"https://api.github.com/users/thompsm/repos","events_url":"https://api.github.com/users/thompsm/events{/privacy}","received_events_url":"https://api.github.com/users/thompsm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-11T13:32:53Z","updated_at":"2016-03-18T10:36:17Z","closed_at":null,"body":"I see the docker driver supports a \"provision_command\" in the kitchen yml so you could add the requiretty setting to the ec2-user, eg:\r\n\r\n```\r\ndriver:\r\n  name: docker\r\n  provision_command: echo \"Defaults:ec2-user !requiretty\" > /etc/sudoers.d/ec2-user\r\n```\r\n\r\nCan this feature be added to the ec2 driver please? Or is it already supported?\r\n\r\nSince moving to test-kitchen 1.5.0, I can't run verify tests anymore unless ec2-user has requiretty disabled."},"comment":{"url":"https://api.github.com/repos/test-kitchen/kitchen-ec2/issues/comments/198299571","html_url":"https://github.com/test-kitchen/kitchen-ec2/issues/238#issuecomment-198299571","issue_url":"https://api.github.com/repos/test-kitchen/kitchen-ec2/issues/238","id":198299571,"user":{"login":"thompsm","id":15791470,"avatar_url":"https://avatars.githubusercontent.com/u/15791470?v=3","gravatar_id":"","url":"https://api.github.com/users/thompsm","html_url":"https://github.com/thompsm","followers_url":"https://api.github.com/users/thompsm/followers","following_url":"https://api.github.com/users/thompsm/following{/other_user}","gists_url":"https://api.github.com/users/thompsm/gists{/gist_id}","starred_url":"https://api.github.com/users/thompsm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thompsm/subscriptions","organizations_url":"https://api.github.com/users/thompsm/orgs","repos_url":"https://api.github.com/users/thompsm/repos","events_url":"https://api.github.com/users/thompsm/events{/privacy}","received_events_url":"https://api.github.com/users/thompsm/received_events","type":"User","site_admin":false},"created_at":"2016-03-18T10:36:17Z","updated_at":"2016-03-18T10:36:17Z","body":"I had not spotted the user_data parameter. That did what I needed once I figured out you had to pass it a script and not just a single line.\r\n\r\nThis didn't work:\r\n\r\n```user_data: \"echo 'Defaults:ec2-user !requiretty' > /etc/sudoers.d/ec2-user\"```\r\n\r\nIn my cloud-init-output.log I saw:\r\n\r\n```2016-03-18 09:55:19,762 - __init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: 'echo \\'Defaults:ec2-user ...'```\r\n\r\nBut this did work:\r\n\r\n```user_data: \"#!/bin/bash\\necho 'Defaults:ec2-user !requiretty' > /etc/sudoers.d/ec2-user\"```\r\n\r\nI checked the /var/lib/cloud/instances/user_data.txt.i file, as saw that it now had a differenent MIME type:\r\n```\r\nMIME-Version: 1.0\r\nContent-Type: text/x-shellscript\r\nContent-Disposition: attachment; filename=\"part-001\"\r\n\r\n#!/bin/bash\r\necho 'Defaults:ec2-user !requiretty' > /etc/sudoers.d/ec2-user\r\n```\r\n\r\nHope this helps someone else.\r\n\r\nThanks for the suggestion @tristanmorgan "}}