X2Go dev team | 25 Jan 10:29 2013

x2gobroker.git - master (branch) updated: 0d6d00e7bcf3bf35a81e4e3a67d2c81e659bc9af

The branch, master has been updated
       via  0d6d00e7bcf3bf35a81e4e3a67d2c81e659bc9af (commit)
      from  6a6166dd7717a5b608b05445b2cf210bedccc90a (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 0d6d00e7bcf3bf35a81e4e3a67d2c81e659bc9af
Author: Mike Gabriel <mike.gabriel@...>
Date:   Fri Jan 25 10:29:58 2013 +0100

    make sure that the nameservice backend can fall back to hard-coded defaults (=libnss)

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

Summary of changes:
 x2gobroker/brokers/base_broker.py    |    8 ++++----
 x2gobroker/tests/test_broker_base.py |   17 +++++++++++++++++
 2 files changed, 21 insertions(+), 4 deletions(-)

The diff of changes is:
diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py
index 17aec0e..42f49f3 100644
--- a/x2gobroker/brokers/base_broker.py
+++ b/x2gobroker/brokers/base_broker.py
 <at>  <at>  -343,10 +343,10  <at>  <at>  class X2GoBroker(object):
         """
         _user_db = "libnss"
         if self.config.has_value('global', 'default-user-db'):
-            _user_db = self.config.get_value('global', 'default-user-db').lower()
+            _user_db = self.config.get_value('global', 'default-user-db').lower() or _user_db

         if self.config.has_value(self.backend_name, 'user-db'):
-            _user_db = self.config.get_value(self.backend_name, 'user-db').lower()
+            _user_db = self.config.get_value(self.backend_name, 'user-db').lower() or _user_db

         return unicode(_user_db)

 <at>  <at>  -361,10 +361,10  <at>  <at>  class X2GoBroker(object):
         """
         _group_db = "libnss"
         if self.config.has_value('global', 'default-group-db'):
-            _group_db = self.config.get_value('global', 'default-group-db').lower()
+            _group_db = self.config.get_value('global', 'default-group-db').lower() or _group_db

         if self.config.has_value(self.backend_name, 'group-db'):
-            _group_db = self.config.get_value(self.backend_name, 'group-db').lower()
+            _group_db = self.config.get_value(self.backend_name, 'group-db').lower() or _group_db

         return unicode(_group_db)

diff --git a/x2gobroker/tests/test_broker_base.py b/x2gobroker/tests/test_broker_base.py
index f751e02..8491e88 100644
--- a/x2gobroker/tests/test_broker_base.py
+++ b/x2gobroker/tests/test_broker_base.py
 <at>  <at>  -203,6 +203,23  <at>  <at>  enable = true
         self.assertTrue( ( 'root' not in base_backend.get_group_members('root') ) )
         self.assertTrue( ( 'root' in base_backend.get_group_members('root', primary_groups=True) ) )

+    def test_nameservice_nodefaultsinconfig(self):
+        _config_defaults = copy.deepcopy(x2gobroker.defaults.X2GOBROKER_CONFIG_DEFAULTS)
+        _config = """
+[global]
+default-user-db =
+default-group-db =
+
+[base]
+enable = true
+"""
+        tf = tempfile.NamedTemporaryFile()
+        print >> tf, _config
+        tf.seek(0)
+        base_backend = base.X2GoBroker(config_file=tf.name, config_defaults=_config_defaults)
+        self.assertEqual(base_backend.get_userdb_service(), 'libnss')
+        self.assertEqual(base_backend.get_groupdb_service(), 'libnss')
+
     ### TEST CONFIGURATION: global >> check-credentials = false

     def test_check_access_nocreds(self):

hooks/post-receive

Gmane