[X2go-Commits] python-x2go.git - master (branch) updated: 0.2.0.10-32-gb1b4c6b

X2Go dev team git-admin at x2go.org
Thu Oct 11 10:11:12 CEST 2012


The branch, master has been updated
       via  b1b4c6bc2a503e903dcf2c1e19fd7e386a8213ca (commit)
       via  c8d8cf7147febea9ade38e28f9b828eda7360402 (commit)
       via  5da7378d77a8bd36de9c78305a785f046163c920 (commit)
      from  b72afbf25c794c48d142d0cd665e210c559b57fb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b1b4c6bc2a503e903dcf2c1e19fd7e386a8213ca
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Oct 11 10:11:05 2012 +0200

    fix-up after some tests for look_for_keys and allow_agent feature

commit c8d8cf7147febea9ade38e28f9b828eda7360402
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Oct 11 10:08:38 2012 +0200

    Make X2goClient instance available in initial X2goSession instances.

commit 5da7378d77a8bd36de9c78305a785f046163c920
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Oct 11 10:07:03 2012 +0200

    /debian/pyversions: Drop file as it is deprecated.

-----------------------------------------------------------------------

Summary of changes:
 debian/changelog  |    3 +++
 debian/pyversions |    1 -
 x2go/registry.py  |   37 ++++++++++++++++-----------------
 x2go/session.py   |   60 +++++++++++++++++++++++++++++++++--------------------
 4 files changed, 58 insertions(+), 43 deletions(-)
 delete mode 100644 debian/pyversions

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 71772ad..a8310b3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,10 +20,13 @@ python-x2go (0.2.1.0-0~x2go1) UNRELEASED; urgency=low
     - Implement X2Go session profile features ,,autologin'' and
       ,,sshproxyautologin'' (meaning: look_for_keys and allow_agent in Python
       Paramiko terms).
+    - Make X2goClient instance available in initial X2goSession instances.
   * /debian/rules:
     + Allow package build on systems with missing dh_python2.
   * /debian/control:
     + Versioned depend on python-paramiko (>= 1.8-0~).
+  * /debian/pyversions:
+    + Drop file as it is deprecated.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Wed, 26 Sep 2012 20:49:44 +0200
 
diff --git a/debian/pyversions b/debian/pyversions
deleted file mode 100644
index 44dd54d..0000000
--- a/debian/pyversions
+++ /dev/null
@@ -1 +0,0 @@
-2.5-
\ No newline at end of file
diff --git a/x2go/registry.py b/x2go/registry.py
index 61ceba3..84a0058 100644
--- a/x2go/registry.py
+++ b/x2go/registry.py
@@ -460,7 +460,6 @@ class X2goSessionRegistry(object):
                  keep_controlsession_alive=True,
                  add_to_known_hosts=False,
                  known_hosts=None,
