diff options
| author | Chris McDonough <chrism@plope.com> | 2015-09-29 20:25:31 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2015-09-29 20:25:31 -0400 |
| commit | 20d9350e61bc86e019c42b866c0b85cd274438bb (patch) | |
| tree | fefd399f5b089f5edb7bafc7d07d4cf3598a0fc4 | |
| parent | b9b68fed103b18a19a0c0935365abbdd4a720dbc (diff) | |
| parent | 7d5d899f5043b381348bd349792fda6da957ab50 (diff) | |
| download | pyramid-20d9350e61bc86e019c42b866c0b85cd274438bb.tar.gz pyramid-20d9350e61bc86e019c42b866c0b85cd274438bb.tar.bz2 pyramid-20d9350e61bc86e019c42b866c0b85cd274438bb.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
| -rw-r--r-- | CHANGES.txt | 11 | ||||
| -rw-r--r-- | docs/narr/viewconfig.rst | 2 | ||||
| -rw-r--r-- | pyramid/scripts/pserve.py | 17 | ||||
| -rw-r--r-- | pyramid/tests/test_scripts/test_pserve.py | 6 |
4 files changed, 32 insertions, 4 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 98fa7f85a..7c8a9080a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -209,6 +209,17 @@ Bug Fixes Deprecations ------------ +- The ``pserve`` command's daemonization features have been deprecated. This + includes the ``[start,stop,restart,status]`` subcommands as well as the + ``--daemon``, ``--stop-server``, ``--pid-file``, and ``--status`` flags. + + Please use a real process manager in the future instead of relying on the + ``pserve`` to daemonize itself. Many options exist including your Operating + System's services such as systemd or upstart, as well as the excellent + and simple supervisord. + + See https://github.com/Pylons/pyramid/pull/1641 + - Renamed the ``principal`` argument to ``pyramid.security.remember()`` to ``userid`` in order to clarify its intended purpose. See https://github.com/Pylons/pyramid/pull/1399 diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst index 46b2c4f76..484350b31 100644 --- a/docs/narr/viewconfig.rst +++ b/docs/narr/viewconfig.rst @@ -108,7 +108,7 @@ Non-Predicate Arguments function) to obtain a response. The ``attr`` value allows you to vary the method attribute used to obtain the response. For example, if your view was a class, and the class has a method named ``index`` and you wanted to - use this method instead of the class' ``__call__`` method to return the + use this method instead of the class's ``__call__`` method to return the response, you'd say ``attr="index"`` in the view configuration for the view. This is most useful when the view definition is a class. diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py index e97bdcd48..a30ea5985 100644 --- a/pyramid/scripts/pserve.py +++ b/pyramid/scripts/pserve.py @@ -200,6 +200,7 @@ class PServeCommand(object): def run(self): # pragma: no cover if self.options.stop_daemon: + self._warn_daemon_deprecated() return self.stop_daemon() if not hasattr(self.options, 'set_user'): @@ -239,9 +240,11 @@ class PServeCommand(object): return 2 if cmd == 'status' or self.options.show_status: + self._warn_daemon_deprecated() return self.show_status() if cmd == 'restart' or cmd == 'stop': + self._warn_daemon_deprecated() result = self.stop_daemon() if result: if cmd == 'restart': @@ -271,6 +274,10 @@ class PServeCommand(object): server_spec = app_spec base = os.getcwd() + # warn before setting a default + if self.options.pid_file: + self._warn_daemon_deprecated() + if getattr(self.options, 'daemon', False): if not self.options.pid_file: self.options.pid_file = 'pyramid.pid' @@ -296,6 +303,7 @@ class PServeCommand(object): writeable_pid_file.close() if getattr(self.options, 'daemon', False): + self._warn_daemon_deprecated() try: self.daemonize() except DaemonizeException as ex: @@ -610,6 +618,15 @@ class PServeCommand(object): if uid: os.setuid(uid) + def _warn_daemon_deprecated(self): + self.out('''\ +The daemon options have been deprecated in Pyramid 1.6. They will be removed +in a future release per Pyramid's deprecation policy. Please consider using +a real process manager for handling your processes like supervisord or systemd. + +The following commands are deprecated: + [start,stop,restart,status] --daemon, --stop-server, --status, --pid-file +''') class LazyWriter(object): diff --git a/pyramid/tests/test_scripts/test_pserve.py b/pyramid/tests/test_scripts/test_pserve.py index 75d4f5bef..2d4c4e1c0 100644 --- a/pyramid/tests/test_scripts/test_pserve.py +++ b/pyramid/tests/test_scripts/test_pserve.py @@ -180,14 +180,14 @@ class TestPServeCommand(unittest.TestCase): inst = self._makeOne('--stop-daemon', '--pid-file=%s' % path) inst.run() msg = 'No PID file exists in %s' % path - self.assertEqual(self.out_.getvalue(), msg) + self.assertTrue(msg in self.out_.getvalue()) def test_run_stop_daemon_bad_pid_file(self): path = __file__ inst = self._makeOne('--stop-daemon', '--pid-file=%s' % path) inst.run() msg = 'Not a valid PID file in %s' % path - self.assertEqual(self.out_.getvalue(), msg) + self.assertTrue(msg in self.out_.getvalue()) def test_run_stop_daemon_invalid_pid_in_file(self): fn = tempfile.mktemp() @@ -197,7 +197,7 @@ class TestPServeCommand(unittest.TestCase): inst = self._makeOne('--stop-daemon', '--pid-file=%s' % fn) inst.run() msg = 'PID in %s is not valid (deleting)' % fn - self.assertEqual(self.out_.getvalue(), msg) + self.assertTrue(msg in self.out_.getvalue()) def test_get_options_with_command(self): inst = self._makeOne() |
