contabo / cntb

Contabo Command Line Interface
https://contabo.com
GNU General Public License v3.0
179 stars 24 forks source link

Incorrect error message or bug with reinstallation with cloud-init #28

Closed Joselu21 closed 1 year ago

Joselu21 commented 1 year ago

I'm encountering an issue while trying to use cloud-init to automate the installation of my VPS. This is crucial for me as I aim to create a small cluster of 4 VPS instances with installed and configured public services.

Unfortunately, the Contabo client panel does not seem to support this functionality. Therefore, I have resorted to using the CLI tool.

During my exploration, I discovered a flag called --file which allows me to perform a reinstall using my cloud-init.yml configuration.

To reinstall the instance, I executed the following command:

.\cntb.exe reinstall instance <<myId>> --imageId "afecbb85-e2fc-46f0-9684-b46b1faf00bb" --file "cloud-init.yml"

However, the output I received was as follows:

level=error msg="Error while reinstalling instance: 400 - [imageId must be a UUID]\n"
level=fatal msg="Aborting, due to errors"

Expected Behavior

The instance should be reinstalled successfully using the specified cloud-init.yml configuration file. Or if there is another error with my way of passing the file as an argument the error message should be descriptive and not point to an error with the imageId

Actual Behavior

Reinstallation fails with the error message: "Error while reinstalling instance: 400 - [imageId must be a UUID]."

Additional Information

ngotzmann commented 1 year ago

Hi, thanks for reporting this! The --file flag is meant to be used instead of all other flags.
So your command should look like this:

.\cntb.exe reinstall instance <<myId>> --file "reinstall_config.yml"

That means, you have to define the ImageId inside the reinstall_config.yml. As example:

imageId: "db1409d2-ed92-4f2f-978e-7b2fa4a1ec90"
userData: |
  package_update: true

We will adjust the message for the "--flag" and react properly to the error on the next version!