예제 #1
0
// Close stops the fleettracker instance.
func (tracker *FleetTracker) Close() {
	tracker.serviceSKA.Stop()
	err := scale.DeregisterService(InstanceIDFlag.Get())
	if err != nil {
		logger.WithFields("err", err).Error(
			"Error deregistering fleettracker service")
	}
}
예제 #2
0
// Close closes the server.
func (dl *DevLogger) Close() {
	dl.serviceSKA.Stop()
	err := scale.DeregisterService(InstanceIDFlag.Get())
	if err != nil {
		logger.WithFields("err", err).Error(
			"Error deregistering devlogger service")
	}
	dl.server.Kill()
	close(dl.channel)
}
예제 #3
0
// Close stops the manager.
func (manager *Manager) Close() {
	manager.serviceSKA.Stop()
	err := scale.DeregisterService(InstanceIDFlag.Get())
	if err != nil {
		manager.logger.WithFields("err", err).Error(
			"Error deregistering manager service")
	}
	manager.sessionSKA.Stop()
	err = manager.resource.Deregister()
	if err != nil {
		manager.logger.WithFields("err", err).Error(
			"Error deregistering manager resource")
	}

	// TODO: Remove all instances and environments.
}
예제 #4
0
func (instance *LeverInstance) closeInternal(kill bool) {
	if instance.closing {
		return
	}
	instance.closing = true

	// Remove the resources.
	for _, resource := range instance.leverResources {
		resource.SoftClose()
	}

	instance.expiryTimer.Stop()
	if instance.sessionKAB != nil {
		instance.sessionKAB.Close()
	}
	instance.serviceSKA.Stop()

	err := instance.termContainer(kill)
	if err != nil {
		instance.logger.WithFields("err", err).Debug("Kill error")
	}

	// Async so as not to hog the lock.
	go func() {
		err = scale.DeregisterService(instance.instanceID)
		if err != nil {
			instance.logger.WithFields("err", err).Error(
				"Service deregister error")
		}
		if instance.levInstResource != nil {
			err = instance.levInstResource.Deregister()
			if err != nil {
				instance.logger.WithFields("err", err).Debug(
					"Instance lock deregister error")
			}
		}
	}()

	go instance.onCloseFun(instance.instanceID, nil)
}