Discussion:
[Ryu-devel] [PATCH 1/2] pip: OpenStack updated requirements of eventlet again
IWASE Yusuke
2017-06-15 05:31:28 UTC
Permalink
Signed-off-by: IWASE Yusuke <***@gmail.com>
---
tools/pip-requires | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/pip-requires b/tools/pip-requires
index ab16920..ef475c0 100644
--- a/tools/pip-requires
+++ b/tools/pip-requires
@@ -1,7 +1,7 @@
# NOTE: OpenStack avoids the newer versions of eventlet, because of the
# following issue.
# https://github.com/eventlet/eventlet/issues/401
-eventlet!=0.18.3,>=0.18.2,<0.21.0
+eventlet!=0.18.3,>=0.18.2,!=0.20.1,<0.21.0
msgpack-python>=0.3.0 # RPC library, BGP speaker(net_cntl)
netaddr
oslo.config>=1.15.0
--
2.7.4
IWASE Yusuke
2017-06-15 05:31:29 UTC
Permalink
This patch introduces "--user-flags" option which enable to add user
original CLI or config file options for their own Ryu applications.

Usage Example)
$ cat user_flags.py
from ryu import cfg

CONF = cfg.CONF
CONF.register_cli_opts([
cfg.StrOpt(
'user-cli-opt', default=None,
help='user original CLI option'),
])

$ ryu-manager --user-flags user_flags.py user_app.py

Signed-off-by: IWASE Yusuke <***@gmail.com>
---
ryu/cmd/manager.py | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/ryu/cmd/manager.py b/ryu/cmd/manager.py
index dc7aca8..797d8d5 100755
--- a/ryu/cmd/manager.py
+++ b/ryu/cmd/manager.py
@@ -16,6 +16,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

+import os
+import sys
+
from ryu.lib import hub
hub.patch(thread=False)

@@ -43,10 +46,28 @@ CONF.register_cli_opts([
cfg.BoolOpt('enable-debugger', default=False,
help='don\'t overwrite Python standard threading library'
'(use only for debugging)'),
+ cfg.StrOpt('user-flags', default=None,
+ help='Additional flags file for user applications'),
])


+def _parse_user_flags():
+ """
+ Parses user-flags file and loads it to register user defined options.
+ """
+ try:
+ idx = list(sys.argv).index('--user-flags')
+ user_flags_file = sys.argv[idx + 1]
+ except (ValueError, IndexError):
+ user_flags_file = ''
+
+ if user_flags_file and os.path.isfile(user_flags_file):
+ from ryu.utils import _import_module_file
+ _import_module_file(user_flags_file)
+
+
def main(args=None, prog=None):
+ _parse_user_flags()
try:
CONF(args=args, prog=prog,
project='ryu', version='ryu-manager %s' % version,
@@ -65,7 +86,6 @@ def main(args=None, prog=None):
hub.patch(thread=True)

if CONF.pid_file:
- import os
with open(CONF.pid_file, 'w') as pid_file:
pid_file.write(str(os.getpid()))
--
2.7.4
FUJITA Tomonori
2017-06-23 02:48:25 UTC
Permalink
On Thu, 15 Jun 2017 14:31:28 +0900
Post by IWASE Yusuke
---
tools/pip-requires | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Applied both, thanks!

Loading...