Hi,
I have a basic shell script provisioner. It doesn’t seem to execute completely. using latest packer version. Why do I don’t see echo messages in the log output. If I login into packer instance with -debug, I can execute the shell script to completion without issue.
Thanks a lot for your time and advise.
Venkatesh
{
builder {…}
{
“type”: “shell”,
“script”: “./agent_install.sh”
},
}
agent_install.sh script content is
#!/usr/bin/bash -e
set -ex
echo “cd /var/mps/mps_images”
cd /var/mps/mps_images
echo “tar xvzf build-masagent-13.0-66.33.tgz”
tar xvzf build-masagent-13.0-66.33.tgz
chmod +x /var/mps/mps_images/installmasagent
echo “/var/mps/mps_images/installmasagent”
/var/mps/mps_images/installmasagent
echo “done executing agent_install *******”
Debug output with PACKER_LOG=1
==> amazon-ebs: Provisioning with shell script: ./agent_install.sh
2020/09/03 12:21:03 packer-provisioner-shell plugin: Opening ./agent_install.sh for reading
2020/09/03 12:21:03 [INFO] 334 bytes written for ‘uploadData’
2020/09/03 12:21:03 packer-provisioner-shell plugin: [INFO] 334 bytes written for ‘uploadData’
2020/09/03 12:21:03 packer-builder-amazon-ebs plugin: [DEBUG] Opening new ssh session
2020/09/03 12:21:03 packer-builder-amazon-ebs plugin: [DEBUG] Starting remote scp process: scp -vt /tmp
2020/09/03 12:21:03 packer-builder-amazon-ebs plugin: [DEBUG] Started SCP session, beginning transfers…
2020/09/03 12:21:03 packer-builder-amazon-ebs plugin: [DEBUG] Copying input data into temporary file so we can read the length
2020/09/03 12:21:03 packer-builder-amazon-ebs plugin: [DEBUG] scp: Uploading script_5593.sh: perms=C0644 size=334
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [DEBUG] SCP session complete, closing stdin pipe.
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [DEBUG] Waiting for SSH session to complete.
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [DEBUG] scp stderr (length 31): Sink: C0644 334 script_5593.sh
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [DEBUG] Opening new ssh session
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [DEBUG] starting remote command: chmod 0755 /tmp/script_5593.sh
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [INFO] RPC endpoint: Communicator ended with: 0
2020/09/03 12:21:04 [INFO] RPC client: Communicator ended with: 0
2020/09/03 12:21:04 [INFO] RPC endpoint: Communicator ended with: 0
2020/09/03 12:21:04 packer-provisioner-shell plugin: [INFO] RPC client: Communicator ended with: 0
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [DEBUG] Opening new ssh session
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [DEBUG] starting remote command: chmod +x /tmp/script_5593.sh; PACKER_BUILDER_TYPE=‘amazon-ebs’ PACKER_BUILD_NAME=‘amazon-ebs’ /tmp/script_5593.sh
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [INFO] RPC endpoint: Communicator ended with: 0
2020/09/03 12:21:04 [INFO] 0 bytes written for ‘stdout’
2020/09/03 12:21:04 [INFO] 0 bytes written for ‘stderr’
2020/09/03 12:21:04 [INFO] RPC client: Communicator ended with: 0
2020/09/03 12:21:04 [INFO] RPC endpoint: Communicator ended with: 0
2020/09/03 12:21:04 packer-provisioner-shell plugin: [INFO] 0 bytes written for ‘stdout’
2020/09/03 12:21:04 packer-provisioner-shell plugin: [INFO] 0 bytes written for ‘stderr’
2020/09/03 12:21:04 packer-provisioner-shell plugin: [INFO] RPC client: Communicator ended with: 0
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [DEBUG] Opening new ssh session
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [DEBUG] starting remote command: rm -f /tmp/script_5593.sh
2020/09/03 12:21:04 [INFO] RPC client: Communicator ended with: 0
2020/09/03 12:21:04 [INFO] RPC endpoint: Communicator ended with: 0
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [INFO] RPC endpoint: Communicator ended with: 0
2020/09/03 12:21:04 packer-provisioner-shell plugin: [INFO] RPC client: Communicator ended with: 0
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [DEBUG] Opening new ssh session
2020/09/03 12:21:04 packer-builder-amazon-ebs plugin: [DEBUG] starting remote command: rm -f
2020/09/03 12:21:05 packer-builder-amazon-ebs plugin: [INFO] RPC endpoint: Communicator ended with: 0
2020/09/03 12:21:05 [INFO] RPC client: Communicator ended with: 0
2020/09/03 12:21:05 [INFO] RPC endpoint: Communicator ended with: 0
2020/09/03 12:21:05 [INFO] (telemetry) ending shell
2020/09/03 12:21:05 [INFO] (telemetry) Starting provisioner shell
2020/09/03 12:21:05 packer-provisioner-shell plugin: [INFO] RPC client: Communicator ended with: 0