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

Remove description from ip address #84

Closed
smutel opened this issue Jun 21, 2020 · 6 comments
Closed

Remove description from ip address #84

smutel opened this issue Jun 21, 2020 · 6 comments

Comments

@smutel
Copy link
Contributor

smutel commented Jun 21, 2020

Hello,

I created an IP address with go-netbox with the parameters below:

  • address: 192.168.56.1/24
  • description = "Address created by terraform"
  • tenant_id: 5

When I want to update the description, it's working fine:

params := &models.WritableIPAddress{}

address := "192.168.56.1/24"
params.Address = &address

description := "Description updated"
params.Description = description

resource := ipam.NewIpamIPAddressesUpdateParams().WithData(params)
_, err = client.Ipam.IpamIPAddressesUpdate(resource, nil)
if err != nil {
  return err
}

Here is what I see throw tcpdump:

{"address":"192.168.56.1/24","created":"0001-01-01","description":"Description updated","last_updated":"0001-01-01T00:00:00.000Z","nat_outside":null,"tags":[]}

But if I would like to remove the description from that IP address, it does not work.
I use the same code than above but I don't set description.
Here is what I see throw tcpdump:

{"address":"192.168.56.1/24","created":"0001-01-01","last_updated":"0001-01-01T00:00:00.000Z","nat_outside":null,"tags":[]}

If I check in Netbox, the description is still there.

Also what is the difference between PartialUpdate and Update functions ?

Thanks.

@fbreckle
Copy link

Hi,

not really affiliated with the devs of go-netbox, but here are my observations from writing my own netbox provider:

I found that for comments on virtual machines, updating with a single space string (" ") works to delete the string.

As to what is the difference between Partial und normal update: My assumption is that per https://netbox.readthedocs.io/en/stable/api/overview/#what-is-a-rest-api , partial update should probably be PATCH whereas normal update is PUT. If I remember correctly, tests on this are not really reflecting this, though. You might want to try it againg yourself.

@smutel
Copy link
Contributor Author

smutel commented Jun 22, 2020

Oh. Thanks.
What is the link of your provider ?

@fbreckle
Copy link

Its not public yet, since its heavy WIP. I invited you.

@smutel
Copy link
Contributor Author

smutel commented Jun 22, 2020

Here is mine if you want to look at it: https://github.com/smutel/terraform-provider-netbox

@smutel
Copy link
Contributor Author

smutel commented Jun 22, 2020

Perhaps we can try to move all this work to netbox-community to share the effort ?

I tried you option with description and it is working as expected.
I did the same thing for DNS name and unfortunately it is not working 😢

@fbreckle
Copy link

The error is probably the same as #54

@smutel smutel closed this as completed Jun 25, 2020
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

No branches or pull requests

2 participants