View | Details | Raw Unified | Return to bug 42241
Collapse All | Expand All

(-)a/base/univention-config-registry/python/univention/service_info.py (-6 / +8 lines)
 Lines 98-103   def pidof(name, docker='/var/run/docker.pid'): Link Here 
98
		try:
98
		try:
99
			with open(cmdline, 'r') as fd:
99
			with open(cmdline, 'r') as fd:
100
				commandline = fd.read()
100
				commandline = fd.read()
101
			link = os.readlink(os.path.join('/proc', proc, 'exe'))
101
		except EnvironmentError:
102
		except EnvironmentError:
102
			continue
103
			continue
103
		# kernel thread
104
		# kernel thread
 Lines 115-127   def pidof(name, docker='/var/run/docker.pid'): Link Here 
115
				log.error('Failed getting parent: %s', ex)
116
				log.error('Failed getting parent: %s', ex)
116
117
117
		args = commandline.split('\0')
118
		args = commandline.split('\0')
118
		if cmd[0] not in args and not commandline.startswith(name):
119
		if len(cmd) != 1 or link not in cmd:
119
			log.debug('skip %d: %s', pid, commandline)
120
			if cmd[0] not in args and not commandline.startswith(name):
120
			continue
121
				log.debug('skip %d: %s', pid, commandline)
121
		if len(args) >= len(cmd) > 1:
122
			if any(a != c for a, c in zip(args, cmd)):
123
				log.debug('mismatch %d: %r != %r', pid, args, cmd)
124
				continue
122
				continue
123
			if len(args) >= len(cmd) > 1:
124
				if any(a != c for a, c in zip(args, cmd)):
125
					log.debug('mismatch %d: %r != %r', pid, args, cmd)
126
					continue
125
		log.info('found %d: %r', pid, commandline)
127
		log.info('found %d: %r', pid, commandline)
126
		result.add(pid)
128
		result.add(pid)
127
129
(-)a/management/univention-management-console-module-services/umc/python/services/__init__.py (-3 / +5 lines)
 Lines 97-109   class Instance(Base): Link Here 
97
97
98
	def _change_services(self, services, action):
98
	def _change_services(self, services, action):
99
		error_messages = []
99
		error_messages = []
100
		srvs = ServiceInfo()
100
		for srv in services:
101
		for srv in services:
101
			process = subprocess.Popen(('/usr/sbin/service', srv, action), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
102
			service_name = srvs.get_service(srv).get('systemd', srv)
103
			process = subprocess.Popen(('/usr/sbin/service', service_name, action), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
102
			output = process.communicate()[0]
104
			output = process.communicate()[0]
103
			if process.returncode:
105
			if process.returncode:
104
				try:
106
				try:
105
					MODULE.warn('Error during %s of %s: %s' % (action, srv, output.strip()))
107
					MODULE.warn('Error during %s of %s: %s' % (action, service_name, output.strip()))
106
					process = subprocess.Popen(('/bin/systemctl', 'status', srv), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
108
					process = subprocess.Popen(('/bin/systemctl', 'status', service_name), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
107
					output = process.communicate()[0]
109
					output = process.communicate()[0]
108
				except EnvironmentError:
110
				except EnvironmentError:
109
					pass
111
					pass

Return to bug 42241