Puppet Class: cubbystack::glance::api

Defined in:
manifests/glance/api.pp

Overview

Class: cubbystack::glance::api

Configures the glance-api.conf file

Parameters

settings

A hash of key => value settings to go in glance-api.conf

service_enable

The status of the glance-api service Defaults to true

config_file

The path to glance-api.conf Defaults to /etc/glance/glance-api.conf

Parameters:

  • settings (Any)
  • service_enable (Any) (defaults to: true)
  • config_file (Any) (defaults to: '/etc/glance/glance-api.conf')


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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'manifests/glance/api.pp', line 18

class cubbystack::glance::api (
  $settings,
  $service_enable = true,
  $config_file    = '/etc/glance/glance-api.conf',
) {

  include ::cubbystack::params

  ## Meta settings and globals
  $tags = ['openstack', 'glance', 'glance-api']

  # Make sure Glance is installed before any configuration happens
  # Make sure Glance API is configured before the service starts
  Package['glance'] -> Cubbystack_config<| tag == 'glance-api' |>
  Cubbystack_config<| tag == 'glance-api' |> -> Service['glance-api']

  # Restart glance after any config changes
  Cubbystack_config<| tag == 'glance-api' |> ~> Service['glance-api']

  File {
    ensure  => present,
    owner   => 'glance',
    group   => 'glance',
    mode    => '0640',
    tag     => $tags,
    notify  => Service['glance-api'],
    require => Package['glance'],
  }

  ## Glance API configuration
  file { $config_file: }

  # Configure the API service
  $settings.each |$setting, $value| {
    cubbystack_config { "${config_file}: ${setting}":
      value => $value,
      tag   => $tags,
    }
  }

  ## Glance API service
  if ($service_enable) {
    $service_ensure = 'running'
  } else {
    $service_ensure = 'stopped'
  }

  service { 'glance-api':
    name       => $::cubbystack::params::glance_api_service_name,
    ensure     => $service_ensure,
    enable     => $service_enable,
    hasstatus  => true,
    hasrestart => true,
    tag        => $tags,
    provider   => $::cubbystack::params::service_provider,
    require    => Package['glance'],
  }

}