Hello community, here is the log from the commit of package ceph-iscsi for openSUSE:Factory checked in at 2019-06-12 13:17:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ceph-iscsi (Old) and /work/SRC/openSUSE:Factory/.ceph-iscsi.new.4811 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ceph-iscsi" Wed Jun 12 13:17:28 2019 rev:15 rq:709111 version:3.0+1560249372.g70ec7a9 Changes: -------- --- /work/SRC/openSUSE:Factory/ceph-iscsi/ceph-iscsi.changes 2019-06-07 12:19:11.752774635 +0200 +++ /work/SRC/openSUSE:Factory/.ceph-iscsi.new.4811/ceph-iscsi.changes 2019-06-12 13:17:29.488615832 +0200 @@ -1,0 +2,13 @@ +Tue Jun 11 10:36:22 UTC 2019 - Nathan Cutler <[email protected]> + +- Update to 3.0+1560249372.g70ec7a9: + + spec: drop python3-configshell-fb version guard + +------------------------------------------------------------------- +Mon Jun 10 15:39:27 UTC 2019 - Nathan Cutler <[email protected]> + +- Update to 3.0+1560181178.g3010fd7: + + Fix config hash check validation + + spec: fix rhel conditional blocks + +------------------------------------------------------------------- Old: ---- ceph-iscsi-3.0+1559837868.g8be74cf.tar.gz New: ---- ceph-iscsi-3.0+1560249372.g70ec7a9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ceph-iscsi.spec ++++++ --- /var/tmp/diff_new_pack.ac44Ew/_old 2019-06-12 13:17:30.424614850 +0200 +++ /var/tmp/diff_new_pack.ac44Ew/_new 2019-06-12 13:17:30.428614847 +0200 @@ -20,7 +20,7 @@ Name: ceph-iscsi -Version: 3.0+1559837868.g8be74cf +Version: 3.0+1560249372.g70ec7a9 Release: 1%{?dist} Group: System/Filesystems Summary: Python modules for Ceph iSCSI gateway configuration management @@ -51,7 +51,7 @@ Requires: rpm-python >= 4.11 Requires: python-cryptography Requires: python-flask >= 0.10.1 -Requires: python-configshell >= 1.1.fb23 +Requires: python-configshell %else BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -65,14 +65,14 @@ BuildRequires: python-rpm-macros BuildRequires: fdupes Requires: python3-Flask >= 0.10.1 -Requires: python3-configshell-fb >= 1.1.23 +Requires: python3-configshell-fb %else Requires: python3-flask >= 0.10.1 -Requires: python3-configshell >= 1.1.fb23 +Requires: python3-configshell %endif %endif -%if 0%{?rhel} < 8 +%if 0%{?rhel} == 7 BuildRequires: systemd %else BuildRequires: systemd-rpm-macros @@ -144,7 +144,7 @@ %endif %post -%if 0%{?rhel} < 8 +%if 0%{?rhel} == 7 /bin/systemctl --system daemon-reload &> /dev/null || : /bin/systemctl --system enable rbd-target-gw &> /dev/null || : /bin/systemctl --system enable rbd-target-api &> /dev/null || : @@ -167,7 +167,7 @@ %endif %postun -%if 0%{?rhel} < 8 +%if 0%{?rhel} == 7 /bin/systemctl --system daemon-reload &> /dev/null || : %endif %if 0%{?fedora} || 0%{?rhel} >= 8 ++++++ ceph-iscsi-3.0+1559837868.g8be74cf.tar.gz -> ceph-iscsi-3.0+1560249372.g70ec7a9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1559837868.g8be74cf/ceph-iscsi.spec new/ceph-iscsi-3.0+1560249372.g70ec7a9/ceph-iscsi.spec --- old/ceph-iscsi-3.0+1559837868.g8be74cf/ceph-iscsi.spec 2019-06-06 18:17:48.750324892 +0200 +++ new/ceph-iscsi-3.0+1560249372.g70ec7a9/ceph-iscsi.spec 2019-06-11 12:36:12.911206015 +0200 @@ -20,7 +20,7 @@ Name: ceph-iscsi -Version: 3.0+1559837868.g8be74cf +Version: 3.0+1560249372.g70ec7a9 Release: 1%{?dist} Group: System/Filesystems Summary: Python modules for Ceph iSCSI gateway configuration management @@ -51,7 +51,7 @@ Requires: rpm-python >= 4.11 Requires: python-cryptography Requires: python-flask >= 0.10.1 -Requires: python-configshell >= 1.1.fb23 +Requires: python-configshell %else BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -65,14 +65,14 @@ BuildRequires: python-rpm-macros BuildRequires: fdupes Requires: python3-Flask >= 0.10.1 -Requires: python3-configshell-fb >= 1.1.23 +Requires: python3-configshell-fb %else Requires: python3-flask >= 0.10.1 -Requires: python3-configshell >= 1.1.fb23 +Requires: python3-configshell %endif %endif -%if 0%{?rhel} < 8 +%if 0%{?rhel} == 7 BuildRequires: systemd %else BuildRequires: systemd-rpm-macros @@ -144,7 +144,7 @@ %endif %post -%if 0%{?rhel} < 8 +%if 0%{?rhel} == 7 /bin/systemctl --system daemon-reload &> /dev/null || : /bin/systemctl --system enable rbd-target-gw &> /dev/null || : /bin/systemctl --system enable rbd-target-api &> /dev/null || : @@ -167,7 +167,7 @@ %endif %postun -%if 0%{?rhel} < 8 +%if 0%{?rhel} == 7 /bin/systemctl --system daemon-reload &> /dev/null || : %endif %if 0%{?fedora} || 0%{?rhel} >= 8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1559837868.g8be74cf/ceph_iscsi_config/settings.py new/ceph-iscsi-3.0+1560249372.g70ec7a9/ceph_iscsi_config/settings.py --- old/ceph-iscsi-3.0+1559837868.g8be74cf/ceph_iscsi_config/settings.py 2019-06-06 18:17:48.166326772 +0200 +++ new/ceph-iscsi-3.0+1560249372.g70ec7a9/ceph_iscsi_config/settings.py 2019-06-11 12:36:12.615206521 +0200 @@ -7,6 +7,8 @@ from configparser import ConfigParser from distutils.util import strtobool +import hashlib +import json import logging import re @@ -119,6 +121,14 @@ "fqdn_enabled": "false" } + sync_required = ["cluster_name", + "pool", + "api_port", + "api_secure", + "minimum_gateways", + "prometheus_port" + ] + target_defaults = {"osd_op_timeout": 30, "dataout_timeout": 20, "nopin_response_timeout": 5, @@ -221,3 +231,17 @@ v = self.normalize(k, settings[k]) self.__setattr__(k, v) + + def hash(self): + """ + Generates a sha256 hash of the settings that are required to be in sync between gateways. + :return: checksum (str) + """ + + sync_settings = {} + for setting in Settings.sync_required: + sync_settings[setting] = getattr(self, setting) + + h = hashlib.sha256() + h.update(json.dumps(sync_settings).encode('utf-8')) + return h.hexdigest() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1559837868.g8be74cf/ceph_iscsi_config/utils.py new/ceph-iscsi-3.0+1560249372.g70ec7a9/ceph_iscsi_config/utils.py --- old/ceph-iscsi-3.0+1559837868.g8be74cf/ceph_iscsi_config/utils.py 2019-06-06 18:17:48.166326772 +0200 +++ new/ceph-iscsi-3.0+1560249372.g70ec7a9/ceph_iscsi_config/utils.py 2019-06-11 12:36:12.615206521 +0200 @@ -5,7 +5,6 @@ import rbd import re import datetime -import hashlib import os import rpm @@ -286,30 +285,6 @@ return socket.getfqdn() if fqdn_enabled else socket.gethostname().split('.')[0] -def gen_file_hash(filename, hash_type='sha256'): - """ - generate a hash(default sha256) of a file and return the result - :param filename: filename to generate the checksum for - :param hash_type: type of checksum to generate - :return: checkum (str) - """ - - if (hash_type not in ['sha1', 'sha256', 'sha512', 'md5'] or not - os.path.exists(filename)): - return '' - - hash_function = getattr(hashlib, hash_type) - h = hash_function() - - with open(filename, 'rb') as file_in: - chunk = 0 - while chunk != b'': - chunk = file_in.read(1024) - h.update(chunk) - - return h.hexdigest() - - def valid_rpm(in_rpm): """ check a given rpm matches the current installed rpm diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1559837868.g8be74cf/gwcli/utils.py new/ceph-iscsi-3.0+1560249372.g70ec7a9/gwcli/utils.py --- old/ceph-iscsi-3.0+1559837868.g8be74cf/gwcli/utils.py 2019-06-06 18:17:48.174326746 +0200 +++ new/ceph-iscsi-3.0+1560249372.g70ec7a9/gwcli/utils.py 2019-06-11 12:36:12.615206521 +0200 @@ -11,7 +11,7 @@ from ceph_iscsi_config.client import GWClient import ceph_iscsi_config.settings as settings -from ceph_iscsi_config.utils import (resolve_ip_addresses, gen_file_hash, +from ceph_iscsi_config.utils import (resolve_ip_addresses, CephiSCSIError) __author__ = 'Paul Cuzner' @@ -126,7 +126,7 @@ api.response.status_code)) # compare the hash of the new gateways conf file with the local one - local_hash = gen_file_hash('/etc/ceph/iscsi-gateway.cfg') + local_hash = settings.config.hash() try: remote_hash = str(api.response.json()['data']) except Exception: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1559837868.g8be74cf/rbd-target-api.py new/ceph-iscsi-3.0+1560249372.g70ec7a9/rbd-target-api.py --- old/ceph-iscsi-3.0+1559837868.g8be74cf/rbd-target-api.py 2019-06-06 18:17:48.174326746 +0200 +++ new/ceph-iscsi-3.0+1560249372.g70ec7a9/rbd-target-api.py 2019-06-11 12:36:12.619206514 +0200 @@ -34,7 +34,7 @@ from ceph_iscsi_config.client import GWClient, CHAP from ceph_iscsi_config.common import Config from ceph_iscsi_config.utils import (normalize_ip_literal, resolve_ip_addresses, - ip_addresses, gen_file_hash, valid_rpm, + ip_addresses, valid_rpm, format_lio_yes_no, CephiSCSIError) from gwcli.utils import (this_host, APIRequest, valid_gateway, valid_client, @@ -182,7 +182,7 @@ elif query_type == 'checkconf': - local_hash = gen_file_hash('/etc/ceph/iscsi-gateway.cfg') + local_hash = settings.config.hash() return jsonify(data=local_hash), 200 elif query_type == 'checkversions':
