This file is indexed.

/usr/share/puppet/modules.available/glance/spec/classes/glance_keystone_glare_auth_spec.rb is in puppet-module-glance 9.4.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
require 'spec_helper'

describe 'glance::keystone::glare_auth' do

  shared_examples_for 'glance::keystone::glare_auth' do
    describe 'with defaults' do

      let :params do
        {:password => 'pass'}
      end

      it { is_expected.to contain_keystone_user('glare').with(
        :ensure   => 'present',
        :password => 'pass'
      )}

      it { is_expected.to contain_keystone_user_role('glare@services').with(
        :ensure => 'present',
        :roles  => ['admin']
      ) }

      it { is_expected.to contain_keystone_service('Glance Artifacts::artifact').with(
        :ensure      => 'present',
        :description => 'Glance Artifact Service'
      ) }

      it { is_expected.to contain_keystone_endpoint('RegionOne/Glance Artifacts::artifact').with(
        :ensure       => 'present',
        :public_url   => 'http://127.0.0.1:9494',
        :admin_url    => 'http://127.0.0.1:9494',
        :internal_url => 'http://127.0.0.1:9494'
      )}

    end

    describe 'when auth_type, password, and service_type are overridden' do

      let :params do
        {
          :auth_name    => 'glarey',
          :password     => 'password',
          :service_type => 'glarey'
        }
      end

      it { is_expected.to contain_keystone_user('glarey').with(
        :ensure   => 'present',
        :password => 'password'
      )}

      it { is_expected.to contain_keystone_user_role('glarey@services').with(
        :ensure => 'present',
        :roles  => ['admin']
      ) }

      it { is_expected.to contain_keystone_service('Glance Artifacts::glarey').with(
        :ensure      => 'present',
        :description => 'Glance Artifact Service'
      ) }

    end

    describe 'when overriding endpoint URLs' do
      let :params do
        { :password         => 'passw0rd',
          :region            => 'RegionTwo',
          :public_url       => 'https://10.10.10.10:82/v2',
          :internal_url     => 'https://10.10.10.11:82/v2',
          :admin_url        => 'https://10.10.10.12:82/v2' }
      end

      it { is_expected.to contain_keystone_endpoint('RegionTwo/Glance Artifacts::artifact').with(
        :ensure       => 'present',
        :public_url   => 'https://10.10.10.10:82/v2',
        :internal_url => 'https://10.10.10.11:82/v2',
        :admin_url    => 'https://10.10.10.12:82/v2'
      ) }
    end

    describe 'when endpoint is not set' do

      let :params do
        {
          :configure_endpoint => false,
          :password         => 'pass',
        }
      end

      it { is_expected.to_not contain_keystone_endpoint('RegionOne/Glance Artifacts::artifact') }
    end

    describe 'when disabling user configuration' do
      let :params do
        {
          :configure_user => false,
          :password       => 'pass',
        }
      end

      it { is_expected.to_not contain_keystone_user('glare') }

      it { is_expected.to contain_keystone_user_role('glare@services') }

      it { is_expected.to contain_keystone_service('Glance Artifacts::artifact').with(
        :ensure      => 'present',
        :description => 'Glance Artifact Service'
      ) }
    end

    describe 'when disabling user and user role configuration' do
      let :params do
        {
          :configure_user      => false,
          :configure_user_role => false,
          :password            => 'pass',
        }
      end

      it { is_expected.to_not contain_keystone_user('glare') }

      it { is_expected.to_not contain_keystone_user_role('glare@services') }

      it { is_expected.to contain_keystone_service('Glance Artifacts::artifact').with(
        :ensure      => 'present',
        :description => 'Glance Artifact Service'
      ) }
    end

    describe 'when configuring glance-glare and the keystone endpoint' do
      let :pre_condition do
        "class { 'glance::glare': keystone_password => 'test' }"
      end

      let :params do
        {
          :password => 'test',
          :configure_endpoint => true
        }
      end

      it { is_expected.to contain_keystone_endpoint('RegionOne/Glance Artifacts::artifact').with_notify(["Anchor[glance::service::begin]"]) }
      end

    describe 'when overriding service name' do

      let :params do
        {
          :service_name => 'glance_service',
          :password     => 'pass'
        }
      end

      it { is_expected.to contain_keystone_user('glare') }
      it { is_expected.to contain_keystone_user_role('glare@services') }
      it { is_expected.to contain_keystone_service('glance_service::artifact') }
      it { is_expected.to contain_keystone_endpoint('RegionOne/glance_service::artifact') }

    end
  end

  on_supported_os({
    :supported_os   => OSDefaults.get_supported_os
  }).each do |os,facts|
    context "on #{os}" do
      let (:facts) do
        facts.merge!(OSDefaults.get_facts())
      end

      it_configures 'glance::keystone::glare_auth'
    end
  end
end