Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
programs = []
program_name = process_or_group_name(section.split(':', 1)[1])
host_node_name = platform.node()
common_expansions = {'here':self.here,
'program_name':program_name,
'host_node_name':host_node_name,
'group_name':group_name}
def get(section, opt, *args, **kwargs):
expansions = kwargs.get('expansions', {})
expansions.update(common_expansions)
kwargs['expansions'] = expansions
return parser.saneget(section, opt, *args, **kwargs)
priority = integer(get(section, 'priority', 999))
autostart = boolean(get(section, 'autostart', 'true'))
autorestart = auto_restart(get(section, 'autorestart', 'unexpected'))
startsecs = integer(get(section, 'startsecs', 1))
startretries = integer(get(section, 'startretries', 3))
stopsignal = signal_number(get(section, 'stopsignal', 'TERM'))
stopwaitsecs = integer(get(section, 'stopwaitsecs', 10))
stopasgroup = boolean(get(section, 'stopasgroup', 'false'))
killasgroup = boolean(get(section, 'killasgroup', stopasgroup))
exitcodes = list_of_exitcodes(get(section, 'exitcodes', '0,2'))
# see also redirect_stderr check in process_groups_from_parser()
redirect_stderr = boolean(get(section, 'redirect_stderr','false'))
numprocs = integer(get(section, 'numprocs', 1))
numprocs_start = integer(get(section, 'numprocs_start', 0))
environment_str = get(section, 'environment', '', do_expand=False)
stdout_cmaxbytes = byte_size(get(section,'stdout_capture_maxbytes','0'))
stdout_events = boolean(get(section, 'stdout_events_enabled','false'))
stderr_cmaxbytes = byte_size(get(section,'stderr_capture_maxbytes','0'))
def processes_from_section(self, parser, section, group_name,
klass=None):
if klass is None:
klass = ProcessConfig
programs = []
get = parser.saneget
program_name = section.split(':', 1)[1]
priority = integer(get(section, 'priority', 999))
autostart = boolean(get(section, 'autostart', 'false'))
autorestart = auto_restart(get(section, 'autorestart', 'unexpected'))
startsecs = integer(get(section, 'startsecs', 1))
startretries = integer(get(section, 'startretries', 3))
uid = name_to_uid(get(section, 'user', None))
stopsignal = signal_number(get(section, 'stopsignal', 'TERM'))
stopwaitsecs = integer(get(section, 'stopwaitsecs', 10))
stopasgroup = boolean(get(section, 'stopasgroup', 'false'))
killasgroup = boolean(get(section, 'killasgroup', stopasgroup))
exitcodes = list_of_exitcodes(get(section, 'exitcodes', '0,2'))
redirect_stderr = boolean(get(section, 'redirect_stderr','false'))
numprocs = integer(get(section, 'numprocs', 1))
numprocs_start = integer(get(section, 'numprocs_start', 0))
process_name = get(section, 'process_name', '%(program_name)s')
environment_str = get(section, 'environment', '')
stdout_cmaxbytes = byte_size(get(section,'stdout_capture_maxbytes','0'))
stdout_events = boolean(get(section, 'stdout_events_enabled','false'))
directory = get('directory', None)
if directory is None:
section.directory = None
else:
section.directory = existing_directory(directory)
section.user = get('user', None)
section.umask = octal_type(get('umask', '022'))
section.logfile = existing_dirpath(get('logfile', 'supervisord.log'))
section.logfile_maxbytes = byte_size(get('logfile_maxbytes', '50MB'))
section.logfile_backups = integer(get('logfile_backups', 10))
section.loglevel = logging_level(get('loglevel', 'info'))
section.pidfile = existing_dirpath(get('pidfile', 'supervisord.pid'))
section.identifier = get('identifier', 'supervisor')
section.nodaemon = boolean(get('nodaemon', 'false'))
tempdir = tempfile.gettempdir()
section.childlogdir = existing_directory(get('childlogdir', tempdir))
section.nocleanup = boolean(get('nocleanup', 'false'))
section.strip_ansi = boolean(get('strip_ansi', 'false'))
environ_str = get('environment', '')
environ_str = expand(environ_str, expansions, 'environment')
section.environment = dict_of_key_value_pairs(environ_str)
# Process rpcinterface plugins before groups to allow custom events to
# be registered.
section.rpcinterface_factories = self.get_plugins(
parser,
'supervisor.rpcinterface_factory',
'rpcinterface:'
)
startsecs = integer(get(section, 'startsecs', 1))
startretries = integer(get(section, 'startretries', 3))
stopsignal = signal_number(get(section, 'stopsignal', 'TERM'))
stopwaitsecs = integer(get(section, 'stopwaitsecs', 10))
stopasgroup = boolean(get(section, 'stopasgroup', 'false'))
killasgroup = boolean(get(section, 'killasgroup', stopasgroup))
exitcodes = list_of_exitcodes(get(section, 'exitcodes', '0,2'))
# see also redirect_stderr check in process_groups_from_parser()
redirect_stderr = boolean(get(section, 'redirect_stderr','false'))
numprocs = integer(get(section, 'numprocs', 1))
numprocs_start = integer(get(section, 'numprocs_start', 0))
environment_str = get(section, 'environment', '', do_expand=False)
stdout_cmaxbytes = byte_size(get(section,'stdout_capture_maxbytes','0'))
stdout_events = boolean(get(section, 'stdout_events_enabled','false'))
stderr_cmaxbytes = byte_size(get(section,'stderr_capture_maxbytes','0'))
stderr_events = boolean(get(section, 'stderr_events_enabled','false'))
serverurl = get(section, 'serverurl', None)
if serverurl and serverurl.strip().upper() == 'AUTO':
serverurl = None
# find uid from "user" option
user = get(section, 'user', None)
if user is None:
uid = None
else:
uid = name_to_uid(user)
umask = get(section, 'umask', None)
if umask is not None:
umask = octal_type(umask)
process_name = process_or_group_name(
'group_name':group_name}
def get(section, opt, *args, **kwargs):
expansions = kwargs.get('expansions', {})
expansions.update(common_expansions)
kwargs['expansions'] = expansions
return parser.saneget(section, opt, *args, **kwargs)
priority = integer(get(section, 'priority', 999))
autostart = boolean(get(section, 'autostart', 'true'))
autorestart = auto_restart(get(section, 'autorestart', 'unexpected'))
startsecs = integer(get(section, 'startsecs', 1))
startretries = integer(get(section, 'startretries', 3))
stopsignal = signal_number(get(section, 'stopsignal', 'TERM'))
stopwaitsecs = integer(get(section, 'stopwaitsecs', 10))
stopasgroup = boolean(get(section, 'stopasgroup', 'false'))
killasgroup = boolean(get(section, 'killasgroup', stopasgroup))
exitcodes = list_of_exitcodes(get(section, 'exitcodes', '0,2'))
# see also redirect_stderr check in process_groups_from_parser()
redirect_stderr = boolean(get(section, 'redirect_stderr','false'))
numprocs = integer(get(section, 'numprocs', 1))
numprocs_start = integer(get(section, 'numprocs_start', 0))
environment_str = get(section, 'environment', '', do_expand=False)
stdout_cmaxbytes = byte_size(get(section,'stdout_capture_maxbytes','0'))
stdout_events = boolean(get(section, 'stdout_events_enabled','false'))
stderr_cmaxbytes = byte_size(get(section,'stderr_capture_maxbytes','0'))
stderr_events = boolean(get(section, 'stderr_events_enabled','false'))
serverurl = get(section, 'serverurl', None)
if serverurl and serverurl.strip().upper() == 'AUTO':
serverurl = None
# find uid from "user" option
user = get(section, 'user', None)
expansions.update(common_expansions)
kwargs['expansions'] = expansions
return parser.saneget(section, opt, *args, **kwargs)
priority = integer(get(section, 'priority', 999))
autostart = boolean(get(section, 'autostart', 'true'))
autorestart = auto_restart(get(section, 'autorestart', 'unexpected'))
startsecs = integer(get(section, 'startsecs', 1))
startretries = integer(get(section, 'startretries', 3))
stopsignal = signal_number(get(section, 'stopsignal', 'TERM'))
stopwaitsecs = integer(get(section, 'stopwaitsecs', 10))
stopasgroup = boolean(get(section, 'stopasgroup', 'false'))
killasgroup = boolean(get(section, 'killasgroup', stopasgroup))
exitcodes = list_of_exitcodes(get(section, 'exitcodes', '0'))
# see also redirect_stderr check in process_groups_from_parser()
redirect_stderr = boolean(get(section, 'redirect_stderr','false'))
numprocs = integer(get(section, 'numprocs', 1))
numprocs_start = integer(get(section, 'numprocs_start', 0))
environment_str = get(section, 'environment', '', do_expand=False)
stdout_cmaxbytes = byte_size(get(section,'stdout_capture_maxbytes','0'))
stdout_events = boolean(get(section, 'stdout_events_enabled','false'))
stderr_cmaxbytes = byte_size(get(section,'stderr_capture_maxbytes','0'))
stderr_events = boolean(get(section, 'stderr_events_enabled','false'))
serverurl = get(section, 'serverurl', None)
if serverurl and serverurl.strip().upper() == 'AUTO':
serverurl = None
# find uid from "user" option
user = get(section, 'user', None)
if user is None:
uid = None
else:
'host_node_name':host_node_name,
'group_name':group_name}
def get(section, opt, *args, **kwargs):
expansions = kwargs.get('expansions', {})
expansions.update(common_expansions)
kwargs['expansions'] = expansions
return parser.saneget(section, opt, *args, **kwargs)
priority = integer(get(section, 'priority', 999))
autostart = boolean(get(section, 'autostart', 'true'))
autorestart = auto_restart(get(section, 'autorestart', 'unexpected'))
startsecs = integer(get(section, 'startsecs', 1))
startretries = integer(get(section, 'startretries', 3))
stopsignal = signal_number(get(section, 'stopsignal', 'TERM'))
stopwaitsecs = integer(get(section, 'stopwaitsecs', 10))
stopasgroup = boolean(get(section, 'stopasgroup', 'false'))
killasgroup = boolean(get(section, 'killasgroup', stopasgroup))
exitcodes = list_of_exitcodes(get(section, 'exitcodes', '0,2'))
# see also redirect_stderr check in process_groups_from_parser()
redirect_stderr = boolean(get(section, 'redirect_stderr','false'))
numprocs = integer(get(section, 'numprocs', 1))
numprocs_start = integer(get(section, 'numprocs_start', 0))
environment_str = get(section, 'environment', '', do_expand=False)
stdout_cmaxbytes = byte_size(get(section,'stdout_capture_maxbytes','0'))
stdout_events = boolean(get(section, 'stdout_events_enabled','false'))
stderr_cmaxbytes = byte_size(get(section,'stderr_capture_maxbytes','0'))
stderr_events = boolean(get(section, 'stderr_events_enabled','false'))
serverurl = get(section, 'serverurl', None)
if serverurl and serverurl.strip().upper() == 'AUTO':
serverurl = None
# find uid from "user" option
autostart = boolean(get(section, 'autostart', 'true'))
autorestart = auto_restart(get(section, 'autorestart', 'unexpected'))
startsecs = integer(get(section, 'startsecs', 1))
startretries = integer(get(section, 'startretries', 3))
stopsignal = signal_number(get(section, 'stopsignal', 'TERM'))
stopwaitsecs = integer(get(section, 'stopwaitsecs', 10))
stopasgroup = boolean(get(section, 'stopasgroup', 'false'))
killasgroup = boolean(get(section, 'killasgroup', stopasgroup))
exitcodes = list_of_exitcodes(get(section, 'exitcodes', '0'))
# see also redirect_stderr check in process_groups_from_parser()
redirect_stderr = boolean(get(section, 'redirect_stderr','false'))
numprocs = integer(get(section, 'numprocs', 1))
numprocs_start = integer(get(section, 'numprocs_start', 0))
environment_str = get(section, 'environment', '', do_expand=False)
stdout_cmaxbytes = byte_size(get(section,'stdout_capture_maxbytes','0'))
stdout_events = boolean(get(section, 'stdout_events_enabled','false'))
stderr_cmaxbytes = byte_size(get(section,'stderr_capture_maxbytes','0'))
stderr_events = boolean(get(section, 'stderr_events_enabled','false'))
serverurl = get(section, 'serverurl', None)
if serverurl and serverurl.strip().upper() == 'AUTO':
serverurl = None
# find uid from "user" option
user = get(section, 'user', None)
if user is None:
uid = None
else:
uid = name_to_uid(user)
umask = get(section, 'umask', None)
if umask is not None:
umask = octal_type(umask)
section.directory = existing_directory(directory)
section.user = get('user', None)
section.umask = octal_type(get('umask', '022'))
section.logfile = existing_dirpath(get('logfile', 'supervisord.log'))
section.logfile_maxbytes = byte_size(get('logfile_maxbytes', '50MB'))
section.logfile_backups = integer(get('logfile_backups', 10))
section.loglevel = logging_level(get('loglevel', 'info'))
section.pidfile = existing_dirpath(get('pidfile', 'supervisord.pid'))
section.identifier = get('identifier', 'supervisor')
section.nodaemon = boolean(get('nodaemon', 'false'))
tempdir = tempfile.gettempdir()
section.childlogdir = existing_directory(get('childlogdir', tempdir))
section.nocleanup = boolean(get('nocleanup', 'false'))
section.strip_ansi = boolean(get('strip_ansi', 'false'))
environ_str = get('environment', '')
environ_str = expand(environ_str, expansions, 'environment')
section.environment = dict_of_key_value_pairs(environ_str)
# Process rpcinterface plugins before groups to allow custom events to
# be registered.
section.rpcinterface_factories = self.get_plugins(
parser,
'supervisor.rpcinterface_factory',
'rpcinterface:'
)
section.process_group_configs = self.process_groups_from_parser(parser)
for group in section.process_group_configs:
for proc in group.process_configs:
env = section.environment.copy()
env.update(proc.environment)
section.user = get('user', None)
section.umask = octal_type(get('umask', '022'))
section.logfile = existing_dirpath(get('logfile', 'supervisord.log'))
section.logfile_maxbytes = byte_size(get('logfile_maxbytes', '50MB'))
section.logfile_backups = integer(get('logfile_backups', 10))
section.loglevel = logging_level(get('loglevel', 'info'))
section.pidfile = existing_dirpath(get('pidfile', 'supervisord.pid'))
section.subprocpidfile = existing_dirpath(get('subprocpidfile', ''))
section.identifier = get('identifier', 'supervisor')
section.nodaemon = boolean(get('nodaemon', 'false'))
tempdir = tempfile.gettempdir()
section.childlogdir = existing_directory(get('childlogdir', tempdir))
section.nocleanup = boolean(get('nocleanup', 'false'))
section.strip_ansi = boolean(get('strip_ansi', 'false'))
expansions = {'here':self.here}
expansions.update(environ_expansions())
environ_str = get('environment', '')
environ_str = expand(environ_str, expansions, 'environment')
section.environment = dict_of_key_value_pairs(environ_str)
# Process rpcinterface plugins before groups to allow custom events to
# be registered.
section.rpcinterface_factories = self.get_plugins(
parser,
'supervisor.rpcinterface_factory',
'rpcinterface:'
)
section.process_group_configs = self.process_groups_from_parser(parser)
for group in section.process_group_configs:
for proc in group.process_configs: