[x] I have added / updated documentation in /docs for any user-facing features or additions.
[ ] I have added / updated acceptance tests in /fwprovider/tests for any new or updated resources / data sources.
[ ] I have ran make example to verify that the change works as expected.
[x] Tested against own Proxmox VE clusters.
Summary
733 implemented basic support for hook scripts, but the authors "did not manage to find time to work on" also including support to set the file mode. This small but important feature makes the use of the proxmox_virtual_environment_container.hook_script_file_id and virtual_environment_vm.hook_script_file_id attributes basically useless when not combined with the manual step of making the uploaded file executable (manually running chmod +x /path/to/script or using other methods, based on the storage backend). Using the hook_script_file_id on its own also causes all planned and applied changes in the same execution to not be saved in the state because the Proxmox VE API responses with a HTTP 500 error since the uploaded and assigned file is not executable.
This pull request implements the missing feature to set the file mode by adding a new file_mode attribute of type string where an octal-formatted value can be passed, e.g. 0700 or only 600. Note that the octal prefixes 0o and 0x are not supported to reduce the complexity, even though the used os.FileMode type supports it.
Changing the file mode also causes the file to be replaced, which is true for almost any attribute in the proxmox_virtual_environment_file resource, to ensure that the file mode can also be changed after the initial creation.
Off-Topic
@bpg Sorry for the silence in my last PR for the APT repository support!
Life kicked in again and I had not time to resolve the review changes. I'll fix these in a new PR 😄
Community Note
Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request
Contributor's Note
/docs
for any user-facing features or additions./fwprovider/tests
for any new or updated resources / data sources.make example
to verify that the change works as expected.Summary
733 implemented basic support for hook scripts, but the authors "did not manage to find time to work on" also including support to set the file mode. This small but important feature makes the use of the
proxmox_virtual_environment_container.hook_script_file_id
andvirtual_environment_vm.hook_script_file_id
attributes basically useless when not combined with the manual step of making the uploaded file executable (manually runningchmod +x /path/to/script
or using other methods, based on the storage backend). Using thehook_script_file_id
on its own also causes all planned and applied changes in the same execution to not be saved in the state because the Proxmox VE API responses with a HTTP500
error since the uploaded and assigned file is not executable.This pull request implements the missing feature to set the file mode by adding a new
file_mode
attribute of typestring
where an octal-formatted value can be passed, e.g.0700
or only600
. Note that the octal prefixes0o
and0x
are not supported to reduce the complexity, even though the usedos.FileMode
type supports it. Changing the file mode also causes the file to be replaced, which is true for almost any attribute in theproxmox_virtual_environment_file
resource, to ensure that the file mode can also be changed after the initial creation.Off-Topic
@bpg Sorry for the silence in my last PR for the APT repository support! Life kicked in again and I had not time to resolve the review changes. I'll fix these in a new PR 😄Community Note
Relates #570 Relates #733