1
0

- added 0001-add-python-3.7-unit-test-job.patch

- added 0001-baremetal-Add-support-for-mkisofs-and-xorrisofs-for-.patch

OBS-URL: https://build.opensuse.org/package/show/Cloud:OpenStack:Factory/python-openstacksdk?expand=0&rev=31
This commit is contained in:
2019-04-12 06:18:14 +00:00
committed by Git OBS Bridge
parent 86e14d868d
commit a1d8c25b4d
5 changed files with 146 additions and 3 deletions

View File

@@ -0,0 +1,47 @@
From b3723bed9dd2b336c63aa9bcf5a3e1ce08e2e290 Mon Sep 17 00:00:00 2001
From: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
Date: Mon, 25 Mar 2019 11:01:00 +0000
Subject: [PATCH] add python 3.7 unit test job
See ML discussion here [1] for context.
[1] http://lists.openstack.org/pipermail/openstack-dev/2018-October/135626.html
Change-Id: If472ec316c5f5aaee15aab4d72964f806d3efff7
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
---
.zuul.yaml | 1 +
openstack/tests/unit/test_resource.py | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/.zuul.yaml b/.zuul.yaml
index 6d0dcf81..ee9dea9f 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -396,6 +396,7 @@
- openstack-lower-constraints-jobs
- openstack-python-jobs
- openstack-python36-jobs
+ - openstack-python37-jobs
- openstacksdk-functional-tips
- openstacksdk-tox-tips
- os-client-config-tox-tips
diff --git a/openstack/tests/unit/test_resource.py b/openstack/tests/unit/test_resource.py
index ee98777f..7b44a60d 100644
--- a/openstack/tests/unit/test_resource.py
+++ b/openstack/tests/unit/test_resource.py
@@ -1901,7 +1901,10 @@ class TestResourceActions(base.TestCase):
microversion=None)
# Ensure we're done after those three items
- self.assertRaises(StopIteration, next, results)
+ # In python3.7, PEP 479 is enabled for all code, and StopIteration
+ # raised directly from code is turned into a RuntimeError.
+ # Something about how mock is implemented triggers that here.
+ self.assertRaises((StopIteration, RuntimeError), next, results)
# Ensure we only made two calls to get this done
self.assertEqual(3, len(self.session.get.call_args_list))
--
2.21.0

View File

@@ -0,0 +1,85 @@
From 8fed470b09ac7db887ebdca38b369557b0b25f10 Mon Sep 17 00:00:00 2001
From: Thomas Bechtold <tbechtold@suse.com>
Date: Tue, 9 Apr 2019 13:01:22 +0200
Subject: [PATCH] baremetal: Add support for mkisofs and xorrisofs for
configdrive
Currently, only "genisoimage" is supported. But "genisoimage" might
not be available on all distros (like openSUSE or Debian).
So add support for "mkisofs" and "xorrisofs" which luckily support
the same command line parameters as "genisoimage".
Change-Id: I720f25921f8e52f20a631f238a528dedf65a91c6
---
openstack/baremetal/configdrive.py | 37 ++++++++++++-------
...ve-mkisofs-xorrisofs-075db4d7d80e5a13.yaml | 8 ++++
2 files changed, 32 insertions(+), 13 deletions(-)
create mode 100644 releasenotes/notes/baremetal-configdrive-mkisofs-xorrisofs-075db4d7d80e5a13.yaml
diff --git a/openstack/baremetal/configdrive.py b/openstack/baremetal/configdrive.py
index abbebf5a..b43d19b3 100644
--- a/openstack/baremetal/configdrive.py
+++ b/openstack/baremetal/configdrive.py
@@ -84,21 +84,32 @@ def pack(path):
:return: configdrive contents as a base64-encoded string.
"""
with tempfile.NamedTemporaryFile() as tmpfile:
- try:
- p = subprocess.Popen(['genisoimage',
- '-o', tmpfile.name,
- '-ldots', '-allow-lowercase',
- '-allow-multidot', '-l',
- '-publisher', 'metalsmith',
- '-quiet', '-J',
- '-r', '-V', 'config-2',
- path],
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- except OSError as e:
+ # NOTE(toabctl): Luckily, genisoimage, mkisofs and xorrisofs understand
+ # the same parameters which are currently used.
+ cmds = ['genisoimage', 'mkisofs', 'xorrisofs']
+ for c in cmds:
+ try:
+ p = subprocess.Popen([c,
+ '-o', tmpfile.name,
+ '-ldots', '-allow-lowercase',
+ '-allow-multidot', '-l',
+ '-publisher', 'metalsmith',
+ '-quiet', '-J',
+ '-r', '-V', 'config-2',
+ path],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ except OSError as e:
+ error = e
+ else:
+ error = None
+ break
+
+ if error:
raise RuntimeError(
'Error generating the configdrive. Make sure the '
- '"genisoimage" tool is installed. Error: %s' % e)
+ '"genisoimage", "mkisofs" or "xorrisofs" tool is installed. '
+ 'Error: %s' % error)
stdout, stderr = p.communicate()
if p.returncode != 0:
diff --git a/releasenotes/notes/baremetal-configdrive-mkisofs-xorrisofs-075db4d7d80e5a13.yaml b/releasenotes/notes/baremetal-configdrive-mkisofs-xorrisofs-075db4d7d80e5a13.yaml
new file mode 100644
index 00000000..008459e8
--- /dev/null
+++ b/releasenotes/notes/baremetal-configdrive-mkisofs-xorrisofs-075db4d7d80e5a13.yaml
@@ -0,0 +1,8 @@
+---
+features:
+ - |
+ When generating a config drive for baremetal, "mkisofs" and "xorrisofs"
+ are now supported beside the already available "genisoimage" binary.
+ This is useful on environment where the "genisoimage" binary is not
+ available but "mkisofs" and/or "xorrisofs" are available.
+
--
2.21.0

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:afcdc7453a9fa0265a141c5731043198e961c86fe9409258425da63aaaa7b4d9
size 818981

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Apr 12 04:33:52 UTC 2019 - cloud-devel@suse.de
- added 0001-add-python-3.7-unit-test-job.patch
- added 0001-baremetal-Add-support-for-mkisofs-and-xorrisofs-for-.patch
-------------------------------------------------------------------
Wed Apr 10 06:47:44 UTC 2019 - Dirk Mueller <dmueller@suse.com>

View File

@@ -24,6 +24,10 @@ License: Apache-2.0
Group: Development/Languages/Python
URL: https://launchpad.net/openstacksdk
Source0: https://files.pythonhosted.org/packages/source/o/openstacksdk/openstacksdk-0.27.0.tar.gz
# https://review.openstack.org/#/c/651119/
Patch0: 0001-add-python-3.7-unit-test-job.patch
# https://review.openstack.org/#/c/651193/
Patch1: 0001-baremetal-Add-support-for-mkisofs-and-xorrisofs-for-.patch
BuildRequires: openstack-macros
BuildRequires: python-devel
BuildRequires: python2-PyYAML >= 3.12
@@ -155,6 +159,10 @@ rm -rf doc/build/html/.{doctrees,buildinfo}
%postun
%python_uninstall_alternative openstack-inventory
%check
export OS_LOG_CAPTURE=true
%python_exec -m stestr.cli run
%files %{python_files}
%license LICENSE
%doc ChangeLog README.rst