# encoding: utf-8
'''
The main entry point for salt-api
'''
from __future__ import absolute_import
# Import python libs
import logging

# Import salt-api libs
import salt.loader
import salt.utils.process

logger = logging.getLogger(__name__)


class NetapiClient(object):
    '''
    Start each netapi module that is configured to run
    '''
    def __init__(self, opts):
        self.opts = opts
        self.process_manager = salt.utils.process.ProcessManager()
        self.netapi = salt.loader.netapi(self.opts)

    def run(self):
        '''
        Load and start all available api modules
        '''
        for fun in self.netapi:
            if fun.endswith('.start'):
                logger.info('Starting {0} netapi module'.format(fun))
                self.process_manager.add_process(self.netapi[fun])

        self.process_manager.run()

# encoding: utf-8
'''
The main entry point for salt-api
'''
from __future__ import absolute_import
# Import python libs
import logging

# Import salt-api libs
import salt.loader
import salt.utils.process

logger = logging.getLogger(__name__)


class NetapiClient(object):
    '''
    Start each netapi module that is configured to run
    '''
    def __init__(self, opts):
        self.opts = opts
        self.process_manager = salt.utils.process.ProcessManager()
        self.netapi = salt.loader.netapi(self.opts)

    def run(self):
        '''
        Load and start all available api modules
        '''
        if not len(self.netapi):
            logger.error("Did not find any netapi configurations, nothing to start")

        for fun in self.netapi:
            if fun.endswith('.start'):
                logger.info('Starting {0} netapi module'.format(fun))
                self.process_manager.add_process(self.netapi[fun])

        self.process_manager.run()

Add log error if we run salt-api w/ no config
Add log error if we run salt-api w/ no config

Currently, the salt-api script will exit with no error or hint of why it
failed if there is no netapi module configured.  Added a short line if
we find no api modules to start, warning the user that the config may be
missing.

Fixes #28240
