File: create.pp

package info (click to toggle)
puppet-module-swift 21.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,084 kB
  • sloc: ruby: 9,261; python: 38; sh: 10; makefile: 10
file content (57 lines) | stat: -rw-r--r-- 1,515 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Creates a swift ring using ringbuilder.
# It creates the associated ring file as /etc/swift/${name}.builder
# It will not create a ring if the file already exists.
#
# == Parameters
#
#  [*name*] The type of ring to create. Accepts object|container|account
#  [*part_power*] Number of partitions in the ring. (specified as the power of 2)
#    Optional. Defaults to 18 (2^18)
#  [*replicas*] Number of replicas to store.
#    Optional. Defaults to 3
#  [*min_part_hours*] Time before a partition can be moved.
#    Optional. Defaults to 24.
#  [*user*] User to run as
#    Optional. Defaults to 'root'
#

# == Examples
#
#   swift::ringbuilder::create { 'account':
#     part_power     => 19,
#     replicas       => 5,
#     min_part_hours => 1,
#     user           => 'root',
#   }
#
# == Authors
#
# Pupppetlabs <info@puppetlabs.com>
#
# == Copyright
#
# Copyright 2011 Puppetlabs Inc, unless otherwise noted.
#
define swift::ringbuilder::create(
  $part_power     = 18,
  $replicas       = 3,
  $min_part_hours = 24,
  $user           = 'root'
) {

  include swift::deps

  validate_legacy(
    Pattern[/^(object(-(\d)+)?|container|account)$/], 'validate_re', $name,
    ['^(object(-(\d)+)?|container|account)$']
  )

  exec { "create_${name}":
    command => "swift-ring-builder /etc/swift/${name}.builder create ${part_power} ${replicas} ${min_part_hours}",
    path    => ['/usr/bin'],
    user    => $user,
    creates => "/etc/swift/${name}.builder",
    before  => Anchor['swift::config::end'],
  }

}