Esempio n. 1
0
    def setUp(self):

        sample_config = os.path.dirname(os.path.abspath(__file__)) +\
            '/masakari-controller-test.conf'
        rc_config = masakari_config.RecoveryControllerConfig(sample_config)
        with mock.patch('masakari_util.RecoveryControllerUtilApi') as mock_api:
            self.worker = masakari_worker.RecoveryControllerWorker(rc_config)
Esempio n. 2
0
 def __init__(self, config_object):
     """
     Constructor:
     This constructor creates RecoveryControllerWorker object.
     """
     self.rc_config = config_object
     self.rc_worker = worker.RecoveryControllerWorker(config_object)
     self.rc_util = util.RecoveryControllerUtil()
     self.rc_util_db = util.RecoveryControllerUtilDb(config_object)
     self.rc_util_api = util.RecoveryControllerUtilApi(config_object)
Esempio n. 3
0
    def __init__(self):
        """
        Constructor:
        This constructor creates
        RecoveryController object,
        RecoveryControllerStarter object,
        RecoveryControllerUtil object,
        RecoveryControllerWorker object.
        """
        try:
            self.rc_config = config.RecoveryControllerConfig()
            self.rc_starter = starter.RecoveryControllerStarter(
                self.rc_config)
            self.rc_util = util(self.rc_config)
            self.rc_util_db = util_db(self.rc_config)
            self.rc_worker = worker.RecoveryControllerWorker(self.rc_config)
        except:
            logger = logging.getLogger()
            logger.setLevel(logging.ERROR)
            f = "%(asctime)s " + \
                " masakari(%(process)d): %(levelname)s: %(message)s'"
            formatter = logging.Formatter(fmt=f, datefmt='%b %d %H:%M:%S')

            # create log dir if not created
            log_dir = '/var/log/masakari/'
            try:
                os.makedirs(log_dir)
            except OSError as exc:
                if exc.errno == errno.EEXIST and os.path.isdir(log_dir):
                    pass
                else:
                    raise

            fh = logging.FileHandler(
                filename='/var/log/masakari/masakari-controller.log')
            fh.setLevel(logging.ERROR)
            fh.setFormatter(formatter)
            logger.addHandler(fh)

            msg = "--MonitoringMessage--ID:[%s]" %("RecoveryController_0003")
            logger.error(msg)

            error_type, error_value, traceback_ = sys.exc_info()
            tb_list = traceback.format_tb(traceback_)
            logger.error(error_type)
            logger.error(error_value)

            for tb in tb_list:
                logger.error(tb)

            logger.removeHandler(fh)

            sys.exit()
    def setUp(self):

        sample_config = os.path.dirname(os.path.abspath(__file__)) +\
            '/masakari-controller-test.conf'
        rc_config = masakari_config.RecoveryControllerConfig(sample_config)
        self.worker = masakari_worker.RecoveryControllerWorker(rc_config)