Skip to content
This repository was archived by the owner on Jan 8, 2021. It is now read-only.

Cleanup tasks fail for IP defined vCenter hosts #51

Closed
jjhidalgar opened this issue Feb 4, 2020 · 5 comments
Closed

Cleanup tasks fail for IP defined vCenter hosts #51

jjhidalgar opened this issue Feb 4, 2020 · 5 comments

Comments

@jjhidalgar
Copy link

I found this error in my setup when trying to clean.

I did notice that all my elements (devices, vms, ips...) have these three tags: "Synced", "vCenter" and "10.102.138.31"
The last one looks weird, maybe it's the one causing errors. That is in fact the IP of the following VM: "nxt-vcenter-01"

jaimejoseba at CH-JJOSEBA-MBP in ~/working/vcenter-netbox-sync
$ python3 run.py -c -v
2020-02-04 14:15:44,630 [DEBUG] Log level has been overriden by the --verbose argument.
2020-02-04 14:15:44,631 [INFO] Preparing for removal of all NetBox synced vCenter objects.
2020-02-04 14:15:44,631 [INFO] Collecting all current NetBox ip_addresses objects to prepare for deletion.
2020-02-04 14:15:44,632 [DEBUG] Sending GET to 'http://10.102.140.212:80/api/ipam/ip-addresses/?tag=10.102.138.31' with data 'None'.
2020-02-04 14:15:44,657 [DEBUG] Received HTTP Status 400.
2020-02-04 14:15:44,657 [CRITICAL] Well this in unexpected. Please report this. GET request received 400 status with body 'None' and response '{'tag': ['Select a valid choice. 10.102.138.31 is not one of the available choices.']}'.

@synackray
Copy link
Owner

Hello again, @jaimehrubiks! Let me take a quick look at this. The tags are derived from the vCenter hosts configuration in settings.py. Did you define the vCenter host as an IP address? I thought I had properly caught and formatted these cases but clearly I missed something. I'll let you know!

@jjhidalgar
Copy link
Author

I did @synackray, it is an IP address :P

@synackray
Copy link
Owner

:') No worries. This was a simple mistake on my part. After adjustments here is what I see.

2020-02-04 22:03:54,938 [DEBUG] Log level has been overriden by the --verbose argument.
2020-02-04 22:03:54,939 [INFO] Created new HTTP Session for NetBox.
2020-02-04 22:03:54,939 [DEBUG] Host specific vCenter credentials provided for '10.10.0.11'.
2020-02-04 22:03:54,953 [INFO] Detected NetBox API v2.7.
2020-02-04 22:03:54,954 [INFO] Preparing for removal of all NetBox synced vCenter objects.
2020-02-04 22:03:54,954 [INFO] Collecting all current NetBox ip_addresses objects to prepare for deletion.
2020-02-04 22:03:54,954 [DEBUG] Sending GET to 'http://localhost:32777/api/ipam/ip-addresses/?tag=10-10-0-11' with data 'None'.
2020-02-04 22:04:57,876 [INFO] NetBox successfully deleted sites object.
<snipped a bunch of object removals>
2020-02-04 22:04:57,876 [INFO] Completed removal of vCenter instance '10.10.0.11' objects. Total execution time 0:01:02.937872.

@synackray synackray changed the title Error when cleaning. Tag select a valid choice Cleanup tasks fail for IP defined vCenter hosts Feb 4, 2020
synackray added a commit that referenced this issue Feb 4, 2020
…osts

Fixed cleanup requests for IP defined vCenter hosts for #51
@synackray
Copy link
Owner

Merged into develop.

@jjhidalgar
Copy link
Author

Works great, thanks.

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

No branches or pull requests

2 participants