commit python-masakariclient for openSUSE:Factory
Hello community, here is the log from the commit of package python-masakariclient for openSUSE:Factory checked in at 2019-05-03 22:41:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-masakariclient (Old) and /work/SRC/openSUSE:Factory/.python-masakariclient.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-masakariclient" Fri May 3 22:41:13 2019 rev:5 rq:692836 version:5.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-masakariclient/python-masakariclient.changes 2018-09-07 15:37:53.482633589 +0200 +++ /work/SRC/openSUSE:Factory/.python-masakariclient.new.5148/python-masakariclient.changes 2019-05-03 22:41:15.851094634 +0200 @@ -1,0 +2,19 @@ +Mon Apr 8 12:19:25 UTC 2019 - cloud-devel@suse.de + +- update to version 5.4.0 + - Add --os-interface and --os-region-name options + - Update the hacking to latest + - Update the outdated URL in HACKING.rst + - Add Python 3.6 classifier to setup.cfg + - Run all jobs by default using python3 + - Fix osc command issue + - Change openstack-dev to openstack-discuss + - Add api_version support + - Update reno for stable/rocky + - Display progress_details of the notification + - Use template for lower-constraints + - Delete segment and host shouldn't ignore not found error + - Deprecate masakari CLI + - import zuul job settings from project-config + +------------------------------------------------------------------- Old: ---- python-masakariclient-5.2.0.tar.gz New: ---- python-masakariclient-5.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-masakariclient.spec ++++++ --- /var/tmp/diff_new_pack.2HL0PP/_old 2019-05-03 22:41:16.359095704 +0200 +++ /var/tmp/diff_new_pack.2HL0PP/_new 2019-05-03 22:41:16.359095704 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-masakariclient # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,13 +12,13 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # %global sname python-masakariclient Name: python-masakariclient -Version: 5.2.0 +Version: 5.4.0 Release: 0 Summary: Python API and CLI for OpenStack Masakari License: Apache-2.0 @@ -33,7 +33,6 @@ BuildRequires: python-osc-lib >= 1.8.0 BuildRequires: python-oslo.serialization >= 2.18.0 BuildRequires: python-oslo.utils -BuildRequires: python-oslosphinx BuildRequires: python-oslotest BuildRequires: python-python-subunit BuildRequires: python-reno @@ -58,6 +57,7 @@ Group: Documentation/HTML BuildRequires: python-Sphinx BuildRequires: python-oslosphinx +BuildRequires: python-sphinxcontrib-apidoc %description doc Client library for Masakari built on the Masakari API. It provides a Python API @@ -72,8 +72,9 @@ %py2_build # Build HTML docs and man page -%{__python2} setup.py build_sphinx --builder=html,man -rm -rf html/.{doctrees,buildinfo} +PBR_VERSION=%{version} sphinx-build -b html doc/source doc/build/html +PBR_VERSION=%{version} sphinx-build -b man doc/source doc/build/man +rm -r doc/build/html/.{doctrees,buildinfo} %install %py2_install ++++++ _service ++++++ --- /var/tmp/diff_new_pack.2HL0PP/_old 2019-05-03 22:41:16.379095746 +0200 +++ /var/tmp/diff_new_pack.2HL0PP/_new 2019-05-03 22:41:16.383095754 +0200 @@ -1,8 +1,8 @@ <services> <service mode="disabled" name="renderspec"> - <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/rocky/openstack/python-masakariclient/python-masakariclient.spec.j2</param> + <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/stein/openstack/python-masakariclient/python-masakariclient.spec.j2</param> <param name="output-name">python-masakariclient.spec</param> - <param name="requirements">https://raw.githubusercontent.com/openstack/python-masakariclient/stable/rocky/requirements.txt</param> + <param name="requirements">https://raw.githubusercontent.com/openstack/python-masakariclient/stable/stein/requirements.txt</param> <param name="changelog-email">cloud-devel@suse.de</param> <param name="changelog-provider">gh,openstack,python-masakariclient</param> </service> ++++++ python-masakariclient-5.2.0.tar.gz -> python-masakariclient-5.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/.zuul.yaml new/python-masakariclient-5.4.0/.zuul.yaml --- old/python-masakariclient-5.2.0/.zuul.yaml 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/.zuul.yaml 2019-03-08 13:54:27.000000000 +0100 @@ -1,7 +1,9 @@ - project: - check: - jobs: - - openstack-tox-lower-constraints - gate: - jobs: - - openstack-tox-lower-constraints + templates: + - check-requirements + - openstack-lower-constraints-jobs + - openstack-python-jobs + - openstack-python35-jobs + - openstack-python36-jobs + - publish-openstack-docs-pti + - release-notes-jobs-python3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/AUTHORS new/python-masakariclient-5.4.0/AUTHORS --- old/python-masakariclient-5.2.0/AUTHORS 2018-07-26 16:10:35.000000000 +0200 +++ new/python-masakariclient-5.4.0/AUTHORS 2019-03-08 13:56:32.000000000 +0100 @@ -5,15 +5,27 @@ Kengo Takahara <takahara-kn@njk.co.jp> Kengo Takahara <takahara.kengo.z03@as.ntts.co.jp> Monty Taylor <mordred@inaugust.com> +Nguyen Hai <nguyentrihai93@gmail.com> +OpenStack Release Bot <infra-root@openstack.org> Rikimaru Honjo <honjo.rikimaru@po.ntts.co.jp> Takahiro Izumi <izumi.takahiro.z04@as.ntts.co.jp> -Zuul <zuul@review.openstack.org> +ZhijunWei <wzj334965317@outlook.com> avnish <avnish.pal@nectechnologies.in> +bhagyashris <bhagyashri.shewale@nttdata.com> dineshbhor <dinesh.bhor@nttdata.com> ericxiett <eric_xiett@163.com> hussainchachuliya <hussain.chachuliya@nttdata.com> +jayashri bidwe <jayashri.bidwe@nttdata.com> +melissaml <ma.lei@99cloud.net> nehaalhat <neha.alhat@nttdata.com> nizam <abdul.nizamuddin@nectechnologies.in> +openstack <neha.alhat@nttdata.com> +openstack <nehaalhat@nttdata.com> poojajadhav <pooja.jadhav@nttdata.com> +qingszhao <zhao.daqing@99cloud.net> ricolin <rico.lin@easystack.cn> +samp <sampath@SamMacBookPro2.local> sampath <priyankara@lab.ntt.co.jp> +shilpa.devharakar <shilpa.devharakar@nttdata.com> +sunjia <sunjia@inspur.com> +tpatil <tushar.vitthal.patil@gmail.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/ChangeLog new/python-masakariclient-5.4.0/ChangeLog --- old/python-masakariclient-5.2.0/ChangeLog 2018-07-26 16:10:35.000000000 +0200 +++ new/python-masakariclient-5.4.0/ChangeLog 2019-03-08 13:56:32.000000000 +0100 @@ -1,6 +1,28 @@ CHANGES ======= +5.4.0 +----- + +* Use template for lower-constraints +* Display progress\_details of the notification +* Deprecate masakari CLI +* Add api\_version support +* Run all jobs by default using python3 + +5.3.0 +----- + +* Delete segment and host shouldn't ignore not found error +* Update the hacking to latest +* Change openstack-dev to openstack-discuss +* Add Python 3.6 classifier to setup.cfg +* Fix osc command issue +* Update the outdated URL in HACKING.rst +* import zuul job settings from project-config +* Add --os-interface and --os-region-name options +* Update reno for stable/rocky + 5.2.0 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/HACKING.rst new/python-masakariclient-5.4.0/HACKING.rst --- old/python-masakariclient-5.2.0/HACKING.rst 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/HACKING.rst 2019-03-08 13:54:22.000000000 +0100 @@ -1,4 +1,4 @@ python-masakariclient Style Commandments -=============================================== +======================================== -Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ +Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/PKG-INFO new/python-masakariclient-5.4.0/PKG-INFO --- old/python-masakariclient-5.2.0/PKG-INFO 2018-07-26 16:10:36.000000000 +0200 +++ new/python-masakariclient-5.4.0/PKG-INFO 2019-03-08 13:56:32.000000000 +0100 @@ -1,10 +1,10 @@ Metadata-Version: 1.1 Name: python-masakariclient -Version: 5.2.0 +Version: 5.4.0 Summary: masakariclient module and a CLI tool for masakari Home-page: http://www.openstack.org/ Author: OpenStack -Author-email: openstack-dev@lists.openstack.org +Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: =============================== python-masakariclient @@ -38,3 +38,4 @@ Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/RELEASENOTES.rst new/python-masakariclient-5.4.0/RELEASENOTES.rst --- old/python-masakariclient-5.2.0/RELEASENOTES.rst 2018-07-26 16:10:36.000000000 +0200 +++ new/python-masakariclient-5.4.0/RELEASENOTES.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -===================== -python-masakariclient -===================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/masakariclient/api_versions.py new/python-masakariclient-5.4.0/masakariclient/api_versions.py --- old/python-masakariclient-5.2.0/masakariclient/api_versions.py 1970-01-01 01:00:00.000000000 +0100 +++ new/python-masakariclient-5.4.0/masakariclient/api_versions.py 2019-03-08 13:54:27.000000000 +0100 @@ -0,0 +1,150 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import re + +from masakariclient.common import exception +from masakariclient.common.i18n import _ + + +_type_error_msg = _("'%(other)s' should be an instance of '%(cls)s'") + + +class APIVersion(object): + """This class represents an API Version Request. + + This class provides convenience methods for manipulation + and comparison of version numbers that we need to do to + implement microversions. + """ + + def __init__(self, version_str=None): + """Create an API version object. + + :param version_str: String representation of APIVersionRequest. + Correct format is 'X.Y', where 'X' and 'Y' + are int values. None value should be used + to create Null APIVersionRequest, which is + equal to 0.0 + """ + self.ver_major = 0 + self.ver_minor = 0 + + if version_str is not None: + match = re.match(r"^([1-9]\d*)\.([1-9]\d*|0|latest)$", version_str) + if match: + self.ver_major = int(match.group(1)) + if match.group(2) == "latest": + # Infinity allows to easily determine latest version and + # doesn't require any additional checks in comparison + # methods. + self.ver_minor = float("inf") + else: + self.ver_minor = int(match.group(2)) + else: + msg = _("Invalid format of client version '%s'. " + "Expected format 'X.Y', where X is a major part and Y " + "is a minor part of version.") % version_str + raise exception.UnsupportedVersion(msg) + + def __str__(self): + """Debug/Logging representation of object.""" + if self.is_latest(): + return "Latest API Version Major: %s" % self.ver_major + return ("API Version Major: %s, Minor: %s" + % (self.ver_major, self.ver_minor)) + + def __repr__(self): + if self.is_null(): + return "<APIVersion: null>" + else: + return "<APIVersion: %s>" % self.get_string() + + def is_null(self): + return self.ver_major == 0 and self.ver_minor == 0 + + def is_latest(self): + return self.ver_minor == float("inf") + + def __lt__(self, other): + if not isinstance(other, APIVersion): + raise TypeError(_type_error_msg % {"other": other, + "cls": self.__class__}) + + return ((self.ver_major, self.ver_minor) < + (other.ver_major, other.ver_minor)) + + def __eq__(self, other): + if not isinstance(other, APIVersion): + raise TypeError(_type_error_msg % {"other": other, + "cls": self.__class__}) + + return ((self.ver_major, self.ver_minor) == + (other.ver_major, other.ver_minor)) + + def __gt__(self, other): + if not isinstance(other, APIVersion): + raise TypeError(_type_error_msg % {"other": other, + "cls": self.__class__}) + + return ((self.ver_major, self.ver_minor) > + (other.ver_major, other.ver_minor)) + + def __le__(self, other): + return self < other or self == other + + def __ne__(self, other): + return not self.__eq__(other) + + def __ge__(self, other): + return self > other or self == other + + def matches(self, min_version, max_version): + """Matches the version object. + + Returns whether the version object represents a version + greater than or equal to the minimum version and less than + or equal to the maximum version. + + :param min_version: Minimum acceptable version. + :param max_version: Maximum acceptable version. + :returns: boolean + + If min_version is null then there is no minimum limit. + If max_version is null then there is no maximum limit. + If self is null then raise ValueError + """ + + if self.is_null(): + raise ValueError(_("Null APIVersion doesn't support 'matches'.")) + if max_version.is_null() and min_version.is_null(): + return True + elif max_version.is_null(): + return min_version <= self + elif min_version.is_null(): + return self <= max_version + else: + return min_version <= self <= max_version + + def get_string(self): + """Version string representation. + + Converts object to string representation which if used to create + an APIVersion object results in the same version. + """ + if self.is_null(): + raise ValueError( + _("Null APIVersion cannot be converted to string.")) + elif self.is_latest(): + return "%s.%s" % (self.ver_major, "latest") + return "%s.%s" % (self.ver_major, self.ver_minor) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/masakariclient/cliargs.py new/python-masakariclient-5.4.0/masakariclient/cliargs.py --- old/python-masakariclient-5.2.0/masakariclient/cliargs.py 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/masakariclient/cliargs.py 2019-03-08 13:54:22.000000000 +0100 @@ -158,3 +158,14 @@ '--os-access-info', dest='access_info', metavar='ACCESS_INFO', default=utils.env('OS_ACCESS_INFO'), help=_('Access info, defaults to env[OS_ACCESS_INFO]')) + + parser.add_argument( + '--os-interface', dest='interface', metavar='INTERFACE', + default=utils.env('OS_INTERFACE', default='internal'), + help=_('API Interface to use [public, internal, admin]' + ', defaults to env[OS_INTERFACE]')) + + parser.add_argument( + '--os-region-name', dest='region_name', metavar='REGION_NAME', + default=utils.env('OS_REGION_NAME'), + help=_('Region of the cloud to use, defaults to env[OS_REGION_NAME]')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/masakariclient/common/exception.py new/python-masakariclient-5.4.0/masakariclient/common/exception.py --- old/python-masakariclient-5.2.0/masakariclient/common/exception.py 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/masakariclient/common/exception.py 2019-03-08 13:54:27.000000000 +0100 @@ -24,3 +24,8 @@ class CommandError(BaseException): """Invalid usage of CLI.""" + + +class UnsupportedVersion(Exception): + """User is trying to use an unsupported version of the API.""" + pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/masakariclient/osc/v1/notification.py new/python-masakariclient-5.4.0/masakariclient/osc/v1/notification.py --- old/python-masakariclient-5.2.0/masakariclient/osc/v1/notification.py 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/masakariclient/osc/v1/notification.py 2019-03-08 13:54:27.000000000 +0100 @@ -18,6 +18,7 @@ from osc_lib import utils from oslo_serialization import jsonutils +from masakariclient import api_versions from masakariclient.common.i18n import _ import masakariclient.common.utils as masakariclient_utils @@ -151,7 +152,14 @@ 'status', 'source_host_uuid', 'generated_time', - 'payload', + 'payload' ] + + if masakari_client.default_microversion: + api_version = api_versions.APIVersion( + masakari_client.default_microversion) + if api_version >= api_versions.APIVersion("1.1"): + columns.append('recovery_workflow_details') + return columns, utils.get_dict_properties(notification.to_dict(), columns, formatters=formatters) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/masakariclient/plugin.py new/python-masakariclient-5.4.0/masakariclient/plugin.py --- old/python-masakariclient-5.2.0/masakariclient/plugin.py 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/masakariclient/plugin.py 2019-03-08 13:54:27.000000000 +0100 @@ -12,19 +12,40 @@ # See the License for the specific language governing permissions and # limitations under the License. -from openstack import connection +import logging + from osc_lib import utils +LOG = logging.getLogger(__name__) -DEFAULT_HA_API_VERSION = '1' +DEFAULT_HA_API_VERSION = '1.1' API_VERSION_OPTION = 'os_ha_api_version' API_NAME = 'ha' +SUPPORTED_VERSIONS = [ + '1', + '1.0', + '1.1' +] + +API_VERSIONS = {v: 'masakariclient.v1.client.Client' + for v in SUPPORTED_VERSIONS} + def make_client(instance): - """Returns a ha proxy""" - conn = connection.Connection(session=instance.session) - return conn.instance_ha + """Returns a instance_ha proxy""" + version = instance._api_version[API_NAME] + masakari_client = utils.get_client_class( + API_NAME, + version, + API_VERSIONS) + + LOG.debug('Instantiating masakari service client: %s', masakari_client) + client = masakari_client(session=instance.session, + interface=instance.interface, + region_name=instance.region_name, + api_version=instance._api_version[API_NAME]) + return client.service def build_option_parser(parser): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/masakariclient/shell.py new/python-masakariclient-5.4.0/masakariclient/shell.py --- old/python-masakariclient-5.2.0/masakariclient/shell.py 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/masakariclient/shell.py 2019-03-08 13:54:22.000000000 +0100 @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import print_function + import argparse import logging import sys @@ -111,6 +113,8 @@ 'verify': args.verify, 'token': args.token, 'trust_id': args.trust_id, + 'interface': args.interface, + 'region_name': args.region_name, } return masakari_client.Client(api_ver, user_agent=USER_AGENT, **kwargs) @@ -183,6 +187,9 @@ def main(args=None): try: + print(_("Deprecated: masakari CLI is deprecated and will be removed " + "after Stein is released. Use openstack CLI instead."), + file=sys.stderr) if args is None: args = sys.argv[1:] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/masakariclient/tests/unit/osc/v1/test_notification.py new/python-masakariclient-5.4.0/masakariclient/tests/unit/osc/v1/test_notification.py --- old/python-masakariclient-5.2.0/masakariclient/tests/unit/osc/v1/test_notification.py 1970-01-01 01:00:00.000000000 +0100 +++ new/python-masakariclient-5.4.0/masakariclient/tests/unit/osc/v1/test_notification.py 2019-03-08 13:54:27.000000000 +0100 @@ -0,0 +1,105 @@ +# Copyright(c) 2019 NTT DATA +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +test_masakariclient +---------------------------------- + +Tests for `masakariclient` module. +""" +import mock +import uuid + +from osc_lib.tests import utils as osc_lib_utils +from osc_lib import utils + +from masakariclient.osc.v1.notification import ShowNotification +from masakariclient.tests import base + +NOTIFICATION_NAME = 'notification_name' +NOTIFICATION_ID = uuid.uuid4() +RECOVERY_WORKFLOW_DETAILS = [{ + "progress": 1.0, "state": "SUCCESS", + "name": "DisableComputeNodeTask", + "progress_details": [ + {"timestamp:": "2019-02-28 07:21:33.170190", + "progress": 0.5, + "message": "Disabling compute host: host"}, + {"timestamp:": "2019-02-28 07:21:33.291810", + "progress": 1.0, + "message": "Skipping recovery for process nova-compute " + "as it is already disabled"}]}] + + +class FakeNotification(object): + """Fake notification show detail.""" + def __init__(self,): + super(FakeNotification, self).__init__() + + def to_dict(self): + return { + 'created_at': '2019-02-18T05:47:46.000000', + 'updated_at': '2019-02-18T06:05:16.000000', + 'notification_uuid': NOTIFICATION_ID, + 'source_host_uuid': '9ab67dc7-110a-4a4c-af64-abc6e5798433', + 'name': NOTIFICATION_NAME, + 'id': 1, + 'type': 'VM', + 'payload': { + "instance_uuid": "99ffc832-2252-4a9e-9b98-28bc70f7ff09", + "vir_domain_event": "STOPPED_FAILED", "event": "LIFECYCLE"}, + 'status': 'finished', + 'recovery_workflow_details': RECOVERY_WORKFLOW_DETAILS, + 'generated_time': '2019-02-13T15:34:55.000000' + } + + +class BaseV1Notification(base.TestCase, osc_lib_utils.TestCommand): + def setUp(self): + super(BaseV1Notification, self).setUp() + self.app = mock.Mock() + self.app_args = mock.Mock() + self.client_manager = mock.Mock() + self.client_manager.default_microversion = '1.0' + self.app.client_manager.ha = self.client_manager + self.dummy_notification = FakeNotification() + self.show_notification = ShowNotification( + self.app, self.app_args, cmd_name='notification show') + self.columns = ['created_at', 'updated_at', 'notification_uuid', + 'type', 'status', 'source_host_uuid', + 'generated_time', 'payload'] + + +class TestShowNotificationV1(BaseV1Notification): + + def test_take_action_by_uuid(self): + arglist = ['8c35987c-f416-46ca-be37-52f58fd8d294'] + parsed_args = self.check_parser(self.show_notification, arglist, []) + self._test_take_action(parsed_args) + + @mock.patch.object(utils, 'get_dict_properties') + def _test_take_action(self, parsed_args, mock_get_dict_properties): + self.app.client_manager.ha.get_notification.return_value = ( + self.dummy_notification) + + self.show_notification.take_action(parsed_args) + mock_get_dict_properties.assert_called_once_with( + self.dummy_notification.to_dict(), self.columns, formatters={}) + + +class TestShowNotificationV1_1(TestShowNotificationV1): + + def setUp(self): + super(TestShowNotificationV1_1, self).setUp() + self.client_manager.default_microversion = '1.1' + self.columns.append('recovery_workflow_details') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/masakariclient/tests/unit/test_cliargs.py new/python-masakariclient-5.4.0/masakariclient/tests/unit/test_cliargs.py --- old/python-masakariclient-5.2.0/masakariclient/tests/unit/test_cliargs.py 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/masakariclient/tests/unit/test_cliargs.py 2019-03-08 13:54:22.000000000 +0100 @@ -41,7 +41,9 @@ '--os-password', '--os-trust-id', '--os-token', - '--os-access-info' + '--os-access-info', + '--os-interface', + '--os-region-name' ] options = [arg[0][0] for arg in parser.add_argument.call_args_list] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/masakariclient/tests/unit/v1/test_client.py new/python-masakariclient-5.4.0/masakariclient/tests/unit/v1/test_client.py --- old/python-masakariclient-5.2.0/masakariclient/tests/unit/v1/test_client.py 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/masakariclient/tests/unit/v1/test_client.py 2019-03-08 13:54:22.000000000 +0100 @@ -59,13 +59,17 @@ fake_user_domain_id = 'fake_user_domain_id' fake_project_name = 'fake_project_name' fake_project_domain_id = 'fake_project_domain_id' + fake_interface = 'fake_interface' + fake_region_name = 'fake_region_name' res = mc.Client(auth_url=fake_auth_url, username=fake_username, password=fake_password, user_domain_id=fake_user_domain_id, project_name=fake_project_name, - project_domain_id=fake_project_domain_id) + project_domain_id=fake_project_domain_id, + interface=fake_interface, + region_name=fake_region_name) self.assertEqual(self.conn.instance_ha, res.service) mock_password.assert_called_once_with( @@ -76,4 +80,7 @@ project_name=fake_project_name, project_domain_id=fake_project_domain_id) mock_session.assert_called_once_with(auth=self.auth) - mock_connection.assert_called_once_with(session=self.session) + mock_connection.assert_called_once_with( + session=self.session, interface=fake_interface, + region_name=fake_region_name, + ha_api_version=None) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/masakariclient/tests/unit/v1/test_shell.py new/python-masakariclient-5.4.0/masakariclient/tests/unit/v1/test_shell.py --- old/python-masakariclient-5.2.0/masakariclient/tests/unit/v1/test_shell.py 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/masakariclient/tests/unit/v1/test_shell.py 2019-03-08 13:54:22.000000000 +0100 @@ -17,9 +17,16 @@ Tests for `masakariclient` module. """ + import ddt import mock +import six +import sys + +from openstack import exceptions as sdk_exc +from openstack.instance_ha.v1 import _proxy +from masakariclient.common.i18n import _ from masakariclient.common import utils from masakariclient import shell from masakariclient.tests import base @@ -204,6 +211,31 @@ mock_get_uuid_by_name.assert_called_once_with(service, args.id) mock_print_dict.assert_called_once_with(self.segment_vals) + @mock.patch.object(utils, 'get_uuid_by_name') + @mock.patch.object(_proxy.Proxy, 'delete_segment') + def test_do_segment_delete_with_non_existing_uuid( + self, mock_get_uuid_by_name, mock_delete_segment): + mock_get_uuid_by_name.return_value = self.segment_vals.get('uuid') + + expected_msg = _("No failover segment with " + "id (%s)") % mock_get_uuid_by_name + + def fake_delete_segment(self, mock_get_uuid_by_name, + ignore_missing=False): + if not ignore_missing: + raise sdk_exc.ResourceNotFound(expected_msg) + + mock_delete_segment.side_effect = fake_delete_segment + service = mock.Mock() + args = mock.Mock() + + original = sys.stdout + sys.stdout = six.StringIO() + ms.do_segment_delete(service, args) + output = sys.stdout.getvalue() + sys.stdout = original + self.assertIn(expected_msg, output) + @mock.patch.object(utils, 'print_list') @mock.patch.object(utils, 'get_uuid_by_name') def test_do_host_list(self, mock_get_uuid_by_name, mock_print_list): @@ -309,3 +341,30 @@ mock_get_uuid_by_name.assert_any_call( service, args.id, segment=self.segment_vals.get('uuid')) mock_print_dict.assert_called_once_with(self.hosts_vals) + + @mock.patch.object(utils, 'get_uuid_by_name') + @mock.patch.object(_proxy.Proxy, 'delete_host') + def test_do_host_delete_with_non_existing_uuid(self, + mock_get_uuid_by_name, + mock_delete_host): + mock_get_uuid_by_name.return_value = self.segment_vals.get('uuid') + host_id = self.hosts_vals.get('uuid') + expected_msg = _("Host '%(host_id)s' under failover_segment " "'" + "%(seg_id)s' ""could not be found") % { + 'host_id': host_id, 'seg_id': mock_get_uuid_by_name} + + def fake_delete_host( + host_id, mock_get_uuid_by_name, ignore_missing=False): + if not ignore_missing: + raise sdk_exc.ResourceNotFound(expected_msg) + + mock_delete_host.side_effect = fake_delete_host + service = mock.Mock() + args = mock.Mock() + + original = sys.stdout + sys.stdout = six.StringIO() + ms.do_host_delete(service, args) + output = sys.stdout.getvalue() + sys.stdout = original + self.assertIn(expected_msg, output) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/masakariclient/v1/client.py new/python-masakariclient-5.4.0/masakariclient/v1/client.py --- old/python-masakariclient-5.2.0/masakariclient/v1/client.py 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/masakariclient/v1/client.py 2019-03-08 13:54:22.000000000 +0100 @@ -20,15 +20,21 @@ class Client(object): def __init__(self, **kwargs): + session = kwargs.get('session') + if session is None: + auth = ks_password.Password( + auth_url=kwargs.get('auth_url'), + username=kwargs.get('username'), + password=kwargs.get('password'), + user_domain_id=kwargs.get('user_domain_id'), + project_name=kwargs.get('project_name'), + project_domain_id=kwargs.get('project_domain_id')) - auth = ks_password.Password( - auth_url=kwargs.get('auth_url'), - username=kwargs.get('username'), - password=kwargs.get('password'), - user_domain_id=kwargs.get('user_domain_id'), - project_name=kwargs.get('project_name'), - project_domain_id=kwargs.get('project_domain_id')) - session = ks_session.Session(auth=auth) + session = ks_session.Session(auth=auth) - self.con = connection.Connection(session=session) - self.service = self.con.instance_ha + con = connection.Connection( + session=session, + interface=kwargs.get('interface'), + region_name=kwargs.get('region_name'), + ha_api_version=kwargs.get('api_version')) + self.service = con.instance_ha diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/masakariclient/v1/shell.py new/python-masakariclient-5.4.0/masakariclient/v1/shell.py --- old/python-masakariclient-5.2.0/masakariclient/v1/shell.py 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/masakariclient/v1/shell.py 2019-03-08 13:54:22.000000000 +0100 @@ -163,7 +163,7 @@ try: segment_id = utils.get_uuid_by_name( service, args.id) - segment = service.delete_segment(segment_id, ignore_missing=True) + segment = service.delete_segment(segment_id, ignore_missing=False) utils.print_dict(segment.to_dict()) except Exception as e: print(e) @@ -285,8 +285,8 @@ service, args.segment_id) host_id = utils.get_uuid_by_name( service, args.id, segment=segment_id) - host = service.delete_host(host_id, segment_id=segment_id) - if host: - utils.print_dict(host.to_dict()) + host = service.delete_host(host_id, segment_id=segment_id, + ignore_missing=False) + utils.print_dict(host.to_dict()) except Exception as e: print(e) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/python_masakariclient.egg-info/PKG-INFO new/python-masakariclient-5.4.0/python_masakariclient.egg-info/PKG-INFO --- old/python-masakariclient-5.2.0/python_masakariclient.egg-info/PKG-INFO 2018-07-26 16:10:35.000000000 +0200 +++ new/python-masakariclient-5.4.0/python_masakariclient.egg-info/PKG-INFO 2019-03-08 13:56:32.000000000 +0100 @@ -1,10 +1,10 @@ Metadata-Version: 1.1 Name: python-masakariclient -Version: 5.2.0 +Version: 5.4.0 Summary: masakariclient module and a CLI tool for masakari Home-page: http://www.openstack.org/ Author: OpenStack -Author-email: openstack-dev@lists.openstack.org +Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: =============================== python-masakariclient @@ -38,3 +38,4 @@ Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/python_masakariclient.egg-info/SOURCES.txt new/python-masakariclient-5.4.0/python_masakariclient.egg-info/SOURCES.txt --- old/python-masakariclient-5.2.0/python_masakariclient.egg-info/SOURCES.txt 2018-07-26 16:10:36.000000000 +0200 +++ new/python-masakariclient-5.4.0/python_masakariclient.egg-info/SOURCES.txt 2019-03-08 13:56:32.000000000 +0100 @@ -22,6 +22,7 @@ doc/source/readme.rst doc/source/usage.rst masakariclient/__init__.py +masakariclient/api_versions.py masakariclient/cliargs.py masakariclient/client.py masakariclient/plugin.py @@ -44,6 +45,7 @@ masakariclient/tests/unit/osc/__init__.py masakariclient/tests/unit/osc/v1/__init__.py masakariclient/tests/unit/osc/v1/test_host.py +masakariclient/tests/unit/osc/v1/test_notification.py masakariclient/tests/unit/osc/v1/test_segment.py masakariclient/tests/unit/v1/__init__.py masakariclient/tests/unit/v1/fakes.py @@ -61,8 +63,12 @@ python_masakariclient.egg-info/requires.txt python_masakariclient.egg-info/top_level.txt releasenotes/notes/.placeholder +releasenotes/notes/add-version-support-for-progress-details-recovery-workflows-06614c76d44e64ff.yaml +releasenotes/notes/bug-1764931-889d9fe4cfb80b01.yaml +releasenotes/notes/deprecate-cli-9ffee25a5c3d1b3b.yaml releasenotes/source/conf.py releasenotes/source/index.rst +releasenotes/source/rocky.rst releasenotes/source/unreleased.rst releasenotes/source/_static/.placeholder releasenotes/source/_templates/.placeholder \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/python_masakariclient.egg-info/pbr.json new/python-masakariclient-5.4.0/python_masakariclient.egg-info/pbr.json --- old/python-masakariclient-5.2.0/python_masakariclient.egg-info/pbr.json 2018-07-26 16:10:35.000000000 +0200 +++ new/python-masakariclient-5.4.0/python_masakariclient.egg-info/pbr.json 2019-03-08 13:56:32.000000000 +0100 @@ -1 +1 @@ -{"git_version": "319bfb3", "is_release": true} \ No newline at end of file +{"git_version": "96613b9", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/releasenotes/notes/add-version-support-for-progress-details-recovery-workflows-06614c76d44e64ff.yaml new/python-masakariclient-5.4.0/releasenotes/notes/add-version-support-for-progress-details-recovery-workflows-06614c76d44e64ff.yaml --- old/python-masakariclient-5.2.0/releasenotes/notes/add-version-support-for-progress-details-recovery-workflows-06614c76d44e64ff.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/python-masakariclient-5.4.0/releasenotes/notes/add-version-support-for-progress-details-recovery-workflows-06614c76d44e64ff.yaml 2019-03-08 13:54:27.000000000 +0100 @@ -0,0 +1,7 @@ +--- +features: + - | + The 1.1 microversion is now supported. This introduces the following changes: + + * User can get the `progress_details` of the notification in microversion 1.1. The default version + is set to 1.1 if not provided. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/releasenotes/notes/bug-1764931-889d9fe4cfb80b01.yaml new/python-masakariclient-5.4.0/releasenotes/notes/bug-1764931-889d9fe4cfb80b01.yaml --- old/python-masakariclient-5.2.0/releasenotes/notes/bug-1764931-889d9fe4cfb80b01.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/python-masakariclient-5.4.0/releasenotes/notes/bug-1764931-889d9fe4cfb80b01.yaml 2019-03-08 13:54:22.000000000 +0100 @@ -0,0 +1,10 @@ +--- +features: + - | + Added ``--os-region-name`` and ``--os-interface`` options to select which + endpoint it should use to connect to the masakari service. + If masakari services are running in multiple regions of your cloud, + you can specify `--os-region-name` in order to get OpenStack service + client for the specified region. By default, keystoneauth always selects + `public` interface endpoint from the service catalog. Now you can also + specify `admin` or `internal` in the --os-interface option. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/releasenotes/notes/deprecate-cli-9ffee25a5c3d1b3b.yaml new/python-masakariclient-5.4.0/releasenotes/notes/deprecate-cli-9ffee25a5c3d1b3b.yaml --- old/python-masakariclient-5.2.0/releasenotes/notes/deprecate-cli-9ffee25a5c3d1b3b.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/python-masakariclient-5.4.0/releasenotes/notes/deprecate-cli-9ffee25a5c3d1b3b.yaml 2019-03-08 13:54:22.000000000 +0100 @@ -0,0 +1,6 @@ +--- +deprecations: + - | + The masakari CLI is now deprecated. This is the signal that it is + time to start using the openstack CLI. No new features will be + added to the masakari CLI. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/releasenotes/notes/reno.cache new/python-masakariclient-5.4.0/releasenotes/notes/reno.cache --- old/python-masakariclient-5.2.0/releasenotes/notes/reno.cache 2018-07-26 16:10:36.000000000 +0200 +++ new/python-masakariclient-5.4.0/releasenotes/notes/reno.cache 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ ---- -file-contents: {} -notes: [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/releasenotes/source/conf.py new/python-masakariclient-5.4.0/releasenotes/source/conf.py --- old/python-masakariclient-5.2.0/releasenotes/source/conf.py 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/releasenotes/source/conf.py 2019-03-08 13:54:22.000000000 +0100 @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Glance Release Notes documentation build configuration file, created by +# Masakari Release Notes documentation build configuration file, created by # sphinx-quickstart on Tue Nov 3 17:40:50 2015. # # This file is execfile()d with the current directory set to its @@ -55,7 +55,7 @@ master_doc = 'index' # General information about the project. -project = u'masakariclient Release Notes' +project = u'PythonMasakariClient Release Notes' copyright = u'2016, OpenStack Foundation' # The version info for the project you're documenting, acts as replacement for @@ -189,7 +189,7 @@ # html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'GlanceReleaseNotesdoc' +htmlhelp_basename = 'MasakariClientReleaseNotesdoc' # -- Options for LaTeX output --------------------------------------------- @@ -209,8 +209,9 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'GlanceReleaseNotes.tex', u'Glance Release Notes Documentation', - u'Glance Developers', 'manual'), + ('index', 'MasakariClientReleaseNotes.tex', + u'MasakariClient Release Notes Documentation', + u'MasakariClient Developers', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -239,8 +240,9 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'glancereleasenotes', u'Glance Release Notes Documentation', - [u'Glance Developers'], 1) + ('index', 'MasakariClientreleasenotes', + u'MasakariClient Release Notes Documentation', + [u'MasakariClient Developers'], 1) ] # If true, show URL addresses after external links. @@ -253,12 +255,11 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'GlanceReleaseNotes', u'Glance Release Notes Documentation', - u'Glance Developers', 'GlanceReleaseNotes', - 'One line description of project.', - 'Miscellaneous'), + ('index', 'PythonMasakariClient', + u'PythonMasakariClient Release Notes Documentation', + u'Masakari developers', 'PythonMasakariClient', + 'One line description of project.', 'Miscellaneous') ] - # Documents to append as an appendix to all manuals. # texinfo_appendices = [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/releasenotes/source/index.rst new/python-masakariclient-5.4.0/releasenotes/source/index.rst --- old/python-masakariclient-5.2.0/releasenotes/source/index.rst 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/releasenotes/source/index.rst 2019-03-08 13:54:22.000000000 +0100 @@ -6,3 +6,4 @@ :maxdepth: 1 unreleased + rocky diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/releasenotes/source/rocky.rst new/python-masakariclient-5.4.0/releasenotes/source/rocky.rst --- old/python-masakariclient-5.2.0/releasenotes/source/rocky.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/python-masakariclient-5.4.0/releasenotes/source/rocky.rst 2019-03-08 13:54:22.000000000 +0100 @@ -0,0 +1,6 @@ +=================================== + Rocky Series Release Notes +=================================== + +.. release-notes:: + :branch: stable/rocky diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/setup.cfg new/python-masakariclient-5.4.0/setup.cfg --- old/python-masakariclient-5.2.0/setup.cfg 2018-07-26 16:10:36.000000000 +0200 +++ new/python-masakariclient-5.4.0/setup.cfg 2019-03-08 13:56:32.000000000 +0100 @@ -4,7 +4,7 @@ description-file = README.rst author = OpenStack -author-email = openstack-dev@lists.openstack.org +author-email = openstack-discuss@lists.openstack.org home-page = http://www.openstack.org/ classifier = Environment :: OpenStack @@ -17,6 +17,7 @@ Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 [files] packages = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-masakariclient-5.2.0/tox.ini new/python-masakariclient-5.4.0/tox.ini --- old/python-masakariclient-5.2.0/tox.ini 2018-07-26 16:06:13.000000000 +0200 +++ new/python-masakariclient-5.4.0/tox.ini 2019-03-08 13:54:22.000000000 +0100 @@ -1,6 +1,6 @@ [tox] minversion = 2.0 -envlist = py35,py27,pypy,pep8 +envlist = pep8,py27,py35,py36 skipsdist = True [testenv] @@ -32,6 +32,12 @@ commands = {[testenv]commands} ostestr '{posargs}' + +[testenv:py36] +basepython = python3.6 +commands = + {[testenv]commands} + ostestr '{posargs}' [testenv:pep8] basepython = python3
participants (1)
-
root