Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Linus_Espach
Participant
Jump to solution

Management API - Using CSV to bulk add objects - Doubled Items

Hi CP-Team,

 

I am trying to add a bunch of network-objects at a time. I have a csv-file with this syntax:

 

name, comments, subnet, mask-length, color

<nam_1>, <com_1>, <x.x.x.x>>, 16, forest green

 

If I no call the csv via <mgmt_cli add network --batch test_add.csv> I get warnings if a object is reached, which has the same network-definition. 
I would like the API to just skip these elements, but process the others instead of stopping and discarding all. (the --ignore-errors would just ignore the warning and double objects, what is not my intension).

 

Best regards

0 Kudos
1 Solution

Accepted Solutions
PhoneBoy
Admin
Admin
There is not a skip-if-exists option.
The set-if-exists option will update the existing object, assuming you're using the same name,
But it sounds like you have two different object names with the same network definition.
And, at the moment, your options are to remove the offending entries from the CSV or use ignore-warnings true and have multiple definitions of the same network.

View solution in original post

4 Replies
PhoneBoy
Admin
Admin

Add set-if-exists true to your command line.

0 Kudos
Linus_Espach
Participant
Hi PhoneBoy,
thanks for your fast reply.
I didn`t see the <more> options, nice 2 have. In this case I am more looking for a <skip-if-exists> option, but probably it doesn`t exist.
Best regards,
0 Kudos
PhoneBoy
Admin
Admin
There is not a skip-if-exists option.
The set-if-exists option will update the existing object, assuming you're using the same name,
But it sounds like you have two different object names with the same network definition.
And, at the moment, your options are to remove the offending entries from the CSV or use ignore-warnings true and have multiple definitions of the same network.
Linus_Espach
Participant
That did not resolve the issue. If i add set-if-exists true to my command, I still get the warning and the validation failed. If I add an additions ignore-warnings true, the object is not updated, but a second with same subnet and mask is created.
0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events