[X2Go-Commits] [x2gobroker] 01/01: x2gobroker/brokers/inifile_broker.py: Also check for presence of 'host' and 'sshport'.

git-admin at x2go.org git-admin at x2go.org
Tue May 1 13:08:56 CEST 2018


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

x2go pushed a commit to branch master
in repository x2gobroker.

commit 16f8f43a3480a5e1ec5c446a826251d96eae1c20
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Tue May 1 13:08:27 2018 +0200

    x2gobroker/brokers/inifile_broker.py: Also check for presence of 'host' and 'sshport'.
---
 x2gobroker/brokers/inifile_broker.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/x2gobroker/brokers/inifile_broker.py b/x2gobroker/brokers/inifile_broker.py
index cb9ce87..4c5a15d 100644
--- a/x2gobroker/brokers/inifile_broker.py
+++ b/x2gobroker/brokers/inifile_broker.py
@@ -77,6 +77,19 @@ class X2GoBroker(base.X2GoBroker):
         for key in list(profile_defaults.keys()):
             if key not in list(profile.keys()):
                 profile.update({ key: profile_defaults[key] })
+
+        # obligatory profile keys:
+
+        if 'host' not in profile:
+            raise x2gobroker.x2gobroker_exceptions.X2GoBrokerProfileException('Session profile ID \'{profile_id}\' lacks \'host\' key; profile is unusable'.format(profile_id=profile_id))
+
+        if 'name' not in profile:
+            profile['name'] = profile_id
+
+        if not ('directrdp' in profile and profile['directrdp']):
+            if 'sshport' not in profile:
+                profile['sshport'] = 22
+
         for key in list(profile.keys()):
             if key.startswith('acl-'):
                 del profile[key]
@@ -109,10 +122,6 @@ class X2GoBroker(base.X2GoBroker):
                     else:
                         profile[key].append(host)
 
-        # obligatory profile keys:
-        if 'name' not in profile:
-            profile['name'] = profile_id
-
         return profile
 
     def get_profile_broker(self, profile_id):

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


More information about the x2go-commits mailing list