diff options
author | 2015-08-24 13:22:48 +0300 | |
---|---|---|
committer | 2015-08-24 13:22:48 +0300 | |
commit | dab741a80699f86e86c91718872a052cca9bbb25 (patch) | |
tree | 1959c4a2cea440170a5113dcb067796cb20ffb64 /scripts/automation/trex_control_plane/server | |
parent | d3f26ece7d4383df0b22fe9c3cb3e695381ec737 (diff) |
Fixed dependencies of Control Plane to use external_lib sources
Diffstat (limited to 'scripts/automation/trex_control_plane/server')
-rwxr-xr-x | scripts/automation/trex_control_plane/server/extended_daemon_runner.py | 30 | ||||
-rwxr-xr-x | scripts/automation/trex_control_plane/server/outer_packages.py | 10 |
2 files changed, 20 insertions, 20 deletions
diff --git a/scripts/automation/trex_control_plane/server/extended_daemon_runner.py b/scripts/automation/trex_control_plane/server/extended_daemon_runner.py index 07eedd9f..2ce1eb06 100755 --- a/scripts/automation/trex_control_plane/server/extended_daemon_runner.py +++ b/scripts/automation/trex_control_plane/server/extended_daemon_runner.py @@ -8,18 +8,17 @@ import os, sys from argparse import ArgumentParser
from trex_server import trex_parser
try:
- from python_lib.termstyle import termstyle
+ from termstyle import termstyle
except ImportError:
import termstyle
-
-def daemonize_parser (parser_obj, action_funcs, help_menu):
+def daemonize_parser(parser_obj, action_funcs, help_menu):
"""Update the regular process parser to deal with daemon process options"""
parser_obj.description += " (as a daemon process)"
parser_obj.usage = None
- parser_obj.add_argument("action", choices = action_funcs,
- action="store", help = help_menu )
+ parser_obj.add_argument("action", choices=action_funcs,
+ action="store", help=help_menu)
return
@@ -42,7 +41,7 @@ class ExtendedDaemonRunner(runner.DaemonRunner): (*) start-live : start the application in live mode (no daemon process).
"""
- def __init__ (self, app, parser_obj):
+ def __init__(self, app, parser_obj):
""" Set up the parameters of a new runner.
THIS METHOD INTENTIONALLY DO NOT INVOKE SUPER __init__() METHOD
@@ -78,8 +77,8 @@ class ExtendedDaemonRunner(runner.DaemonRunner): self.daemon_context = daemon.DaemonContext()
self.daemon_context.stdin = open(app.stdin_path, 'rt')
self.daemon_context.stdout = open(app.stdout_path, 'w+t')
- self.daemon_context.stderr = open(
- app.stderr_path, 'a+t', buffering=0)
+ self.daemon_context.stderr = open(app.stderr_path,
+ 'a+t', buffering=0)
self.pidfile = None
if app.pidfile_path is not None:
@@ -87,23 +86,22 @@ class ExtendedDaemonRunner(runner.DaemonRunner): self.daemon_context.pidfile = self.pidfile
# mask out all arguments that aren't relevant to main app script
-
- def update_action_funcs (self):
+ def update_action_funcs(self):
self.action_funcs.update({u'start-live': self._start_live, u'show': self._show}) # add key (=action), value (=desired func)
@staticmethod
- def _start_live (self):
+ def _start_live(self):
self.app.run()
@staticmethod
- def _show (self):
+ def _show(self):
if self.pidfile.is_locked():
print termstyle.red("T-Rex server daemon is running")
else:
print termstyle.red("T-Rex server daemon is NOT running")
- def do_action (self):
+ def do_action(self):
self.__prevent_duplicate_runs()
self.__prompt_init_msg()
try:
@@ -117,7 +115,7 @@ class ExtendedDaemonRunner(runner.DaemonRunner): self.do_action()
- def __prevent_duplicate_runs (self):
+ def __prevent_duplicate_runs(self):
if self.action == 'start' and self.pidfile.is_locked():
print termstyle.green("Server daemon is already running")
exit(1)
@@ -125,13 +123,13 @@ class ExtendedDaemonRunner(runner.DaemonRunner): print termstyle.green("Server daemon is not running")
exit(1)
- def __prompt_init_msg (self):
+ def __prompt_init_msg(self):
if self.action == 'start':
print termstyle.green("Starting daemon server...")
elif self.action == 'stop':
print termstyle.green("Stopping daemon server...")
- def __verify_termination (self):
+ def __verify_termination(self):
pass
# import time
# while self.pidfile.is_locked():
diff --git a/scripts/automation/trex_control_plane/server/outer_packages.py b/scripts/automation/trex_control_plane/server/outer_packages.py index 218ac22a..730934bf 100755 --- a/scripts/automation/trex_control_plane/server/outer_packages.py +++ b/scripts/automation/trex_control_plane/server/outer_packages.py @@ -5,12 +5,14 @@ import site import os CURRENT_PATH = os.path.dirname(os.path.realpath(__file__)) -ROOT_PATH = os.path.abspath(os.path.join(CURRENT_PATH, os.pardir)) # path to trex_control_plane directory -PATH_TO_PYTHON_LIB = os.path.abspath(os.path.join(ROOT_PATH, 'python_lib')) +ROOT_PATH = os.path.abspath(os.path.join(CURRENT_PATH, os.pardir)) # path to trex_control_plane directory +PATH_TO_PYTHON_LIB = os.path.abspath(os.path.join(ROOT_PATH, os.pardir, os.pardir, + os.pardir, 'external_libs', 'python')) SERVER_MODULES = ['enum34-1.0.4', 'jsonrpclib-pelix-0.2.5', 'zmq', + 'pyzmq-14.7.0', 'python-daemon-2.0.5', 'lockfile-0.10.2', 'termstyle' @@ -24,11 +26,11 @@ def import_server_modules(): import_module_list(SERVER_MODULES) -def import_module_list (modules_list): +def import_module_list(modules_list): assert(isinstance(modules_list, list)) for p in modules_list: full_path = os.path.join(PATH_TO_PYTHON_LIB, p) - fix_path = os.path.normcase(full_path) + fix_path = os.path.normcase(full_path) site.addsitedir(full_path) import_server_modules() |