[X2Go-Commits] [python-x2go] 02/02: x2go/client.py: Add is_x2goserver() method to X2GoClient class API.

git-admin at x2go.org git-admin at x2go.org
Sun Nov 11 13:26:48 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository python-x2go.

commit 99d08fe57184d93b49968cec3ec278cf9a6d1a94
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sat Nov 10 22:48:30 2018 +0100

    x2go/client.py: Add is_x2goserver() method to X2GoClient class API.
---
 debian/changelog |  1 +
 x2go/client.py   | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index ce947ce..9ef40bc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ python-x2go (0.6.0.2-0x2go1) UNRELEASED; urgency=medium
       (required for pyhoca-cli --try-resume).
     - X2GoControlSession.get_server_versions(): Fix another Py3 issue where
       we forgot decoding stdout before applying string operations.
+    - x2go/client.py: Add is_x2goserver() method to X2GoClient class API.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Tue, 18 Sep 2018 21:17:35 +0200
 
diff --git a/x2go/client.py b/x2go/client.py
index 6c3c76a..1aa0c7d 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -2208,6 +2208,24 @@ class X2GoClient(object):
         return self.session_registry.control_session_of_profile_name(profile_name)
     __client_control_session_of_profile_name = client_control_session_of_profile_name
 
+    def is_x2goserver(self, session_uuid, force=False):
+        """\
+        Check a remote and connected server (identified by the session_uuid hash)
+        if it really is an X2Go Server (i.e., if it has the X2Go Server software
+        installed.
+
+        :param session_uuid: the X2Go session's UUID registry hash
+        :type session_uuid: ``str``
+        :param force: reinforce the lookup, don't use cached information
+        :type force: ``bool``
+
+        :returns: ``True`` if the remote server has X2Go Server installed, ``False`` otherwise.
+        :rtype: ``bool``
+
+        """
+        profile_name = self.session_registry(session_uuid).get_profile_name()
+        return ('x2goserver' in self.get_server_versions(profile_name, force=force).keys())
+
     def get_server_versions(self, profile_name, component=None, force=False):
         """\
         Query the server configured in session profile <profile_name> for the list of install X2Go components

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/python-x2go.git


More information about the x2go-commits mailing list