コード例 #1
0
ファイル: options.py プロジェクト: julien6387/supervisors
 def server_configs_from_parser(self, parser):
     """ The following has nothing to deal with Supervisor's server configurations.
     It gets Supvisors configuration.
     Supervisor's ServerOptions has not been designed to be specialized.
     This method is overriden just to have an access point to the Supervisor parser. """
     configs = ServerOptions.server_configs_from_parser(self, parser)
     # set section
     if not parser.has_section(SupvisorsServerOptions._Section):
         raise ValueError('.ini file ({}) does not include a [{}] section'.format(self.configfile, self._Section))
     temp, parser.mysection = parser.mysection, self._Section
     # get values
     opt = self.supvisors_options
     opt.address_list = list(OrderedDict.fromkeys(filter(None, list_of_strings(parser.getdefault('address_list', gethostname())))))
     opt.rules_file = parser.getdefault('rules_file', None)
     if opt.rules_file:
         opt.rules_file = existing_dirpath(opt.rules_file)
     opt.internal_port = self.to_port_num(parser.getdefault('internal_port', '65001'))
     opt.event_port = self.to_port_num(parser.getdefault('event_port', '65002'))
     opt.auto_fence = boolean(parser.getdefault('auto_fence', 'false'))
     opt.synchro_timeout = self.to_timeout(parser.getdefault('synchro_timeout', '15'))
     opt.conciliation_strategy = self.to_conciliation_strategy(parser.getdefault('conciliation_strategy', 'USER'))
     opt.starting_strategy = self.to_starting_strategy(parser.getdefault('starting_strategy', 'CONFIG'))
     # configure statistics
     opt.stats_periods = self.to_periods(list_of_strings(parser.getdefault('stats_periods', '10')))
     opt.stats_histo = self.to_histo(parser.getdefault('stats_histo', 200))
     opt.stats_irix_mode = boolean(parser.getdefault('stats_irix_mode', 'false'))
     # configure logger
     opt.logfile = existing_dirpath(parser.getdefault('logfile', '{}.log'.format(SupvisorsServerOptions._Section)))
     opt.logfile_maxbytes = byte_size(parser.getdefault('logfile_maxbytes', '50MB'))
     opt.logfile_backups = integer(parser.getdefault('logfile_backups', 10))
     opt.loglevel = logging_level(parser.getdefault('loglevel', 'info'))
     # reset mysection and return original result
     parser.mysection = temp
     return configs
コード例 #2
0
 def server_configs_from_parser(self, parser):
     """ The following has nothing to deal with Supervisor's server configurations.
     It gets Supvisors configuration.
     Supervisor's ServerOptions has not been designed to be specialized.
     This method is overriden just to have an access point to the Supervisor parser. """
     configs = ServerOptions.server_configs_from_parser(self, parser)
     # set section
     if not parser.has_section(SupvisorsServerOptions._Section):
         raise ValueError(
             '.ini file ({}) does not include a [{}] section'.format(
                 self.configfile, self._Section))
     temp, parser.mysection = parser.mysection, self._Section
     # get values
     opt = self.supvisors_options
     opt.address_list = list(
         OrderedDict.fromkeys(
             filter(
                 None,
                 list_of_strings(
                     parser.getdefault('address_list', gethostname())))))
     opt.deployment_file = parser.getdefault('deployment_file', None)
     if opt.deployment_file:
         opt.deployment_file = existing_dirpath(opt.deployment_file)
     opt.internal_port = self.to_port_num(
         parser.getdefault('internal_port', '65001'))
     opt.event_port = self.to_port_num(
         parser.getdefault('event_port', '65002'))
     opt.auto_fence = boolean(parser.getdefault('auto_fence', 'false'))
     opt.synchro_timeout = self.to_timeout(
         parser.getdefault('synchro_timeout', '15'))
     opt.conciliation_strategy = self.to_conciliation_strategy(
         parser.getdefault('conciliation_strategy', 'USER'))
     opt.deployment_strategy = self.to_deployment_strategy(
         parser.getdefault('deployment_strategy', 'CONFIG'))
     # configure statistics
     opt.stats_periods = self.to_periods(
         list_of_strings(parser.getdefault('stats_periods', '10')))
     opt.stats_histo = self.to_histo(parser.getdefault('stats_histo', 200))
     opt.stats_irix_mode = boolean(
         parser.getdefault('stats_irix_mode', 'false'))
     # configure logger
     opt.logfile = existing_dirpath(
         parser.getdefault('logfile', '{}.log'.format(
             SupvisorsServerOptions._Section)))
     opt.logfile_maxbytes = byte_size(
         parser.getdefault('logfile_maxbytes', '50MB'))
     opt.logfile_backups = integer(parser.getdefault('logfile_backups', 10))
     opt.loglevel = logging_level(parser.getdefault('loglevel', 'info'))
     # reset mysection and return original result
     parser.mysection = temp
     return configs
