Instead of curling down the script, download it and use the file
privisioner to get it into the image and run that. Also add set -x on the
top of it and you will probably find the issue.

On Wed, Mar 11, 2020, 17:07 'Alexander Christie' via Packer <
[email protected]> 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/5a382fa4-078e-4685-bf24-a71482f1cc53%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/5a382fa4-078e-4685-bf24-a71482f1cc53%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CALz9Rt_SEO6bbTd6uFSrxVRAyYbtiRn5jmKr52eEndVqFx%3Du1Q%40mail.gmail.com.

Reply via email to