Some clients of unixctl.py may want to use a different version than the one supplied in ovs.version.VERSION. This patch supports an optional manual override of this value.
Feature #10383. Signed-off-by: Ethan Jackson <[email protected]> --- python/ovs/unixctl.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/python/ovs/unixctl.py b/python/ovs/unixctl.py index 452afa5..e8098e6 100644 --- a/python/ovs/unixctl.py +++ b/python/ovs/unixctl.py @@ -55,10 +55,9 @@ def _unixctl_help(conn, unused_argv, unused_aux): conn.reply(reply) -def _unixctl_version(conn, unused_argv, unused_aux): +def _unixctl_version(conn, unused_argv, version): assert isinstance(conn, UnixctlConnection) - version = "%s (Open vSwitch) %s" % (ovs.util.PROGRAM_NAME, - ovs.version.VERSION) + version = "%s (Open vSwitch) %s" % (ovs.util.PROGRAM_NAME, version) conn.reply(version) @@ -240,7 +239,7 @@ class UnixctlServer(object): self._listener = None @staticmethod - def create(path): + def create(path, version=None): assert path is None or isinstance(path, strtypes) if path is not None: @@ -249,6 +248,9 @@ class UnixctlServer(object): path = "punix:%s/%s.%d.ctl" % (ovs.dirs.RUNDIR, ovs.util.PROGRAM_NAME, os.getpid()) + if version is None: + version = ovs.version.VERSION + error, listener = ovs.stream.PassiveStream.open(path) if error: ovs.util.ovs_error(error, "could not initialize control socket %s" @@ -256,7 +258,7 @@ class UnixctlServer(object): return error, None command_register("help", "", 0, 0, _unixctl_help, None) - command_register("version", "", 0, 0, _unixctl_version, None) + command_register("version", "", 0, 0, _unixctl_version, version) return 0, UnixctlServer(listener) -- 1.7.9.4 _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
