01-23-2020 06:28 AM
Hello can you help on this please,
I'd like to re-deploy a service from my python code.
your help will be appreciate.
regards.
01-24-2020 05:36 AM
with ncs.maapi.Maapi() as m: with ncs.maapi.Session(m, 'admin', 'system'): with m.start_read_trans() as t: instance = ncs.maagic.get_node(t, dst_path) inputs = instance.re_deploy.get_input() inputs.reconcile.create() self.log.debug('Redeploying instance...') instance.re_deploy(inputs) self.log.debug('Instance reconciled.')
This one is for re-deploy reconcile, but you can set whatever parameters you want instead.
01-24-2020 06:49 AM
Hello Dear Thanks for your reply, could you please tell me what represent
dst_path
is it a variable that containe the service name?
regards.
01-24-2020 07:29 AM
Hello I have test the code and debug, here the working code hope it will help someone else:
dst_path = SERVICE_NAME with ncs.maapi.Maapi() as m: with ncs.maapi.Session(m, 'admin', 'system'): with m.start_read_trans() as t: instance = ncs.maagic.get_node(t, dst_path) inputs = instance["service_id"].re_deploy.get_input() inputs.reconcile.create() self.log.debug('Redeploying instance...') instance["service_id"].re_deploy(inputs) self.log.debug('Instance reconciled.')
01-24-2020 08:04 AM
01-27-2020 01:58 AM
please what you mean? could you be most explicit.
01-27-2020 09:03 AM
01-28-2020 12:26 AM
Hello dear could you please share an example of the best practice.
regards.
01-28-2020 09:17 AM
01-29-2020 01:59 AM - edited 01-29-2020 02:03 AM
Hello, You just said that it is bad idea to use create() function since it start a new transaction.
So I'm asking according to you how could I manage service re-deploy from python.
01-29-2020 07:11 AM
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