For future readers who might find this post the issue is that the Google Cloud Logging and Monitoring Agent scripts require a PTY terminal for reasons I have been unable to asertain.
To fix this issue simply add "ssh_pty": true It seems that the interactive nature of the SSH connection unblocks some kind of HTTPS error inside of Yum. If anyone from Packer or Google would like to explore this further it would be highly interesting to know the details! Thanks, Alex On Wednesday, March 11, 2020 at 4:07:07 PM UTC, Alexander Christie wrote: > > Hi all! > > I've hit an issue which I can't explain regarding inconsistent behaviour > of the "https://dl.google.com/cloudagents/install-logging-agent.sh" when > run via terminal and via packer. > > Running via terminal produces the expected result of installing the agent > whilst running via packer causes the following failure: > ==> googlecompute: Failed to download metadata for repo > 'google-cloud-logging' > ==> googlecompute: Error: Failed to download metadata for repo > 'google-cloud-logging' > > Now I understand that this looks a lot like the "I'm using /sh instead of > /bash" from the > https://packer.io/docs/provisioners/shell.html#troubleshooting section of > the documentation. However this is not the case as I explicitly run the > script with bash and have verified that it is being run with bash through > packer in a couple of different ways. > > I've included a replication case below that can easily be spun up by > anyone with a Google Cloud Project. Hopefully someone here can see what is > going wrong? > > Thanks! > > > { > "variables": {}, > "builders": [{ > "type": "googlecompute", > "ssh_username": "provisioning", > "source_image_family": "centos-8", > "zone": "europe-west1-b", > "disable_default_service_account": true, > "image_name": "centos-8-base-{{isotime \"2006-01-02\"}}" > }], > "provisioners": [ > { > "type": "shell", > "inline": [ > "sudo yum upgrade -y" > ] > }, > { > "type": "shell", > "inline": [ > "curl -sL https://dl.google.com/cloudagents/install-logging-agent.sh | > sudo bash -" > ] > } > ] > } > > > > -- 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/ee986305-0e53-4d81-b3e7-df4feaface02%40googlegroups.com.
