- CheckMates
- :
- Products
- :
- Developers
- :
- API / CLI Discussion
- :
- where-used and replace question
- 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
where-used and replace question
As Subject
where-used question
I had collected all the objects uid with a json file and run a command, the result show as below
Is it possible execute each line (uid) of the file ?
then replace question
I know a method to replace the object to None (remove item) then delete it manually.
object right click > where_used > press "replace" > drop_down_menu select "None(remove item)" > then select objects or policy item
Is there a api command to do this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Each call to where-used only accepts one UUID. Check out xargs. It can ingest a stream of many lines or fields, carve them up into a series of grouped fields, then run a command separately for each group.
As for the replacement, I don't know of an API command to do that in one call.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe “none” is merely a specific object reference.
@Omer_Kleinstern would know for sure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, "None" is just a special object with the UUID 97aeb36a-9aea-11d5-bd16-0090272ccb30 and the type "CpmiAnyObject". It's like "Any" (97aeb369-9aea-11d5-bd16-0090272ccb30). Their UUIDs only differ in the 8th digit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That means it is impossible to replace the objects via api comments.
I also tried the "where-used", it can read each line, but still not work. the command not found.
Any suggestion 😞?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Like I said earlier, check out xargs. I don't know what your uid.json file contains, but if it's just a list of UUIDs, one per line, you could use it like this:
xargs <uid.json -L 1 mgmt_cli -r true where-used uid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What you're asking is fairly basic scripting.
Here's how to do this while minimizing the number of sessions created:
mgmt_cli -r true login > sid.txt
cat uid.json | while read X; do
mgmt_cli -s sid.txt where-used uid $X
done
mgmt_cli -s sid.txt logout
Perhaps xargs can do this a bit more cleanly 🙂
