Hi,
I am using Packer to build an AWS AMI.
As part of the build process I am using the 'powershell' provisioner to run
various PowerShell scripts.
Some of these scripts install software on the image, such as .NET
Framework. The installer for .NET needs several minutes to do its work.
However, I see that the script is interrupted during the packer run.
Somehow the script simply stops, I do not see any error messages, but any
logging from the script simply stops. I do not see the logging that the
second half of the script generates. The provisioner simply continues with
the next reboot.
I am using the following configuration:
"provisioners": [
{
"type": "powershell",
"scripts": [
"./ec2/script1.ps1",
"./ec2/script2.ps1",
"./ec2/script3.ps1"
]
},
{
"type": "windows-restart"
},
{
"type": "powershell",
"scripts": [
"./ec2/netframework.ps1"
]
},
{
"type": "windows-restart"
},
{
"type": "powershell",
"pause_before": "30s",
"scripts": [
"./ec2/script5.ps1",
"./ec2/script6.ps1"
]
}
]
This is my command for installing .NET framework:
Start-Process -FilePath $installer -ArgumentList "/passive /norestart /log
$Path/$filename.log" -Wait
The installation command seems to be correct.
Moreover, if I allow the script to enter a loop (like this: while ($true)
{Start-Sleep 1; $i++; $i}), the reboot still follows after 15-60 seconds.
I am very confused. I would expect the script to complete normally, and the
reboot to follow only after the script is finished.Does anyone have any
suggestions what may be going on?
Kind regards,
Lucas
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/a4139442-a9fe-47d7-9670-c75da1779909%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.