-                 forward_sshagent=False,
                  **kwargs):
         """\
         Register a new L{X2goSession} instance with this L{X2goSessionRegistry}.
@@ -512,36 +511,36 @@ class X2goSessionRegistry(object):
         if profile_id in self.control_sessions.keys():
             control_session = self.control_sessions[profile_id]
 
+        _params = self.client_instance.session_profiles.to_session_params(profile_id)
+        for _k in _params.keys():
+            if _k in kwargs.keys():
+                _params[_k] = kwargs[_k]
+
         # when starting a new session, we will try to use unused registered virgin sessions
         # depending on your application layout, there should either be one or no such virgin session at all
         _virgin_sessions = [ s for s in self.virgin_sessions_of_profile_name(profile_name, return_objects=True) if not s.activated ]
         if _virgin_sessions and not session_name:
-
-            _virgin_sessions[0].activated = True
             session_uuid = _virgin_sessions[0].get_uuid()
-            _params = self.client_instance.session_profiles.to_session_params(profile_id)
-            for _k in _params.keys():
-                if _k in kwargs.keys():
-                    _params[_k] = kwargs[_k]
-            self(session_uuid).update_params(_params)
-            self(session_uuid).set_server(server)
-            self(session_uuid).set_profile_name(profile_name)
             self.logger('using already initially-registered yet-unused session %s' % session_uuid, loglevel=log.loglevel_NOTICE)
-            return session_uuid
 
-        session_uuid = self.get_session_of_session_name(session_name)
+        else:
+            session_uuid = self.get_session_of_session_name(session_name)
+            if session_uuid is not None: self.logger('using already registered-by-session-name session %s' % session_uuid, loglevel=log.loglevel_NOTICE)
+
         if session_uuid is not None:
             self(session_uuid).activated = True
-            _params = self.client_instance.session_profiles.to_session_params(profile_id)
-            for _k in _params.keys():
-                if _k in kwargs.keys():
-                    _params[_k] = kwargs[_k]
             self(session_uuid).update_params(_params)
             self(session_uuid).set_server(server)
             self(session_uuid).set_profile_name(profile_name)
-            self.logger('using already registered-by-session-name session %s' % session_uuid, loglevel=log.loglevel_NOTICE)
             return session_uuid
 
+        try: del _params['server'] 
+        except: pass
+        try: del _params['profile_name']
+        except: pass
+        try: del _params['profile_id'] 
+        except: pass
+
         s = session.X2goSession(server=server, control_session=control_session,
                                 profile_id=profile_id, profile_name=profile_name,
                                 session_name=session_name,
@@ -558,8 +557,8 @@ class X2goSessionRegistry(object):
                                 keep_controlsession_alive=keep_controlsession_alive,
                                 add_to_known_hosts=add_to_known_hosts,
                                 known_hosts=known_hosts,
-                                forward_sshagent=forward_sshagent,
-                                logger=self.logger, **kwargs)
+                                client_instance=self.client_instance,
+                                logger=self.logger, **_params)
 
         session_uuid = s._X2goSession__get_uuid()
         self.logger('registering X2Go session %s...' % profile_name, log.loglevel_NOTICE)
diff --git a/x2go/session.py b/x2go/session.py
index 0330015..7722822 100644
--- a/x2go/session.py
+++ b/x2go/session.py
@@ -98,19 +98,19 @@ _X2GO_SESSION_PARAMS = ('use_sshproxy', 'sshproxy_reuse_authinfo',
 """A list of allowed X2Go pure session parameters (i.e. parameters that are passed on neither to an X2goControlSession, X2goSSHProxy nor an X2goControlSession object."""
 # options of the paramiko.SSHClient().connect() method, any option that is allowed for a terminal session instance
 _X2GO_TERMINAL_PARAMS = ('geometry', 'depth', 'link', 'pack', 'dpi',
-                        'cache_type', 'kbtype', 'kblayout', 'kbvariant',
-                        'session_type', 'snd_system', 'snd_port',
-                        'cmd', 'set_session_title', 'session_title',
-                        'rdp_server', 'rdp_options', 'applications',
-                        'xdmcp_server',
-                        'rootdir', 'loglevel', 'profile_name', 'profile_id',
-                        'print_action', 'print_action_args',
-                        'convert_encoding', 'client_encoding', 'server_encoding',
-                        'proxy_options', 'published_applications', 'published_applications_no_submenus',
-                        'logger',
-                        'control_backend', 'terminal_backend', 'proxy_backend',
-                        'profiles_backend', 'settings_backend', 'printing_backend',
-                       )
+                         'cache_type', 'kbtype', 'kblayout', 'kbvariant',
+                         'session_type', 'snd_system', 'snd_port',
+                         'cmd', 'set_session_title', 'session_title',
+                         'rdp_server', 'rdp_options', 'applications',
+                         'xdmcp_server',
+                         'rootdir', 'loglevel', 'profile_name', 'profile_id',
+                         'print_action', 'print_action_args',
+                         'convert_encoding', 'client_encoding', 'server_encoding',
+                         'proxy_options', 'published_applications', 'published_applications_no_submenus',
+                         'logger',
+                         'control_backend', 'terminal_backend', 'proxy_backend',
+                         'profiles_backend', 'settings_backend', 'printing_backend',
+                        )
 """A list of allowed X2Go terminal session parameters."""
 _X2GO_SSHPROXY_PARAMS = ('sshproxy_host', 'sshproxy_port', 'sshproxy_user', 'sshproxy_password',
                          'sshproxy_key_filename', 'sshproxy_pkey',
@@ -158,8 +158,6 @@ class X2goSession(object):
                  add_to_known_hosts=False,
                  known_hosts=None,
                  forward_sshagent=False,
-                 look_for_keys=False,
-                 allow_agent=False,
                  logger=None, loglevel=log.loglevel_DEFAULT,
                  connected=False, activated=False, virgin=True, running=None, suspended=None, terminated=None, faulty=None,
                  client_instance=None,
@@ -223,10 +221,6 @@ class X2goSession(object):
         @type known_hosts: C{str}
         @param forward_sshagent: forward SSH agent authentication requests to the SSH agent on the X2Go client-side
         @type forward_sshagent: C{bool}
-        @param look_for_keys: set to C{True} to enable searching for discoverable private key files in C{~/.ssh/}
-        @type look_for_keys: C{bool}
-        @param allow_agent: set to C{True} to enable connecting to a local SSH agent for acquiring authentication information
-        @type allow_agent: C{bool}
         @param connected: manipulate session state »connected« by giving a pre-set value
         @type connected: C{bool}
         @param activated: normal leave this untouched, an activated session is a session that is about to be used
@@ -342,8 +336,6 @@ class X2goSession(object):
         self.add_to_known_hosts = add_to_known_hosts
         self.known_hosts = known_hosts
         self.forward_sshagent = forward_sshagent
-        self.look_for_keys = look_for_keys
-        self.allow_agent = allow_agent
 
         self._current_status = {
             'timestamp': time.time(),
@@ -518,8 +510,6 @@ class X2goSession(object):
             self.control_session = self.control_backend(profile_name=self.profile_name,
                                                         add_to_known_hosts=self.add_to_known_hosts,
                                                         known_hosts=self.known_hosts,
-                                                        look_for_keys=self.look_for_keys,
-                                                        allow_agent=self.allow_agent,
                                                         forward_sshagent=self.forward_sshagent,
                                                         terminal_backend=self.terminal_backend,
                                                         info_backend=self.info_backend,
@@ -1058,6 +1048,12 @@ class X2goSession(object):
                 return True
             elif self.sshproxy_params.has_key('sshproxy_pkey') and self.sshproxy_params['sshproxy_pkey']:
                 return True
+            ### FIXME -- we do not know by 100%  if this will work just by checking the presence of ,,sshproxy_look_for_keys''...
+            elif self.sshproxy_params.has_key('sshproxy_look_for_keys') and self.sshproxy_params['sshproxy_look_for_keys']:
+                return True
+            ### FIXME -- we do not know by 100% if this will work just by checking the presence of ,,sshproxy_allow_agent''...
+            elif self.sshproxy_params.has_key('sshproxy_allow_agent') and self.sshproxy_params['sshproxy_allow_agent']:
+                return True
             else:
                 return False
         else:
@@ -1093,6 +1089,24 @@ class X2goSession(object):
             else:
                 return True
 
+        # or a key auto discovery?
+        ### FIXME -- we do not know by 100% if this will work just by checking the presence of ,,look_for_keys''...
+        elif self.control_params.has_key('look_for_keys') and self.control_params['look_for_keys']:
+            _can_sshproxy_auto_connect = self.can_sshproxy_auto_connect()
+            if _can_sshproxy_auto_connect is not None:
+                return _can_sshproxy_auto_connect
+            else:
+                return True
+
+        # or a SSH agent usage?
+        ### FIXME -- we do not know by 100% if this will work just by checking the presence of ,,allow_agent''...
+        elif self.control_params.has_key('allow_agent') and self.control_params['allow_agent']:
+            _can_sshproxy_auto_connect = self.can_sshproxy_auto_connect()
+            if _can_sshproxy_auto_connect is not None:
+                return _can_sshproxy_auto_connect
+            else:
+                return True
+
         else:
             return False
     __can_auto_connect = can_auto_connect


hooks/post-receive
-- 
python-x2go.git (Python X2Go Client API)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-x2go.git" (Python X2Go Client API).




More information about the x2go-commits mailing list