{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/packer/issues/1872","labels_url":"https://api.github.com/repos/mitchellh/packer/issues/1872/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/packer/issues/1872/comments","events_url":"https://api.github.com/repos/mitchellh/packer/issues/1872/events","html_url":"https://github.com/mitchellh/packer/issues/1872","id":55511632,"number":1872,"title":"Remote file disappears during shell provision run","user":{"login":"matt-richardson","id":373389,"avatar_url":"https://avatars.githubusercontent.com/u/373389?v=3","gravatar_id":"","url":"https://api.github.com/users/matt-richardson","html_url":"https://github.com/matt-richardson","followers_url":"https://api.github.com/users/matt-richardson/followers","following_url":"https://api.github.com/users/matt-richardson/following{/other_user}","gists_url":"https://api.github.com/users/matt-richardson/gists{/gist_id}","starred_url":"https://api.github.com/users/matt-richardson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matt-richardson/subscriptions","organizations_url":"https://api.github.com/users/matt-richardson/orgs","repos_url":"https://api.github.com/users/matt-richardson/repos","events_url":"https://api.github.com/users/matt-richardson/events{/privacy}","received_events_url":"https://api.github.com/users/matt-richardson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-26T17:29:38Z","updated_at":"2015-01-26T22:22:51Z","closed_at":null,"body":"We are using packer (0.7.5) with a windows guest (Win2012r2) running on aws (using the amazon-ebs builder).\r\n\r\nWe are using the [packer windows](https://github.com/joefitzgerald/packer-windows) approach, installing openssh during first boot, then doing the rest of the provisioning run via packer provisioners after that.\r\n\r\nFor the last few days, I've been fighting with issues when executing a shell provisioner, similar to:\r\n\r\n~~~~\r\n{\r\n    \"type\": \"shell\",\r\n    \"remote_path\": \"/tmp/script.bat\",\r\n    \"binary\": true,\r\n    \"execute_command\": \"{{.Vars}} cmd /c C:/Windows/Temp/script.bat\",\r\n    \"scripts\": [\r\n      \"./scripts/vagrant-ssh.bat\",\r\n      \"./scripts/enable-rdp.bat\",\r\n      \"./scripts/chef.bat\",\r\n      \"./scripts/win-updates.bat\"\r\n    ]\r\n  }\r\n~~~~\r\n\r\nRandomly, we are getting an error ` The batch file cannot be found.` when the batch file executes a child command. It appears (after investigation using the -debug flag and using procmon) that the file is getting deleted somehow. \r\n\r\nThis doesn't always happen in the same spot, but does always appear after running a child command (eg, powershell), and that exits and returns to flow of execution to the calling batch file.\r\n\r\nWhen this happens (and packer pauses before tearing it down), if I look in the temp folder, the batch file does not exist. (OpenSSH symlinks /tmp/ to c:\\windows\\temp).\r\n\r\nThe child command is returning a 0 error code.\r\n\r\nI've spent a few hours poring over the code, and even though I'm no golang programmer, I cant find anywhere that this might be happening.\r\n\r\nCan anyone suggest further avenues to investigate?"},"comment":{"url":"https://api.github.com/repos/mitchellh/packer/issues/comments/71551166","html_url":"https://github.com/mitchellh/packer/issues/1872#issuecomment-71551166","issue_url":"https://api.github.com/repos/mitchellh/packer/issues/1872","id":71551166,"user":{"login":"matt-richardson","id":373389,"avatar_url":"https://avatars.githubusercontent.com/u/373389?v=3","gravatar_id":"","url":"https://api.github.com/users/matt-richardson","html_url":"https://github.com/matt-richardson","followers_url":"https://api.github.com/users/matt-richardson/followers","following_url":"https://api.github.com/users/matt-richardson/following{/other_user}","gists_url":"https://api.github.com/users/matt-richardson/gists{/gist_id}","starred_url":"https://api.github.com/users/matt-richardson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matt-richardson/subscriptions","organizations_url":"https://api.github.com/users/matt-richardson/orgs","repos_url":"https://api.github.com/users/matt-richardson/repos","events_url":"https://api.github.com/users/matt-richardson/events{/privacy}","received_events_url":"https://api.github.com/users/matt-richardson/received_events","type":"User","site_admin":false},"created_at":"2015-01-26T22:22:51Z","updated_at":"2015-01-26T22:22:51Z","body":"Further info on the batch files - when running locally (via rdp), they complete in exactly the way they should. When running over ssh, they complete exactly the way they should."}}