puppet-swift/lib/puppet/provider/ring_object_device/swift_ring_builder.rb
Adam Vinsh 63688a14e5 Add support for swift storage policies
This change implements storage policies as defined by swift:
http://docs.openstack.org/developer/swift/overview_policies.html

There are two primary areas of change in this review
- Add storage policy support to the ringbuilder and ring devices, along with
  associated spec tests.
- Adding storage policy support and enforcing rules in swift.conf using the
  swift_storage_policy type and provider. Also: updated spec tests and an
  update to swift acceptance test to use storage policies to configure an
  additional 3 replica based ring.

See release notes and the README update for more details/instructions.

Change-Id: I2b8db751790704df3f1027a14f61e231591537f3
2016-11-22 16:17:52 +00:00

27 lines
607 B
Ruby

require File.join(File.dirname(__FILE__), '..', 'swift_ring_builder')
Puppet::Type.type(:ring_object_device).provide(
:swift_ring_builder,
:parent => Puppet::Provider::SwiftRingBuilder
) do
optional_commands :swift_ring_builder => 'swift-ring-builder'
def prefetch(resource)
@my_ring = lookup_ring
end
def ring
@my_ring ||= lookup_ring
end
def self.builder_file_path(policy_index)
if policy_index.nil?
'/etc/swift/object.builder'
elsif policy_index == 0
'/etc/swift/object.builder'
else
"/etc/swift/object-#{policy_index}.builder"
end
end
end