コード例 #3
0
ファイル: sparser.py プロジェクト: www3838438/supvisors
 def get_program_addresses(self, program_elt, rules):
     value = program_elt.findtext('addresses')
     if value:
         # sort and trim
         addresses = list(OrderedDict.fromkeys(filter(None, list_of_strings(value))))
         if '*' in addresses:
             rules.addresses = [ '*' ]
         elif '#' in addresses:
             rules.addresses = [ '#' ]
         else:
             rules.addresses = self.supvisors.address_mapper.filter(addresses)
コード例 #4
0
 def test_list_of_strings_returns_empty_list_for_empty_string(self):
     actual = datatypes.list_of_strings('')
     self.assertEqual(actual, [])
コード例 #5
0
 def _callFUT(self, arg):
     return datatypes.list_of_strings(arg)
コード例 #6
0
 def test_list_of_strings_returns_strings_with_whitespace_stripped(self):
     actual = datatypes.list_of_strings(" foo , bar ")
     self.assertEqual(actual, ["foo", "bar"])
コード例 #7
0
 def test_list_of_strings_returns_list_of_strings_by_comma_split(self):
     actual = datatypes.list_of_strings("foo,bar")
     self.assertEqual(actual, ["foo", "bar"])
コード例 #8
0
 def test_list_of_strings_returns_empty_list_for_empty_string(self):
     actual = datatypes.list_of_strings("")
     self.assertEqual(actual, [])
コード例 #9
0
 def __init__(self, supervisord, whitelist=[]):
     self.supervisord = supervisord
     self._whitelist = list_of_strings(whitelist)
コード例 #10
0
ファイル: rpcinterface.py プロジェクト: rchateauneu/survol
 def __init__(self, supervisord, whitelist=[]):
     self.supervisord = supervisord
     self._whitelist = list_of_strings(whitelist)
     print(__file__ + " whitelist=", whitelist)
コード例 #11
0
 def __init__(self, supervisord, whitelist=[]):
     self.supervisord = supervisord
     self._whitelist = list_of_strings(whitelist)
コード例 #12
0
 def test_list_of_strings_returns_strings_with_whitespace_stripped(self):
     actual = datatypes.list_of_strings(' foo , bar ')
     self.assertEqual(actual, ['foo', 'bar'])
コード例 #13
0
 def test_list_of_strings_returns_list_of_strings_by_comma_split(self):
     actual = datatypes.list_of_strings('foo,bar')
     self.assertEqual(actual, ['foo', 'bar'])
コード例 #14
0
ファイル: test_datatypes.py プロジェクト: Girgitt/supervisor
 def _callFUT(self, arg):
     return datatypes.list_of_strings(arg)
コード例 #15
0
 def test_list_of_strings_returns_list_of_strings_by_comma_split(self):
     actual = datatypes.list_of_strings('foo,bar')
     self.assertEqual(actual, ['foo', 'bar'])
コード例 #16
0
 def test_list_of_strings_returns_strings_with_whitespace_stripped(self):
     actual = datatypes.list_of_strings(' foo , bar ')
     self.assertEqual(actual, ['foo', 'bar'])
コード例 #17
0
 def __init__(self, supervisord, whitelist=[]):
     self.supervisord = supervisord
     self._whitelist = list_of_strings(whitelist)
     # lets save time settings
     self.starttime = int(time.time())