[openstack-puppet-modules] Added 0001-Update-deprecated-Glance-CLI.patch

Martin Mágr mmagr at fedoraproject.org
Thu Oct 2 08:40:14 UTC 2014


commit c5b93afeb0066117f7609609bc1b8c5c23361d25
Author: Martin Mágr <mmagr at redhat.com>
Date:   Thu Oct 2 10:39:37 2014 +0200

    Added 0001-Update-deprecated-Glance-CLI.patch

 0001-Update-deprecated-Glance-CLI.patch |  118 +++++++++++++++++++++++++++++++
 openstack-puppet-modules.spec           |   15 +++--
 2 files changed, 127 insertions(+), 6 deletions(-)
---
diff --git a/0001-Update-deprecated-Glance-CLI.patch b/0001-Update-deprecated-Glance-CLI.patch
new file mode 100644
index 0000000..2e30357
--- /dev/null
+++ b/0001-Update-deprecated-Glance-CLI.patch
@@ -0,0 +1,118 @@
+From f377c0229c006b02f43a14be4979553e983cb98e Mon Sep 17 00:00:00 2001
+From: Emilien Macchi <emilien.macchi at enovance.com>
+Date: Wed, 1 Oct 2014 11:44:21 -0400
+Subject: [PATCH] Update deprecated Glance CLI
+
+Since this patch has been merged in python-glanceclient 0.14.1:
+https://github.com/openstack/python-glanceclient/commit/1dfce5301c5d7cd456c98629a007917120637c8a
+
+We have to update the way to call Glance Client.
+This patch updates for glance image-list, image-show and the way to get
+a token, and also the way the glance command output is parsed.
+
+Change-Id: If3e1e42b1245dd064fa00e07037535afc9caa04c
+---
+ lib/puppet/provider/glance.rb              | 16 ++++++++--------
+ lib/puppet/provider/glance_image/glance.rb |  6 +++---
+ spec/unit/provider/glance_spec.rb          |  8 ++++----
+ 3 files changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/lib/puppet/provider/glance.rb b/lib/puppet/provider/glance.rb
+index d3791b6..d0a7bb6 100644
+--- a/lib/puppet/provider/glance.rb
++++ b/lib/puppet/provider/glance.rb
+@@ -72,11 +72,11 @@ class Puppet::Provider::Glance < Puppet::Provider
+   def self.auth_glance(*args)
+     begin
+       g = glance_credentials
+-      remove_warnings(glance('-T', g['admin_tenant_name'], '-I', g['admin_user'], '-K', g['admin_password'], '-N', auth_endpoint, args))
++      remove_warnings(glance('--os-tenant-name', g['admin_tenant_name'], '--os-username', g['admin_user'], '--os-password', g['admin_password'], '--os-auth-url', auth_endpoint, args))
+     rescue Exception => e
+       if (e.message =~ /\[Errno 111\] Connection refused/) or (e.message =~ /\(HTTP 400\)/) or (e.message =~ /HTTP Unable to establish connection/)
+         sleep 10
+-        remove_warnings(glance('-T', g['admin_tenant_name'], '-I', g['admin_user'], '-K', g['admin_password'], '-N', auth_endpoint, args))
++        remove_warnings(glance('--os-tenant-name', g['admin_tenant_name'], '--os-username', g['admin_user'], '--os-password', g['admin_password'], '--os-auth-url', auth_endpoint, args))
+       else
+         raise(e)
+       end
+@@ -90,7 +90,7 @@ class Puppet::Provider::Glance < Puppet::Provider
+   def self.auth_glance_stdin(*args)
+     begin
+       g = glance_credentials
+-      command = "glance -T #{g['admin_tenant_name']} -I #{g['admin_user']} -K #{g['admin_password']} -N #{auth_endpoint} #{args.join(' ')}"
++      command = "glance --os-tenant-name #{g['admin_tenant_name']} --os-username #{g['admin_user']} --os-password #{g['admin_password']} --os-auth-url #{auth_endpoint} #{args.join(' ')}"
+ 
+       # This is a horrible, horrible hack
+       # Redirect stderr to stdout in order to report errors
+@@ -109,14 +109,14 @@ class Puppet::Provider::Glance < Puppet::Provider
+   private
+     def self.list_glance_images
+       ids = []
+-      (auth_glance('index').split("\n")[2..-1] || []).collect do |line|
+-        ids << line.split[0]
++      (auth_glance('image-list').split("\n")[3..-2] || []).collect do |line|
++        ids << line.split('|')[1].strip()
+       end
+       return ids
+     end
+ 
+     def self.get_glance_image_attr(id, attr)
+-      (auth_glance('show', id).split("\n") || []).collect do |line|
++      (auth_glance('image-show', id).split("\n") || []).collect do |line|
+         if line =~ /^#{attr}:/
+           return line.split(': ')[1..-1]
+         end
+@@ -125,8 +125,8 @@ class Puppet::Provider::Glance < Puppet::Provider
+ 
+     def self.get_glance_image_attrs(id)
+       attrs = {}
+-      (auth_glance('show', id).split("\n") || []).collect do |line|
+-        attrs[line.split(': ').first.downcase] = line.split(': ')[1..-1].pop
++      (auth_glance('image-show', id).split("\n")[3..-2] || []).collect do |line|
++        attrs[line.split('|')[1].strip()] = line.split('|')[2].strip()
+       end
+       return attrs
+     end
+diff --git a/lib/puppet/provider/glance_image/glance.rb b/lib/puppet/provider/glance_image/glance.rb
+index 53ebd61..ab9d27b 100644
+--- a/lib/puppet/provider/glance_image/glance.rb
++++ b/lib/puppet/provider/glance_image/glance.rb
+@@ -21,10 +21,10 @@ Puppet::Type.type(:glance_image).provide(
+       new(
+         :ensure           => :present,
+         :name             => attrs['name'],
+-        :is_public        => attrs['public'],
+-        :container_format => attrs['container format'],
++        :is_public        => attrs['is_public'],
++        :container_format => attrs['container_format'],
+         :id               => attrs['id'],
+-        :disk_format      => attrs['disk format']
++        :disk_format      => attrs['disk_format']
+       )
+     end
+   end
+diff --git a/spec/unit/provider/glance_spec.rb b/spec/unit/provider/glance_spec.rb
+index 0834ce0..315b0b3 100644
+--- a/spec/unit/provider/glance_spec.rb
++++ b/spec/unit/provider/glance_spec.rb
+@@ -41,13 +41,13 @@ describe Puppet::Provider::Glance do
+           mock.expects(:read).with('/etc/glance/glance-api.conf')
+           klass.expects(:sleep).with(10).returns(nil)
+           klass.expects(:glance).twice.with(
+-            '-T',
++            '--os-tenant-name',
+             'foo',
+-            '-I',
++            '--os-username',
+             'user',
+-            '-K',
++            '--os-password',
+             'pass',
+-            '-N',
++            '--os-auth-url',
+             'http://127.0.0.1:35357/v2.0/',
+             ['test_retries']
+           ).raises(Exception, valid_message).then.returns('')
+-- 
+1.9.3
+
diff --git a/openstack-puppet-modules.spec b/openstack-puppet-modules.spec
index 5e8c4ee..362d8f7 100644
--- a/openstack-puppet-modules.spec
+++ b/openstack-puppet-modules.spec
@@ -43,7 +43,7 @@
 
 Name:           openstack-puppet-modules
 Version:        2014.2
-Release:        0.3%{?dist}
+Release:        0.3.1%{?dist}
 Summary:        Puppet modules used to deploy OpenStack
 License:        ASL 2.0 and GPLv2 and GPLv3
 
@@ -112,6 +112,7 @@ Patch121:   manage_service-keystone.patch
 Patch122:   manage_service-swift.patch
 Patch123:   manage_service-glance.patch
 Patch124:   manage_service-neutron.patch
+Patch125:   0001-Update-deprecated-Glance-CLI.patch
 
 
 BuildArch:      noarch
@@ -138,7 +139,7 @@ A collection of Puppet modules used to install and configure OpenStack.
 %setup -c -q -T -D -a 13
 %setup -c -q -T -D -a 14
 %setup -c -q -T -D -a 15
-#%setup -c -q -T -D -a 16
+%setup -c -q -T -D -a 16
 %setup -c -q -T -D -a 17
 %setup -c -q -T -D -a 18
 %setup -c -q -T -D -a 19
@@ -219,7 +220,7 @@ cd %{_builddir}/%{name}-%{version}/puppet-swift-%{swift_commit}
 # puppet-glance patches
 cd %{_builddir}/%{name}-%{version}/puppet-glance-%{glance_commit}
 %patch123 -p1
-
+%patch125 -p1
 
 find %{_builddir}/%{name}-%{version}/ -type f -name ".*" -exec rm {} +
 find %{_builddir}/%{name}-%{version}/ -size 0 -exec rm {} +
@@ -250,7 +251,7 @@ cp -r puppet-horizon-%{horizon_commit} %{buildroot}/%{_datadir}/openstack-puppet
 cp -r puppetlabs-inifile-%{inifile_commit} %{buildroot}/%{_datadir}/openstack-puppet/modules/inifile
 cp -r puppet-keystone-%{keystone_commit} %{buildroot}/%{_datadir}/openstack-puppet/modules/keystone
 cp -r puppet-memcached-%{memcached_commit} %{buildroot}/%{_datadir}/openstack-puppet/modules/memcached
-#cp -r puppet-module-data-%{module_data_commit} %{buildroot}/%{_datadir}/openstack-puppet/modules/module-data
+cp -r puppet-module-data-%{module_data_commit} %{buildroot}/%{_datadir}/openstack-puppet/modules/module-data
 cp -r puppetlabs-mongodb-%{mongodb_commit} %{buildroot}/%{_datadir}/openstack-puppet/modules/mongodb
 cp -r puppetlabs-mysql-%{mysql_commit} %{buildroot}/%{_datadir}/openstack-puppet/modules/mysql
 cp -r puppet-nagios-openstack-%{nagios_commit} %{buildroot}/%{_datadir}/openstack-puppet/modules/nagios
@@ -283,6 +284,8 @@ rm -f %{buildroot}/%{_datadir}/openstack-puppet/modules/nova/files/nova-novncpro
 
 
 %changelog
+* Thu Oct 2 2014 Martin Mágr <mmagr at redhat.com> - 2014.2-0.3.1
+- Added 0001-Update-deprecated-Glance-CLI.patch (rhbz#1148346)
 
 * Wed Sep 10 2014 Lukas Bezdicka <lbezdick at redhat.com> - 2014.2-0.3
 - fixed o-p-m master module versions
@@ -314,7 +317,7 @@ rm -f %{buildroot}/%{_datadir}/openstack-puppet/modules/nova/files/nova-novncpro
 * Mon Aug 18 2014 Iván Chavero <ichavero at redhat.com> - 2014.1-20
 - Updated 0001-Refacfored-a-more-suitable-ovs_redhat-provider.patch to patchset 17 (rhbz#1130657)
 - Bump Pacemaker to the latest version (rhbz#1120584)
-- Add 0001-Fixes-plugin.ini-error.patch (rhbz#1114739) 
+- Add 0001-Fixes-plugin.ini-error.patch (rhbz#1114739)
 
 * Wed Jul 30 2014 Iván Chavero <icahvero at redhat.com> - 2014.1-19.3
 - Fixed sources upload
@@ -327,7 +330,7 @@ rm -f %{buildroot}/%{_datadir}/openstack-puppet/modules/nova/files/nova-novncpro
 
 * Wed Jul 30 2014 Iván Chavero <icahvero at redhat.com> - 2014.1-19
 - Bump to the latest stable puppet modules
-- Removed puppetlabs-firewall-pull-request-367.patch 
+- Removed puppetlabs-firewall-pull-request-367.patch
 - Add puppetlabs-firewall-pull-request-367-2.patch
 - Removed 0002-Refacfored-a-more-suitable-ovs_redhat-provider.patch
 - Removed 0003-Fixes-bridge-addition-error-if-interface-has-no-IP.patch


More information about the scm-commits mailing list