Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 828046 Details for
Bug 1020480
swift-init exits with 0 even if the service fails to start
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Possible fix
swift-1.10-exitcode-1.diff (text/plain), 6.89 KB, created by
Pete Zaitcev
on 2013-11-23 00:24:56 UTC
(
hide
)
Description:
Possible fix
Filename:
MIME Type:
Creator:
Pete Zaitcev
Created:
2013-11-23 00:24:56 UTC
Size:
6.89 KB
patch
obsolete
>commit 2b042084c3bb6012b514398e4104ce05e98e2aff >Author: Pete Zaitcev <zaitcev@kotori.zaitcev.us> >Date: Fri Nov 22 13:28:09 2013 -0700 > > fix bz#1020480 > > Change-Id: I74d1f7c36ce036f0ef874a29566211788ad42b61 > >diff --git a/bin/swift-account-server b/bin/swift-account-server >index 9b8f1e5..a1f48e1 100755 >--- a/bin/swift-account-server >+++ b/bin/swift-account-server >@@ -14,9 +14,11 @@ > # See the License for the specific language governing permissions and > # limitations under the License. > >+import sys > from swift.common.utils import parse_options > from swift.common.wsgi import run_wsgi > > if __name__ == '__main__': > conf_file, options = parse_options() >- run_wsgi(conf_file, 'account-server', default_port=6002, **options) >+ sys.exit(run_wsgi(conf_file, >+ 'account-server', default_port=6002, **options)) >diff --git a/bin/swift-container-server b/bin/swift-container-server >index aef038c..ffd6840 100755 >--- a/bin/swift-container-server >+++ b/bin/swift-container-server >@@ -14,9 +14,11 @@ > # See the License for the specific language governing permissions and > # limitations under the License. > >+import sys > from swift.common.utils import parse_options > from swift.common.wsgi import run_wsgi > > if __name__ == '__main__': > conf_file, options = parse_options() >- run_wsgi(conf_file, 'container-server', default_port=6001, **options) >+ sys.exit(run_wsgi(conf_file, >+ 'container-server', default_port=6001, **options)) >diff --git a/bin/swift-object-server b/bin/swift-object-server >index d879684..a3306b2 100755 >--- a/bin/swift-object-server >+++ b/bin/swift-object-server >@@ -14,6 +14,7 @@ > # See the License for the specific language governing permissions and > # limitations under the License. > >+import sys > from swift.common.utils import parse_options > from swift.common.wsgi import run_wsgi > from swift.obj import server >@@ -21,5 +22,6 @@ from swift.obj import server > > if __name__ == '__main__': > conf_file, options = parse_options() >- run_wsgi(conf_file, 'object-server', default_port=6000, >- global_conf_callback=server.global_conf_callback, **options) >+ sys.exit(run_wsgi(conf_file, 'object-server', default_port=6000, >+ global_conf_callback=server.global_conf_callback, >+ **options)) >diff --git a/bin/swift-proxy-server b/bin/swift-proxy-server >index 449a8d8..c6846bc 100755 >--- a/bin/swift-proxy-server >+++ b/bin/swift-proxy-server >@@ -14,9 +14,10 @@ > # See the License for the specific language governing permissions and > # limitations under the License. > >+import sys > from swift.common.utils import parse_options > from swift.common.wsgi import run_wsgi > > if __name__ == '__main__': > conf_file, options = parse_options() >- run_wsgi(conf_file, 'proxy-server', default_port=8080, **options) >+ sys.exit(run_wsgi(conf_file, 'proxy-server', default_port=8080, **options)) >diff --git a/swift/common/wsgi.py b/swift/common/wsgi.py >index 193322f..c730c1c 100644 >--- a/swift/common/wsgi.py >+++ b/swift/common/wsgi.py >@@ -240,6 +240,7 @@ def run_wsgi(conf_path, app_section, *args, **kwargs): > > :param conf_path: Path to paste.deploy style configuration file/directory > :param app_section: App name from conf file to load config from >+ :returns: 0 if successful, nonzero otherwise > """ > # Load configuration, Set logger and Load request processor > try: >@@ -247,7 +248,7 @@ def run_wsgi(conf_path, app_section, *args, **kwargs): > _initrp(conf_path, app_section, *args, **kwargs) > except ConfigFileError as e: > print e >- return >+ return 1 > > # bind to address and port > sock = get_socket(conf, default_port=kwargs.get('default_port', 8080)) >@@ -272,7 +273,7 @@ def run_wsgi(conf_path, app_section, *args, **kwargs): > # Useful for profiling [no forks]. > if worker_count == 0: > run_server(conf, logger, sock, global_conf=global_conf) >- return >+ return 0 > > def kill_children(*args): > """Kills the entire process group.""" >@@ -299,7 +300,7 @@ def run_wsgi(conf_path, app_section, *args, **kwargs): > signal.signal(signal.SIGTERM, signal.SIG_DFL) > run_server(conf, logger, sock) > logger.notice('Child %d exiting normally' % os.getpid()) >- return >+ return 0 > else: > logger.notice('Started child %s' % pid) > children.append(pid) >@@ -317,6 +318,7 @@ def run_wsgi(conf_path, app_section, *args, **kwargs): > greenio.shutdown_safe(sock) > sock.close() > logger.notice('Exited') >+ return 0 > > > class ConfigFileError(Exception): >diff --git a/test/unit/common/test_wsgi.py b/test/unit/common/test_wsgi.py >index ab4b3bf..b5db408 100644 >--- a/test/unit/common/test_wsgi.py >+++ b/test/unit/common/test_wsgi.py >@@ -535,6 +535,53 @@ class TestWSGI(unittest.TestCase): > self.assertEqual(calls['_global_conf_callback'], 1) > self.assertEqual(calls['_loadapp'], 1) > >+ def test_run_server_success(self): >+ calls = defaultdict(lambda: 0) >+ >+ def _initrp(conf_file, app_section, *args, **kwargs): >+ calls['_initrp'] += 1 >+ return ( >+ {'__file__': 'test', 'workers': 0}, >+ 'logger', >+ 'log_name') >+ >+ def _loadapp(uri, name=None, **kwargs): >+ calls['_loadapp'] += 1 >+ >+ with nested( >+ mock.patch.object(wsgi, '_initrp', _initrp), >+ mock.patch.object(wsgi, 'get_socket'), >+ mock.patch.object(wsgi, 'drop_privileges'), >+ mock.patch.object(wsgi, 'loadapp', _loadapp), >+ mock.patch.object(wsgi, 'capture_stdio'), >+ mock.patch.object(wsgi, 'run_server')): >+ rc = wsgi.run_wsgi('conf_file', 'app_section') >+ self.assertEqual(calls['_initrp'], 1) >+ self.assertEqual(calls['_loadapp'], 1) >+ self.assertEqual(rc, 0) >+ >+ def test_run_server_failure1(self): >+ calls = defaultdict(lambda: 0) >+ >+ def _initrp(conf_file, app_section, *args, **kwargs): >+ calls['_initrp'] += 1 >+ raise wsgi.ConfigFileError('test exception') >+ >+ def _loadapp(uri, name=None, **kwargs): >+ calls['_loadapp'] += 1 >+ >+ with nested( >+ mock.patch.object(wsgi, '_initrp', _initrp), >+ mock.patch.object(wsgi, 'get_socket'), >+ mock.patch.object(wsgi, 'drop_privileges'), >+ mock.patch.object(wsgi, 'loadapp', _loadapp), >+ mock.patch.object(wsgi, 'capture_stdio'), >+ mock.patch.object(wsgi, 'run_server')): >+ rc = wsgi.run_wsgi('conf_file', 'app_section') >+ self.assertEqual(calls['_initrp'], 1) >+ self.assertEqual(calls['_loadapp'], 0) >+ self.assertEqual(rc, 1) >+ > def test_pre_auth_req_with_empty_env_no_path(self): > r = wsgi.make_pre_authed_request( > {}, 'GET')
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1020480
: 828046