-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
r/vsphere_file
causes crash with incorrect configuration
#1779
Comments
Hello, springer268! 🖐 Thank you for submitting an issue for this provider. The issue will now enter into the issue lifecycle. If you want to contribute to this project, please review the contributing guidelines and information on submitting pull requests. |
r/vsphere_file
causes plugin crash
At first glance the example seems incorrect as it's set to create directories, but none are required as no directory path is provided. resource "vsphere_file" "ubuntu_vmdk_upload2" {
datacenter = "dc"
datastore = "ds1"
source_file = "/Users/springern/Documents/hi.txt"
destination_file = "hi.txt"
create_directories = true
} Try: resource "vsphere_file" "ubuntu_vmdk_upload2" {
datacenter = "dc"
datastore = "ds1"
source_file = "/Users/springern/Documents/hi.txt"
destination_file = "path/to/file/hi.txt"
create_directories = true
} or if in the datastore root:
|
Yes, this worked. I guess an error message should be added when this occurs, instead of a crash. Thanks. |
r/vsphere_file
causes plugin crashr/vsphere_file
causes crash if
r/vsphere_file
causes crash ifr/vsphere_file
causes crash with incorrect configuration
I've updated the issue to track this item for an enhancement to misconfiguration error handling. |
…rp#1779 Update resource_vsphere_file.createDirectory method to check whether the provided file path has any parent folder(s). If there are no folders to be created we return early without invoking FileManager.MakeDirectory. This fixes the “slice bounds out of range” runtime error which was crashing the provider. Fix the resource_vsphere_file_test acceptance tests as they were failing due to incorrect test vmdk files. Also, adding new TestAccResourceVSphereFile_uploadWithCreateDirectories test to cover the r/vsphere_file.create_directories configuration field.
Update resource_vsphere_file.createDirectory method to check whether the provided file path has any parent folder(s). If there are no folders to be created we return early without invoking FileManager.MakeDirectory. This fixes the “slice bounds out of range” runtime error which was crashing the provider. Fix the resource_vsphere_file_test acceptance tests as they were failing due to incorrect test vmdk files. Also, adding new TestAccResourceVSphereFile_uploadWithCreateDirectories test to cover the r/vsphere_file.create_directories configuration field.
This functionality has been released in v2.4.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
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. |
Community Guidelines
Terraform
v1.3.3
Terraform Provider
v2.2.0
VMware vSphere
7.0.2.00500
Description
I am trying to use vsphere_file to upload a file to a datastore. This causes a crash in the plugin
Affected Resources or Data Sources
r/vsphere_file
Terraform Configuration
Debug Output
https://gist.github.com/springer268/3ac854675994b18aa2922c042791c8dc
Panic Output
https://gist.github.com/springer268/3ac854675994b18aa2922c042791c8dc
(i dont see a crash.log)
Expected Behavior
The file to upload to the specified datastore
Actual Behavior
the file is not uploaded to the datastore and crashes the program
Steps to Reproduce
Environment Details
This error also occurs on a different vCenter.
The datastore is VMFS
Screenshots
No response
References
No response
The text was updated successfully, but these errors were encountered: