Skip to content
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

Documented variables machine & efidisk are not recognised #50

Closed
meaty-popsicle opened this issue Nov 23, 2021 · 13 comments
Closed

Documented variables machine & efidisk are not recognised #50

meaty-popsicle opened this issue Nov 23, 2021 · 13 comments

Comments

@meaty-popsicle
Copy link

Overview of the Issue

Variables machine & efidisk are not recognised
Despite being documented here and here variables are not recognised by packer and crash the build if decalred.

Reproduction Steps

Build a manifest with efidisk or machine present.

Plugin and Packer version

Packer v1.7.8
packer-plugin-proxmox v1.0.3

Simplified Packer Buildfile

Gist

Operating system and Environment details

goblin@goblin-officepc:~/code/packer-windows$ lsb_release -d
Description:	Ubuntu 20.04.3 LTS

Log Fragments and crash.log files

Full log:
Gist
Errors:

 on win10x64-enterprise.pkr.hcl line 65:
 (source code not available)

An argument named "efidisk" is not expected here.

Error: Unsupported argument

 on win10x64-enterprise.pkr.hcl line 66:
 (source code not available)

Error: Unsupported argument
An argument named "machine" is not expected here.
@meaty-popsicle
Copy link
Author

meaty-popsicle commented Nov 24, 2021

Confirmed the same behaviour on different Ubuntu 20.04.3 LTS with compiled from source and prebuilt plugin.

@meaty-popsicle
Copy link
Author

Also Using bios variable causes the same issue:

Error: Unsupported argument

  on win10x64-enterprise.pkr.hcl line 69:
  (source code not available)

An argument named "bios" is not expected here. Did you mean "boot"?

@meaty-popsicle
Copy link
Author

meaty-popsicle commented Nov 25, 2021

And just to make sure that it is not my machines doing that i ran everything inside of a docker container.
Version:

# docker run hashicorp/packer:full -v
1.7.8
# docker run \
-v /home/goblin/code/packer-windows:/workspace -w /workspace \
-e PACKER_PLUGIN_PATH=/workspace/.packer.d/plugins \
--entrypoint=/go/bin/packer \
hashicorp/packer:full \
build --var 'proxmox_host=pve3' --var-file=./dev-win10.pkrvars.hcl ./win10x64-enterprise.pkr.hcl

Error: Unsupported argument

  on ./win10x64-enterprise.pkr.hcl line 116:
  (source code not available)

An argument named "machine" is not expected here.

Error: Unsupported argument

  on ./win10x64-enterprise.pkr.hcl line 117:
  (source code not available)

An argument named "bios" is not expected here. Did you mean "boot"?

Error: Unsupported argument

  on ./win10x64-enterprise.pkr.hcl line 115:
  (source code not available)

An argument named "efidisk" is not expected here.

==> Wait completed after 1 microsecond

==> Builds finished but no artifacts were created.

@KnKay Maybe you can look at it since you implemented that feature?

@KnKay
Copy link
Contributor

KnKay commented Nov 25, 2021

@meaty-popsicle At the moment I am a bit busy. Will try to have a look next week.

Did you compile whole packer? I had the same issue during development. I renamed the module for this and that worked.
Not too sure when and how the package is going down into the binary.
One packer is using the default Plugin it cannot use the new keywords

@KnKay
Copy link
Contributor

KnKay commented Nov 26, 2021

Hi all,

so, I made a quick lookup in my setup.
I can confirm my thought. Even an packer run without init is running. Which is using a temp plugin. All fine.

But, once I do the packer init and add all to the config like @meaty-popsicle did, it should use the downloaded plugin.
This seem not to happen. At least on my debian machine.

I created a gist.
gist

Not sure what is happening.
During development I had the same problem. I just renamed the provider in the main to get all implemented. But this should defenetly not be the case.
I am even not sure wich plugin version is used.

