update keystone and openstacklib puppet for Train

puppet-keystone and puppet-openstacklib need to be updated
because of the Train upgrade, to avoid ansible failure. The puppet
packages are not fully upgraded because the new versions request
an upgrade for Puppet 5.

keystone: 0007-update-for-openstackclient-Train-upgrade
 - Remove deprecated role list options --project and --user. Use role
   assignment list options --project and --user instead.
 - Ported from puppet-keystone v15.4.0.

openstacklib: 0002-update-for-openstackclient-Train
 - Add endpoint parameter for Puppet::Provider::Openstack::Credentials,
   ported from puppet-openstacklib v15.4.0.

Ref:
https://docs.openstack.org/releasenotes/python-openstackclient/train.html
https://docs.openstack.org/releasenotes/puppet-keystone/train.html
https://docs.openstack.org/releasenotes/puppet-openstacklib/train.html

Tests have been done:
1. Deploy StarlingX with simplex/duplex/multi-node with or without
   dedicated storage nodes.
2. Apply latest openstack application based on the above deployments.
3. Add node with BMC.
4. Openstack client tests:
   Create flavor, image, volume, network, subnet and instances.
   Instance Operations:
      Pause/Unpause; Suspend/Resume; Stop/Start;
      Reboot (soft); Reboot (hard)

Story: 2007502
Task: 39266

Depends-on: https://review.opendev.org/#/c/716818
Change-Id: I21c0fa2aaa41bae6d0d309763c84afb9e2e5ded9
Signed-off-by: Chen, Yan <yan.chen@intel.com>
This commit is contained in:
Chen, Yan 2020-03-27 05:19:00 +00:00 committed by Yan Chen
parent 045ba2a0e2
commit 05601cbc40
6 changed files with 189 additions and 0 deletions

View File

@ -0,0 +1,33 @@
From 37836a4a1ce5548f39a23f5686f6f7c12bef3504 Mon Sep 17 00:00:00 2001
From: chenyan <yan.chen@intel.com>
Date: Thu, 26 Mar 2020 14:17:54 +0800
Subject: [PATCH] update for openstackclient Train upgrade
Signed-off-by: chenyan <yan.chen@intel.com>
---
SPECS/puppet-keystone.spec | 2 ++
1 file changed, 2 insertions(+)
diff --git a/SPECS/puppet-keystone.spec b/SPECS/puppet-keystone.spec
index ae233f0..2e6ede3 100644
--- a/SPECS/puppet-keystone.spec
+++ b/SPECS/puppet-keystone.spec
@@ -16,6 +16,7 @@ Patch0003: 0003-remove-eventlet_bindhost-from-Keystoneconf.patch
Patch0004: 0004-escape-special-characters-in-bootstrap.patch
Patch0005: 0005-Add-support-for-fernet-receipts.patch
Patch0006: 0006-update-Barbican-admin-secret-s-user-project-IDs-duri.patch
+Patch0007: 0007-update-for-openstackclient-Train-upgrade.patch
BuildArch: noarch
@@ -39,6 +40,7 @@ Puppet module for OpenStack Keystone
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
+%patch0007 -p1
find . -type f -name ".*" -exec rm {} +
find . -size 0 -exec rm {} +
--
2.17.1

View File

@ -5,3 +5,4 @@
0005-escape-special-characters-in-bootstrap.patch
0006-Add-support-for-fernet-receipts.patch
0007-update-Barbican-admin-secret-s-user-project-IDs.patch
0008-update-for-openstackclient-Train-upgrade.patch

View File

