-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sync_folder leads to "syntax error" report for vagrant builder #9564
Comments
Forgot to attach .zip |
I can only reproduce this if the "foo" directory doesn't exist, and then when I enable verbose logging I see:
|
I'll add prepare() code to stat this path and make sure it exists |
Is the path relative to the vagrant output folder, so where the Vagrantfile will be, or the packer template? |
Hm, I just gave the absolute path. In most of our other conventions relative path should be relative to the folder you run Packer from, so I'll check my fix to make sure it also expects that. |
If I change the entry to "../foo" that works, but that is relative to the Vagrantfile and not what I'd expect. |
I'll fix that now. |
ok pushed an updated patch to document how relative paths should work, and make it so the expected relative path is relative to the folder running packer not the vagrantfile folder. |
Bins can be grabbed here: https://circleci.com/gh/hashicorp/packer/66652#artifacts/containers/0 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Overview of the Issue
I am trying to use the vagrant builder with virtualbox instead of the "classic approach" of building ubuntu or whatever from the iso image. This seemingly works until I try and use sync_folder to map a host folder into my environment. I can see this in the doc, although have yet to see what claims to be a working example, so could be I am missing something. If it were that I was missing something, that would imply the doc could be updated.
I suspect the error is coming from vagrant but I am assuming the issue is in packer for now - difficult to tell.
Issue seen is:
vagrant: strconv.Atoi: parsing "": invalid syntax
Mergely removing the "sync_folder" entry removes this issue, but of course does not map the folder as required.
Reproduction Steps
I've cut this down from my original to a fairly simple (I believe) example.
Packer version
Packer v1.6.0
Simplified Packer Buildfile
{
"builders": [
{
"type": "vagrant",
"communicator": "ssh",
"source_path": "ubuntu/bionic64",
"add_force": true,
"provider": "virtualbox",
"box_name": "problem",
"synced_folder": "foo"
}
],
"provisioners": [
{
"type": "shell",
"scripts": ["scripts/basic_install.sh"]
}
]
}
Operating system and Environment details
Vagrant 2.2.9
Virtual Box 6.1
Windows 10 1909
Log Fragments and crash.log files
==> vagrant: Deleting previous output directory...
==> vagrant: Creating a Vagrantfile in the build directory...
==> vagrant: Adding box using vagrant box add ...
vagrant: (this can take some time if we need to download the box)
==> vagrant: Calling Vagrant Up (this can take some time)...
==> vagrant: strconv.Atoi: parsing "": invalid syntax
==> vagrant: Step "StepSSHConfig" failed, aborting...
==> vagrant: aborted: skipping cleanup of step "StepUp"
==> vagrant: aborted: skipping cleanup of step "StepAddBox"
==> vagrant: aborted: skipping cleanup of step "StepCreateVagrantfile"
==> vagrant: aborted: skipping cleanup of step "StepOutputDir"
Build 'vagrant' errored: strconv.Atoi: parsing "": invalid syntax
==> Some builds didn't complete successfully and had errors:
--> vagrant: strconv.Atoi: parsing "": invalid syntax
==> Builds finished but no artifacts were created.
The text was updated successfully, but these errors were encountered: