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

Fix Ipconfigmap empty values #696

Merged
merged 1 commit into from
Mar 2, 2023
Merged

Conversation

tnyeanderson
Copy link
Contributor

@tnyeanderson tnyeanderson commented Feb 19, 2023

See the following correlated PR for an issue description and details:

Telmate/proxmox-api-go#238

Currently, every ipconfigX config property is set to an empty string no matter what. This is due to the use of .Get():

Get returns the data for the given key, or nil if the key doesn't exist
in the schema.

If the key does exist in the schema but doesn't exist in the configuration,
then the default value for that type will be returned. For strings, this is
"", for numbers it is 0, etc.

The problem is this will always return an empty string. That mixed with the .(string) cast makes for a bug.

The map value for each ipconfig entry should not be set unless it actually is set in the config. This PR uses .GetOk() instead, and only sets the map value when there actually is one.

@tnyeanderson
Copy link
Contributor Author

@mleone87 gentle ping for this and Telmate/proxmox-api-go#238 :)

@mleone87 mleone87 merged commit 5edfb69 into Telmate:master Mar 2, 2023
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.

2 participants