Skip to content

[Issue 196] feature: datasource to find VM in cluster#295

Open
castorsky wants to merge 4 commits intohashicorp:mainfrom
castorsky:feature/datasource-template
Open

[Issue 196] feature: datasource to find VM in cluster#295
castorsky wants to merge 4 commits intohashicorp:mainfrom
castorsky:feature/datasource-template

Conversation

@castorsky
Copy link
Copy Markdown

I have implemented a datasource which was described in #196.

This datasource searches the PVE cluster for some VMs that matches specified filters and returns VM ID for one (and only one) guest. I have chosen such behavior because it will be straightforward for proxmox-clone builder - there will be no need for user to manipulate lists in locals.

I have included some tests and documentation for datasource (but since this is my very first attempt to publish my work for Packer I may have missed something).

This datasource uses undocumented meta field from Proxmox API responses. (But the Proxmox team recommended using this field to determine guest creation time in the forum messages).

Closes #196

@castorsky castorsky requested a review from a team as a code owner October 21, 2024 22:58
@hashicorp-cla-app
Copy link
Copy Markdown

hashicorp-cla-app Bot commented Oct 21, 2024

CLA assistant check
All committers have signed the CLA.

@hashicorp-cla-app
Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@castorsky castorsky force-pushed the feature/datasource-template branch from 2599b9a to 155f985 Compare November 20, 2024 22:23
@castorsky castorsky force-pushed the feature/datasource-template branch from 155f985 to 5740ec7 Compare December 4, 2024 23:08
Copy link
Copy Markdown
Contributor

@mogrogan mogrogan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your solid contribution!

I've left 2 comments but it seems pretty good.

Comment thread datasource/proxmox/data.go Outdated
@castorsky
Copy link
Copy Markdown
Author

In the process of renaming the function and editing the documentation, I noticed two edge cases and fixed them

@castorsky castorsky requested a review from mogrogan December 15, 2024 15:10
Basic configuration verification copied from builder.
Template in directory test-fixtures works.
Used anonymous functions instead of a bunch of named ones.
Renamed package and corrected documentation accordingly.
@castorsky castorsky force-pushed the feature/datasource-template branch from 4a177f7 to c86ee55 Compare January 2, 2025 21:57
@camaeel
Copy link
Copy Markdown

camaeel commented Apr 22, 2025

@mogrogan Hi, any chances for having this merged and released?

@castorsky
Copy link
Copy Markdown
Author

I want to mention this issue from Proxmox Bugzilla: https://bugzilla.proxmox.com/show_bug.cgi?id=6156
There is a caveat using undocumented ctime field: all machines created from template have this field set to the template's creation time, not the machine's actual time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Datasource for finding existing VMs

3 participants