cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
537
Views
4
Helpful
2
Replies

redeploy a service from python using discard-non-service-config

Arne Vellinga
Level 1
Level 1

How do i redeploy a service using the following code in combination with discard-non-service-config

        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.')
1 Accepted Solution

Accepted Solutions

Nabsch
Spotlight
Spotlight

Hello

You need to add this 

inputs.reconcile.discard_non_service_config.create()

 

View solution in original post

2 Replies 2

Nabsch
Spotlight
Spotlight

Hello

You need to add this 

inputs.reconcile.discard_non_service_config.create()

 

Arne Vellinga
Level 1
Level 1

Ended up using successfull:

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()
                    inputs.reconcile.discard_non_service_config.create()
                    self.log.debug('Redeploying instance...')
                    instance.re_deploy(inputs)
                    self.log.debug('Instance reconciled.')