Hello community, here is the log from the commit of package python-ceph-cfg for openSUSE:Factory checked in at 2016-11-20 18:18:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-ceph-cfg (Old) and /work/SRC/openSUSE:Factory/.python-ceph-cfg.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ceph-cfg" Changes: -------- --- /work/SRC/openSUSE:Factory/python-ceph-cfg/python-ceph-cfg.changes 2016-09-21 18:50:29.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-ceph-cfg.new/python-ceph-cfg.changes 2016-11-20 18:18:51.000000000 +0100 @@ -2 +2,11 @@ -Fri Sep 9 13:44:30 CEST 2016 UTC 2016 - osy...@suse.com +Fri Nov 11 23:15:14 UTC 2016 - osy...@suse.com + +- Updated to version 0.2.3 + * Better error reporting when failing to communicate with the + cluster. + * Handle configuration files with no sections correctly. + * Better python3 compliance. + * More unit tests. + +------------------------------------------------------------------- +Fri Sep 9 13:44:30 UTC 2016 - osy...@suse.com Old: ---- python-ceph-cfg-0.2.1+git.1473421401.a6a2208.tar.xz New: ---- python-ceph-cfg-0.2.3+git.1478902462.f898834.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-ceph-cfg.spec ++++++ --- /var/tmp/diff_new_pack.7SGVrp/_old 2016-11-20 18:18:52.000000000 +0100 +++ /var/tmp/diff_new_pack.7SGVrp/_new 2016-11-20 18:18:52.000000000 +0100 @@ -45,7 +45,7 @@ %endif Name: python-ceph-cfg -Version: 0.2.1+git.1473421401.a6a2208 +Version: 0.2.3+git.1478902462.f898834 Release: 0 Summary: Python library to Admin and deploy Ceph License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.7SGVrp/_old 2016-11-20 18:18:52.000000000 +0100 +++ /var/tmp/diff_new_pack.7SGVrp/_new 2016-11-20 18:18:52.000000000 +0100 @@ -1,8 +1,8 @@ <services> <service name="tar_scm" mode="disabled"> - <param name="versionformat">0.2.1+git.%ct.%h</param> + <param name="versionformat">0.2.3+git.%ct.%h</param> <param name="url">https://github.com/oms4suse/python-ceph-cfg.git</param> - <param name="revision">python-ceph-cfg_0.2.1</param> + <param name="revision">python-ceph-cfg_0.2.3</param> <param name="filename">python-ceph-cfg</param> <param name="scm">git</param> </service> ++++++ python-ceph-cfg-0.2.1+git.1473421401.a6a2208.tar.xz -> python-ceph-cfg-0.2.3+git.1478902462.f898834.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/CHANGELOG.rst new/python-ceph-cfg-0.2.3+git.1478902462.f898834/CHANGELOG.rst --- old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/CHANGELOG.rst 2016-09-09 13:43:21.000000000 +0200 +++ new/python-ceph-cfg-0.2.3+git.1478902462.f898834/CHANGELOG.rst 2016-11-11 23:14:22.000000000 +0100 @@ -1,3 +1,19 @@ +0.2.3 +----- +* Bugfix correctly handle ceph conf files without a section as if they + had a global section. + +0.2.2 +----- +* Bugfix when the cluster is down and remote operations are requested. + + All remote now provide a clear exception when the cluster cannot be + reached securely. +* Added more unit tests. + + Keyring operations. + + Remote operations. +* The python builtin method 'file' is deprecated and should not be used. + + This fix for tox when running latest version of python3. + 0.2.1 ----- * Bugfix with mon_status. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/MANIFEST.in new/python-ceph-cfg-0.2.3+git.1478902462.f898834/MANIFEST.in --- old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/MANIFEST.in 2016-09-09 13:43:21.000000000 +0200 +++ new/python-ceph-cfg-0.2.3+git.1478902462.f898834/MANIFEST.in 2016-11-11 23:14:22.000000000 +0100 @@ -1,3 +1,4 @@ include LICENSE include README.md include CHANGELOG.rst +include ceph_cfg/tests/*.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/__init__.py new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/__init__.py --- old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/__init__.py 2016-09-09 13:43:21.000000000 +0200 +++ new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/__init__.py 2016-11-11 23:14:22.000000000 +0100 @@ -141,7 +141,7 @@ # isn't too thorough. lba_size = 4096 size = 33 * lba_size - with file(dev, 'wb') as dev_file: + with open(dev, 'wb') as dev_file: dev_file.seek(-size, os.SEEK_END) dev_file.write(size*'\0') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/__version__.py new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/__version__.py --- old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/__version__.py 2016-09-09 13:43:21.000000000 +0200 +++ new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/__version__.py 2016-11-11 23:14:22.000000000 +0100 @@ -1 +1 @@ -version = "0.2.1" +version = "0.2.3" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/remote_connection.py new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/remote_connection.py --- old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/remote_connection.py 2016-09-09 13:43:21.000000000 +0200 +++ new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/remote_connection.py 2016-11-11 23:14:22.000000000 +0100 @@ -37,7 +37,7 @@ def arguments_get(self): if not self.has_connected(): self.connect() - if self.has_connected: + if self.has_connected(): return [ '--connect-timeout', '%s' % (constants.ceph_remote_call_timeout), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/tests/test_configparserceph.py new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/tests/test_configparserceph.py --- old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/tests/test_configparserceph.py 2016-09-09 13:43:21.000000000 +0200 +++ new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/tests/test_configparserceph.py 2016-11-11 23:14:22.000000000 +0100 @@ -61,3 +61,13 @@ config.read(file_name) value = config.get("mysqld", "user_2") assert value == "mysql" + + + def test_no_global_section(self): + config = ConfigParser() + file_name = os.path.join(self.test_dir,"file") + with open(file_name, 'wt') as fp: + fp.write("user2 = mysql") + config.read(file_name) + value = config.get("global", "user2") + assert value == "mysql" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/tests/test_keyring.py new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/tests/test_keyring.py --- old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/tests/test_keyring.py 1970-01-01 01:00:00.000000000 +0100 +++ new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/tests/test_keyring.py 2016-11-11 23:14:22.000000000 +0100 @@ -0,0 +1,21 @@ +import ceph_cfg.model +import ceph_cfg.keyring + + +class Test_keyring(object): + def setup(self): + mdl = ceph_cfg.model.model() + mdl.cluster_name = "ceph" + self.keyring = ceph_cfg.keyring.keyring_facard(mdl) + + + def test_keyring_types_path_get(self): + for keyring_type in ["admin", "mds", "mon", "osd", "rgw"]: + self.keyring.key_type = keyring_type + assert self.keyring.keyring_path_get() != None + + + def test_keyring_types_keyring_identity(self): + for keyring_type in ["admin", "mds", "mon", "osd", "rgw"]: + self.keyring.key_type = keyring_type + assert self.keyring.keyring_identity_get() != None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/tests/test_remote_connection.py new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/tests/test_remote_connection.py --- old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/tests/test_remote_connection.py 1970-01-01 01:00:00.000000000 +0100 +++ new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/tests/test_remote_connection.py 2016-11-11 23:14:22.000000000 +0100 @@ -0,0 +1,37 @@ +import pytest +import ceph_cfg.model +import ceph_cfg.keyring +import ceph_cfg.remote_connection +import mock + + +def mock_connection_fail(*args): + output= { + 'stdout' : "Could not connect\n", + 'stderr' : "", + 'retcode' : 1 + } + return output + + +class Test_remote_connection(object): + def setup(self): + self.mdl = ceph_cfg.model.model() + self.mdl.cluster_name = "ceph" + self.remote_connection = ceph_cfg.remote_connection.connection(self.mdl) + + + def test_arguments_get_connection(self): + self.mdl.connection.keyring_type = "admin" + self.mdl.connection.keyring_path = "/etc/ceph/ceph.client.admin.keyring" + self.mdl.connection.keyring_identity = "client.admin" + args_list = self.remote_connection.arguments_get() + assert self.mdl.connection.keyring_path in args_list + assert self.mdl.connection.keyring_identity in args_list + + + @mock.patch('ceph_cfg.utils.execute_local_command', mock_connection_fail) + def test_arguments_get_no_connection(self): + with pytest.raises(ceph_cfg.remote_connection.Error) as excinfo: + self.remote_connection.arguments_get() + assert 'Failed to connect to cluster' in str(excinfo.value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/util_configparser.py new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/util_configparser.py --- old/python-ceph-cfg-0.2.1+git.1473421401.a6a2208/ceph_cfg/util_configparser.py 2016-09-09 13:43:21.000000000 +0200 +++ new/python-ceph-cfg-0.2.3+git.1478902462.f898834/ceph_cfg/util_configparser.py 2016-11-11 23:14:22.000000000 +0100 @@ -1,3 +1,4 @@ +from io import StringIO try: import ConfigParser except: @@ -14,3 +15,36 @@ replaced = stripped.replace(' ', '_') return replaced + + def _MissingSectionHeaderError_read(self,file_name): + vfile = StringIO(u'[global]\n%s' % open(file_name).read()) + return ConfigParser.ConfigParser.readfp(self, vfile) + + + def read(self, filenames): + """Read and parse a filename or a list of filenames. + + Files that cannot be opened are silently ignored; this is + designed so that you can specify a list of potential + configuration file locations (e.g. current directory, user's + home directory, systemwide directory), and all existing + configuration files in the list will be read. A single + filename may also be given. + + Return list of successfully read files. + """ + if isinstance(filenames, ("".__class__, u"".__class__)): + filenames = [filenames] + read_ok = [] + for filename in filenames: + try: + fp = open(filename) + except IOError: + continue + try: + self._read(fp, filename) + except ConfigParser.MissingSectionHeaderError: + self._MissingSectionHeaderError_read(filename) + fp.close() + read_ok.append(filename) + return read_ok