Bugfix ring_script.rb to parse recent ring-builder

This bugfix allows the ring_script.rb to parse output from
the havana versions (swift 1.10) of swift-ring-builder
successfully.

Change-Id: I98ed30837226c28fb90910c1ae117506dfe14f8c
Fixes-Bug: #1266922
This commit is contained in:
Alan Meadows
2014-01-07 12:54:07 -08:00
parent 66205b9c92
commit 2cb4bcdab8
3 changed files with 22 additions and 1 deletions

View File

@@ -2,6 +2,10 @@
This file is used to list changes made in each version of cookbook-openstack-object-storage.
## 8.0.1
* Bugfix ring_script.rb to handle recent swift-ring-builder
output with replication information
## 8.0.0
### New version
* Upgrade to upstream Havana release

View File

@@ -3,7 +3,7 @@ maintainer 'ATT, Inc.'
license 'Apache 2.0'
description 'Installs and configures Openstack Swift'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '8.0.0'
version '8.0.1'
recipe 'openstack-object-storage::setup', 'Does initial setup of a swift cluster'
recipe 'openstack-object-storage::account-server', 'Installs the swift account server'
recipe 'openstack-object-storage::object-server', 'Installs the swift object server'

View File

@@ -194,6 +194,23 @@ def parse_ring_output(ring_data)
next
elsif line =~ /^Devices:\s+id\s+zone\s+/
next
elsif line =~ /^\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\.\d+\.\d+\.\d+)\s+(\d+)\s+(\d+\.\d+\.\d+\.\d+)\s+(\d+)\s+(\S+)\s+([0-9.]+)\s+(\d+)\s+([-0-9.]+)\s*$/
output[:hosts] ||= {}
output[:hosts][$4] ||= {}
output[:hosts][$4][$8] ||= {}
output[:hosts][$4][$8][:id] = $1
output[:hosts][$4][$8][:region] = $2
output[:hosts][$4][$8][:zone] = $3
output[:hosts][$4][$8][:ip] = $4
output[:hosts][$4][$8][:port] = $5
output[:hosts][$4][$8][:replication_ip] = $6
output[:hosts][$4][$8][:replication_port] = $7
output[:hosts][$4][$8][:device] = $8
output[:hosts][$4][$8][:weight] = $9
output[:hosts][$4][$8][:partitions] = $10
output[:hosts][$4][$8][:balance] = $11
elsif line =~ /^\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\.\d+\.\d+\.\d+)\s+(\d+)\s+(\S+)\s+([0-9.]+)\s+(\d+)\s+([-0-9.]+)\s*$/
output[:hosts] ||= {}
output[:hosts][$4] ||= {}