OLD | NEW |
1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 for alias, path in additional_dirs.iteritems(): | 126 for alias, path in additional_dirs.iteritems(): |
127 start_cmd += ['-c', 'Alias %s "%s"' % (alias, path), | 127 start_cmd += ['-c', 'Alias %s "%s"' % (alias, path), |
128 # Disable CGI handler for additional dirs. | 128 # Disable CGI handler for additional dirs. |
129 '-c', '<Location %s>' % alias, | 129 '-c', '<Location %s>' % alias, |
130 '-c', 'RemoveHandler .cgi .pl', | 130 '-c', 'RemoveHandler .cgi .pl', |
131 '-c', '</Location>'] | 131 '-c', '</Location>'] |
132 | 132 |
133 self._start_cmd = start_cmd | 133 self._start_cmd = start_cmd |
134 | 134 |
135 def _spawn_process(self): | 135 def _spawn_process(self): |
136 _log.debug('Starting %s server, cmd="%s"' % (self._name, str(self._start
_cmd))) | 136 _log.debug('Starting %s server, cmd="%s"', self._name, str(self._start_c
md)) |
137 self._process = self._executive.popen(self._start_cmd) | 137 self._process = self._executive.popen(self._start_cmd) |
138 retval = self._process.returncode | 138 retval = self._process.returncode |
139 if retval: | 139 if retval: |
140 raise server_base.ServerError('Failed to start %s: %s' % (self._name
, retval)) | 140 raise server_base.ServerError('Failed to start %s: %s' % (self._name
, retval)) |
141 | 141 |
142 # For some reason apache isn't guaranteed to have created the pid file b
efore | 142 # For some reason apache isn't guaranteed to have created the pid file b
efore |
143 # the process exits, so we wait a little while longer. | 143 # the process exits, so we wait a little while longer. |
144 if not self._wait_for_action(lambda: self._filesystem.exists(self._pid_f
ile)): | 144 if not self._wait_for_action(lambda: self._filesystem.exists(self._pid_f
ile)): |
145 self._log_errors_from_subprocess() | 145 self._log_errors_from_subprocess() |
146 raise server_base.ServerError('Failed to start %s: no pid file found
' % self._name) | 146 raise server_base.ServerError('Failed to start %s: no pid file found
' % self._name) |
(...skipping 22 matching lines...) Expand all Loading... |
169 retval = proc.returncode | 169 retval = proc.returncode |
170 err = proc.stderr.read() | 170 err = proc.stderr.read() |
171 if retval or len(err): | 171 if retval or len(err): |
172 raise server_base.ServerError('Failed to stop %s: %s' % (self._name,
err)) | 172 raise server_base.ServerError('Failed to stop %s: %s' % (self._name,
err)) |
173 | 173 |
174 # For some reason apache isn't guaranteed to have actually stopped after | 174 # For some reason apache isn't guaranteed to have actually stopped after |
175 # the stop command returns, so we wait a little while longer for the | 175 # the stop command returns, so we wait a little while longer for the |
176 # pid file to be removed. | 176 # pid file to be removed. |
177 if not self._wait_for_action(lambda: not self._filesystem.exists(self._p
id_file)): | 177 if not self._wait_for_action(lambda: not self._filesystem.exists(self._p
id_file)): |
178 raise server_base.ServerError('Failed to stop %s: pid file still exi
sts' % self._name) | 178 raise server_base.ServerError('Failed to stop %s: pid file still exi
sts' % self._name) |
OLD | NEW |