01-26-2022 12:38 AM
Hello,
I'm wondering how can I add a comment to a commit launched from python code using MAAPI API.
I found that there is a function called
int maapi_set_comment(int sock, int thandle, const char *comment)
but I didn't figure out how can I use it.
Thanks in advance,
Solved! Go to Solution.
01-26-2022 09:16 AM - edited 01-28-2022 04:02 AM
Hello Alaeddine ,
Here an example where i create a device-group then i set a comment
with ncs.maapi.Maapi() as m:
with ncs.maapi.Session(m, 'admin', 'test_context'):
with m.start_write_trans() as trans:
root = ncs.maagic.get_root(trans)
root.ncs__devices.device_group.create("test-python512115")
trans.set_comment("commit via PYTHON1")
trans.apply()
You can verify the comment in cli
admin@ncs# show configuration commit list 2022-01-26 18:15:19 SNo. ID User Client Time Stamp Label Comment ~~~~ ~~ ~~~~ ~~~~~~ ~~~~~~~~~~ ~~~~~ ~~~~~~~ 10017 10017 admin system 2022-01-26 18:06:46 commit via PYTHON1
01-26-2022 09:16 AM - edited 01-28-2022 04:02 AM
Hello Alaeddine ,
Here an example where i create a device-group then i set a comment
with ncs.maapi.Maapi() as m:
with ncs.maapi.Session(m, 'admin', 'test_context'):
with m.start_write_trans() as trans:
root = ncs.maagic.get_root(trans)
root.ncs__devices.device_group.create("test-python512115")
trans.set_comment("commit via PYTHON1")
trans.apply()
You can verify the comment in cli
admin@ncs# show configuration commit list 2022-01-26 18:15:19 SNo. ID User Client Time Stamp Label Comment ~~~~ ~~ ~~~~ ~~~~~~ ~~~~~~~~~~ ~~~~~ ~~~~~~~ 10017 10017 admin system 2022-01-26 18:06:46 commit via PYTHON1
01-26-2022 11:34 AM
Thank you very much for your reply.
01-26-2022 08:37 PM
Hello @AlaeddineJebnoun90723 and @Nabsch,
Would you please provide a link to the MAAPI API? I'm not familiar with this API and am interested in learning more about it.
Thanks!
01-26-2022 11:31 PM
01-26-2022 11:45 PM
Thank you @Nabsch.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide