This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gobroker. commit 9887ae4f32b3f87248b898fcab311cbeca5e44b8 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Apr 16 14:25:50 2018 +0200 load checker integration: Make the default-use-load-checker option work like all other default-* options. --- etc/x2gobroker.conf | 3 ++- x2gobroker/brokers/base_broker.py | 39 ++++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/etc/x2gobroker.conf b/etc/x2gobroker.conf index e3e7e69..dc35007 100644 --- a/etc/x2gobroker.conf +++ b/etc/x2gobroker.conf @@ -287,12 +287,13 @@ # # o if enabled here for all backends # o or if enabled on a per broker backend basis (see below) +# o or if enabled per session profile (broker-use-load-checker = true) # # and # # o the session profile defines more than one host # o the session profile does not block queries to the load checker daemon -# on a per profile basis (broker-use-load-checker = true|false) +# on a per profile basis (broker-use-load-checker = false) # #default-use-load-checker = false diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py index 9a96fb5..75611fe 100644 --- a/x2gobroker/brokers/base_broker.py +++ b/x2gobroker/brokers/base_broker.py @@ -722,9 +722,10 @@ class X2GoBroker(object): Actually query the load checker daemon for the given session profile ID. This method will check: - - broker backend configured to use load checker daemon? - - more than one host configured? - - load checker queries not explicitly disabled in session profile? + - broker backend configured per backend or globally + to use load checker daemon? + - or on a per session profile basis? + - plus: more than one host configured for the given session profile? @param profile_id: choose remote agent for this profile ID @type profile_id: C{unicode} @@ -733,27 +734,27 @@ class X2GoBroker(object): @rtype: C{bool} """ - # only use load checker if... - - # it is enabled for the broker backend... - if self.get_use_load_checker(): - - _profile_broker = self.get_profile_broker(profile_id) + _profile_broker = self.get_profile_broker(profile_id) + if not _profile_broker: + return False + _profile_session = self.get_profile(profile_id) - # it is not explicitly disabled per session profile definition - if _profile_broker and 'broker-use-load-checker' in _profile_broker and _profile_broker['broker-use-load-checker'] not in ('1', 'true'): - return False - - _profile = self.get_profile(profile_id) + # only use load checker if... - # more than one host is defined in the session profile - if len(_profile['host']) < 2: - return False + # more than one host is defined in the session profile + if len(_profile_session['host']) < 2: + return False - else: + # if not blocked on a per session profile basis + if 'broker-use-load-checker' in _profile_broker and _profile_broker['broker-use-load-checker'] not in ('1', 'true'): return False - return True + # if load checking is enabled globally, for the broker backend, + # or for the given session profile... + if self.get_use_load_checker() or ('broker-use-load-checker' in _profile_broker and _profile_broker['broker-use-load-checker'] in ('1', 'true')): + return True + + return False def _import_nameservice_module(self, service='libnss'): try: -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git