@ -0,0 +1,86 @@
From 77f06068cdad5a6a20635731a9d2df7e0cdca175 Mon Sep 17 00:00:00 2001
From: chenyan <yan.chen@intel.com>
Date: Fri, 27 Mar 2020 10:41:38 +0800
Subject: [PATCH] update for openstackclient Train upgrade
Signed-off-by: chenyan <yan.chen@intel.com>
---
lib/puppet/provider/keystone.rb | 10 +++++++---
lib/puppet/provider/keystone_role/openstack.rb | 4 ++--
lib/puppet/provider/keystone_user_role/openstack.rb | 4 ++--
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/lib/puppet/provider/keystone.rb b/lib/puppet/provider/keystone.rb
index 2c0b749..630692e 100644
--- a/lib/puppet/provider/keystone.rb
+++ b/lib/puppet/provider/keystone.rb
@@ -213,7 +213,10 @@ class Puppet::Provider::Keystone < Puppet::Provider::Openstack
def self.get_service_url
service_url = nil
- if ENV['OS_URL']
+ if ENV['OS_ENDPOINT']
+ service_url = ENV['OS_ENDPOINT'].dup
+ # Compatibility with pre-4.0.0 openstackclient
+ elsif ENV['OS_URL']
service_url = ENV['OS_URL'].dup
elsif admin_endpoint
service_url = admin_endpoint
@@ -319,8 +322,9 @@ class Puppet::Provider::Keystone < Puppet::Provider::Openstack
def self.request_by_service_token(service, action, error, properties=nil, options={})
properties ||= []
- @credentials.token = admin_token
- @credentials.url = service_url
+ @credentials.token = admin_token
+ @credentials.endpoint = service_url
+ @credentials.url = service_url
raise error unless @credentials.service_token_set?
Puppet::Provider::Openstack.request(service, action, properties, @credentials, options)
end
diff --git a/lib/puppet/provider/keystone_role/openstack.rb b/lib/puppet/provider/keystone_role/openstack.rb
index 60e3496..b8f3fa0 100644
--- a/lib/puppet/provider/keystone_role/openstack.rb
+++ b/lib/puppet/provider/keystone_role/openstack.rb
@@ -51,7 +51,7 @@ Puppet::Type.type(:keystone_role).provide(
list = request('role', 'list')
reallist = list.collect do |role|
new(
- :name => role[:name],
+ :name => role[:name].downcase,
:ensure => :present,
:id => role[:id]
)
@@ -63,7 +63,7 @@ Puppet::Type.type(:keystone_role).provide(
def self.prefetch(resources)
roles = instances
resources.keys.each do |name|
- if provider = roles.find{ |role| role.name == name }
+ if provider = roles.find{ |role| role.name == name.downcase }
resources[name].provider = provider
end
end
diff --git a/lib/puppet/provider/keystone_user_role/openstack.rb b/lib/puppet/provider/keystone_user_role/openstack.rb
index eee0768..b51c84e 100644
--- a/lib/puppet/provider/keystone_user_role/openstack.rb
+++ b/lib/puppet/provider/keystone_user_role/openstack.rb
@@ -45,14 +45,14 @@ Puppet::Type.type(:keystone_user_role).provide(
end
def exists?
- roles_db = self.class.request('role', 'list', properties)
+ roles_db = self.class.request('role assignment', 'list', ['--names'] + properties)
@property_hash[:name] = resource[:name]
if roles_db.empty?
@property_hash[:ensure] = :absent
else
@property_hash[:ensure] = :present
@property_hash[:roles] = roles_db.collect do |role|
- role[:name]
+ role[:role]
end
end
return @property_hash[:ensure] == :present
--
2.17.1

View File

@ -0,0 +1,33 @@
From d977fad6b6844de7a22ab62e7456f27c95a56a64 Mon Sep 17 00:00:00 2001
From: chenyan <yan.chen@intel.com>
Date: Thu, 26 Mar 2020 16:17:19 +0800
Subject: [PATCH] update for openstackclient Train
Signed-off-by: chenyan <yan.chen@intel.com>
---
SPECS/puppet-openstacklib.spec | 2 ++
1 file changed, 2 insertions(+)
diff --git a/SPECS/puppet-openstacklib.spec b/SPECS/puppet-openstacklib.spec
index ce3957f..9f42722 100644
--- a/SPECS/puppet-openstacklib.spec
+++ b/SPECS/puppet-openstacklib.spec
@@ -9,6 +9,7 @@ URL: https://launchpad.net/puppet-openstacklib
Source0: https://tarballs.openstack.org/%{name}/%{name}-%{upstream_version}.tar.gz
Patch0001: 0001-Roll-up-TIS-patches.patch
+Patch0002: 0002-update-for-openstackclient-Train.patch
BuildArch: noarch
@@ -26,6 +27,7 @@ Puppet OpenStack Libraries
%prep
%setup -q -n openstack-openstacklib-%{upstream_version}
%patch0001 -p1
+%patch0002 -p1
find . -type f -name ".*" -exec rm {} +
find . -size 0 -exec rm {} +
--
2.17.1

View File

@ -1,2 +1,3 @@
0001-Update-package-versioning-for-TIS-format.patch
0002-Add-TIS-patch.patch
0003-update-for-openstackclient-Train.patch

View File

@ -0,0 +1,35 @@
From f3769af45374b58ec9698a73676cbe088c112ac1 Mon Sep 17 00:00:00 2001
From: chenyan <yan.chen@intel.com>
Date: Fri, 27 Mar 2020 10:48:23 +0800
Subject: [PATCH] update for openstackclient Train
Signed-off-by: chenyan <yan.chen@intel.com>
---
lib/puppet/provider/openstack/credentials.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/puppet/provider/openstack/credentials.rb b/lib/puppet/provider/openstack/credentials.rb
index 9c831e3..f43da5b 100644
--- a/lib/puppet/provider/openstack/credentials.rb
+++ b/lib/puppet/provider/openstack/credentials.rb
@@ -5,7 +5,7 @@ class Puppet::Provider::Openstack::Credentials
KEYS = [
:auth_url, :password, :project_name, :username,
- :token, :url,
+ :token, :endpoint, :url,
:identity_api_version,
:region_name,
:interface
@@ -28,7 +28,7 @@ class Puppet::Provider::Openstack::Credentials
end
def service_token_set?
- return true if @token && @url
+ return true if (@token && @endpoint) || (@token && @url)
end
def to_env
--
2.17.1