Hello,
Your help is needed as documentation for execute_command is not helping so far.
It is observed that whenever provisioner shell script is specified along with execute_command then script is not executing but execute_command does get execute.
Reproduction Steps
-
TestCase-1: Without execute_command in ami.json
Below is excerpt of ami.json
“provisioners”: [
“type”: “shell”,
“script”: “scripts/cb/provisioner.sh”,
“environment_vars”: [
“CI_JOB_TOKEN={{userCI_JOB_TOKEN
}}”,
“PACKER_RPM_NAME={{userpacker_rpm_name
}}”
]
]
Result : Instance launched using TestCase-1’s AMI shows that script ‘provisioner.sh’ is executed successfully by Provisioner. -
TestCase-2: With execute_command in ami.json
Below is excerpt of ami.json
“provisioners”: [
“type”: “shell”,
“script”: “scripts/cb/provisioner.sh”,
“environment_vars”: [
“CI_JOB_TOKEN={{userCI_JOB_TOKEN
}}”,
“PACKER_RPM_NAME={{userpacker_rpm_name
}}”
],
“execute_command”: “echo ‘packer’ > /home/centos/a.out”
]
Result : Instance launched using TestCase-2’s AMI shows that script ‘provisioner.sh’ is not executed by Provisioner. But execute_command is executed successfully.