- CheckMates
- :
- Products
- :
- Developers
- :
- API / CLI Discussion
- :
- Re: Validation error for non existed object when c...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Validation error for non existed object when creating with API
Hello everyone,
We are trying to create objects and add these object to a spesific group in our management servers with Ansible using web service rest API functions. We have two management server and want to do same operation on both servers. Looping the management IP addresses so the automation starts with loop's first member, after finishing the task for it then proceed to the next one to execute the same tasks. The objects we are trying to add are not exist in management servers by the way. We are creating from scratch.
We have some problem at this point.
Scenario1 : loop first member: MGMT1, second member MGMT2
Scenario2 : loop first member: MGMT2, second member MGMT1
In scenario1, for the MGMT1 all tasks executed successfully, but in MGMT2 we are having validation warning and errors like below.
In scenario2, for the MGMT2 is succesfull, but this time we are seeing the same validation warning and errors for MGMT1.
"code": "err_validation_failed",
"message": "Validation failed with 1 warning and 1 error",
"warnings": [
{
"message": "Multiple objects have the same IP address 19.19.19.19"
}
],
"errors": [
{
"message": "More than one object named '19.19.19.19' exists."
}
There is no object the IP or name 19.19.19.19 on both management servers. Do you have any idea why we are getting this validation warning and errors?
- Tags:
- api
- error
- validation
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi again,
We check the code again and realize that in the second loop, the not exist host appended to the same variable twice. So in the second loop the API tries to create the same host two times. The first creation is ok but then in the second try the management gives this validation error. (it is expected). As a solution we removed the dublicate host entries in the appended variable. The automation now works as expected.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are MGMT1 and MGMT2 in a Management HA configuration with each other?
What version/JHF is being used?
By what method did you attempt to verify objects do not exist with that IP address?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Additionally, it'd be helpful to see the code you actually used to achieve what you did.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear PhoneBoy,
First of all, I can not share the code with you because of my company policy. But I will explain what we are doing in this automation.
Main functions;
1- login
2-check host existence with show-host from a list of new host entries. If find existence skip, if the host is not in management then append the list for step-3
3-create host based on not exist host list taken from step-2 with create-host. Now all host are exist in management.
4-add all of the host to the specific group
5-publish
6-logout.
MGMT1 and MGMT2 are not HA, they are separeted management servers. As I explained in my post, the code not problematic, when I change the loop order previous problematic management is working expected but in this time the second member of the loop not working as expected. It is throwing the validation warning and error message in step 3. I check the step 3 and saw that the host created successfully, but immediately give this validation warn and error. In the sessions tab of the problematic management there is a change report that shows host created but it is not publish due to the error.
I will share the version details of MGMTs in a private message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi again,
We check the code again and realize that in the second loop, the not exist host appended to the same variable twice. So in the second loop the API tries to create the same host two times. The first creation is ok but then in the second try the management gives this validation error. (it is expected). As a solution we removed the dublicate host entries in the appended variable. The automation now works as expected.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad you figured it out 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Need more details about exactly what Step 2 is doing (including precise API calls used).
Did you use SmartConsole to verify the result as it should be able to search the object database?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi again,
As of now, we detected that the issue is not related Checkpoint API or management server. They are working as expected. The code for this automation has some dublication problem and we solved it today. In the end all working properly. Thank you for your interest and answers PhoneBoy.
