Hello,
I am working with packerpy and GCP to be able to load an OVA file to a
personal bucket and then modify that image and create a new image from
that, using the provisioners feature in a JSON file.
I have the process to upload to a personal bucket working, but I can't
figure out how to get packer to find my image in my personal bucket.
Packer keeps searching the public area. I didn't see where I can use a
bucket.
Anyone have any idea on how to get packet to modify the image from the
personal bucket?
On a separate note, I am able to use packer, in this same manner with AWS,
just fine.
Here is an example of my JSON for GCP:
{
"variables": {
"disk_size": 150,
"project_id": "proj-id",
"result_image": "packer-example-{{timestamp}}",
"source_image": "rhel-7-5-x86-64-minimal-ova",
"ssh_password": "password",
"ssh_timeout": "3m",
"ssh_username": "user",
"zone": "us-east-1"
},
"builders": [
{
"disk_size": "{{user `disk_size`}}",
"image_name": "{{user `result_image`}}",
"project_id": "{{user `project_id`}}",
"source_image": "{{user `source_image`}}",
"ssh_password": "{{user `ssh_password`}}",
"ssh_username": "{{user `ssh_username`}}",
"type": "googlecompute",
"zone": "{{user `zone`}}"
}
],
"provisioners": [
{
"type": "file",
"source": "./welcome.sh",
"destination": "/root/",
"direction": "upload"
},
{
"type": "shell",
"inline": [
"chmod +x welcome.sh",
"./welcome.sh"
]
}
]
}
Here is the Python code that uses the above JSON code:
import argparse
import json
from packerpy import PackerExecutable
parser = argparse.ArgumentParser(description='This script modifies a GCP
image in GCP.')
parser.add_argument('-f', '--json_file', required=True, help='The JSON file
that contains the changes to make to the image file.')
args = parser.parse_args()
json_file = args.json_file
packer_bin = '/usr/local/bin/packer'
p = PackerExecutable(packer_bin)
(results, output, error) = p.build(json_file)
if results == 0:
print('Success!')
else:
print('Error:', error)
print('\nOutput:', output)
If you have any questions, please ask.
Thank you very much!
Wes Quinn
--
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/5b866b6d-1ee3-4632-8df9-1c585d710e77%40googlegroups.com.