At the moment I have no idea if this is indeed the packer thing or anything in my code part. Too much a noob in projects of this size and the packer import plugin thing

@KnKay
Copy link
Contributor

KnKay commented Nov 26, 2021

Hi all,

to be honest, I do not get it. I made my configuration workign with the correct plugin. But I get the same error.
Seems like there is some hcl converter not getting the meaning. But I have no clue why.

During time of the merge things worked @ronaldslc also validated this. It was working. Not sure if something in general changed?

@meaty-popsicle
Copy link
Author

@KnKay Thanks for your input. I recompiled only the plugin itself. In my case the plugin is downloaded successfully and is present on the file system during build, but throws errors. I am assuming that there is something in how packer interacts with the plugin or something with the compiled binary.Otherwise i am not sure what might be the issue too.

@KnKay
Copy link
Contributor

KnKay commented Nov 26, 2021

@meaty-popsicle not too happy, not to know where the stuff is going wrong.

As per my memory I had this, like mentioned, during development as well. What worked for this time is renaming the provider. Not sure if only the provider or the binary as well. But this is not really an option for normal use.

I added some ui output. But it did not even reach this point. So not sure what happens.
Also the output we see is not to find (for me) in the source code. So there may be a thing in getting the plugin correct.
I guess I will spend some more time getting back into this. But what is strange, my code is only adding the fields. All the stuff making the calls and having any kind of logic is in the telmate api.
So my thought, the added fields are not recognized during the config bake.

@KnKay
Copy link
Contributor

KnKay commented Nov 26, 2021

Okay. Got it more or less confirmed.

I removed all plugins downloaded. making a packer validate and getting the error.
Removed the bios thing, all is fine, build is running. => Something is knowing proxmox in some version/idea.

Renamed the provider to get list of available one. See gist

I recompiled the latest version of the packer plugin. Gave it a different naming.
All working fine. using proxmox2-proxmox-iso. Having the plugin in the source of my packer files.

Digging more into the list of the gist I saw some strange thing. There is a proxmox-proxmox-*** provider.
Using this one it works without my custom build.

So it seems saying the provider is proxmox-proxmox-iso solves the issue.

@meaty-popsicle
Copy link
Author

meaty-popsicle commented Nov 29, 2021

@KnKay Thanks for taking the time to check this issue out. Followed the same steps as you. After seeing your reply it seems that now you have to specify which builder you are attempting to use. After changing my plugin stanza to specify which builder i am using everything worked as is. In this case it is proxmox-iso.

packer {
  required_plugins {
     proxmox-iso = {  
       version = ">= 1.0.3"
      source  = "github.com/hashicorp/proxmox"
    }
  }
}

But still, for my previous builds that do not require variables efidisk, machine or bios everything is working fine with plugin being named just proxmox .

@KnKay
Copy link
Contributor

KnKay commented Nov 29, 2021

Sounds very good! Glad to see it was just a little thing.

Hope to remember this once i am back on the project that needed this!

Cheers!

@nywilken
Copy link
Contributor

nywilken commented Nov 1, 2022

Hi releases of the proxmox builders prior to v1.1.0, which was released today, were incorrectly registered as proxmox-promox-iso and proxmox-proxmox-clone. I suspect that this bug has to do with the the embedded version of the Proxmox being used over any externally installed version of the plugin. Which is why you had to change the required_plugins block to reference proxmox-iso and not proxmox.

The correct required plugins block should look like the following

packer {
  required_plugins {
     proxmox = {  
       version = ">= 1.1.0"
      source  = "github.com/hashicorp/proxmox"
    }
  }
}

You are encouraged to upgrade any locally installed version of this plugin to v1.1.0 and try again if you are still running into issues.

Refer to #119 for more details on the incorrectly registered builders.

@meaty-popsicle
Copy link
Author

@nywilken Thanks for detailed explanation! Will mark this issue as closed.

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

No branches or pull requests

3 participants