c9389516ba
Previously, the swift caches were being built on the class instances themselves. This could result in stale values when puppet runs multiple times using the same process (like in the case of puppet agent) This commit uses prefetch to ensure that the retrieved swift ring values are updated per puppet run.
24 lines
536 B
Ruby
24 lines
536 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 self.prefetch(resource)
|
|
@my_ring = lookup_ring
|
|
end
|
|
|
|
def self.ring
|
|
@my_ring ||= lookup_ring
|
|
end
|
|
|
|
# TODO maybe this should be a parameter eventually so that
|
|
# it can be configurable
|
|
def self.builder_file_path
|
|
'/etc/swift/object.builder'
|
|
end
|
|
|
|
end
|