File tree Expand file tree Collapse file tree 2 files changed +69
-14
lines changed Expand file tree Collapse file tree 2 files changed +69
-14
lines changed Original file line number Diff line number Diff line change 18
18
# manifest => 'dev'
19
19
# }
20
20
#
21
- define puppet::masterenv ($modulepath , $manifest , $puppet_conf = $::puppet::params::puppet_conf){
21
+ define puppet::masterenv (
22
+ $modulepath ,
23
+ $manifest ,
24
+ $puppet_conf = $::puppet::params::puppet_conf,
25
+ $environments = $::puppet::master::environments,
26
+ $environmentpath = $::puppet::master::environmentpath
27
+ ) {
28
+
29
+ case $environments {
30
+ ' directory' : {
31
+ $path = " ${environmentpath} /${name} /environment.conf"
32
+ $section = ' '
33
+ file { "${environmentpath}/${name}" :
34
+ ensure => directory ,
35
+ }
36
+ }
37
+ default: {
38
+ $path = $puppet_conf
39
+ $section = $name
40
+ }
41
+ }
42
+
22
43
Ini_setting {
23
- path => $puppet_conf ,
44
+ path => $path ,
45
+ section => $section ,
24
46
require => [File [$puppet_conf ], Class[' puppet::master' ]],
25
47
notify => Service[' httpd' ],
26
48
}
27
49
28
- ini_setting {"masterenvmodule${name}" :
29
- ensure => present ,
30
- section => $name ,
31
- setting => ' modulepath' ,
32
- value => $modulepath ,
33
- }
34
- ini_setting {"masterenvmanifest${name}" :
35
- ensure => present ,
36
- section => $name ,
37
- setting => ' manifest' ,
38
- value => $manifest ,
50
+ ini_setting {
51
+ " masterenvmodule${name} " :
52
+ ensure => present ,
53
+ setting => ' modulepath' ,
54
+ value => $modulepath ;
55
+
56
+ " masterenvmanifest${name} " :
57
+ ensure => present ,
58
+ setting => ' manifest' ,
59
+ value => $manifest ;
39
60
}
40
61
}
Original file line number Diff line number Diff line change 1
1
require 'spec_helper'
2
2
3
3
describe 'puppet::masterenv' , :type => :define do
4
- context "Create environment" do
4
+ context "Create config environment" do
5
5
let :title do
6
6
'dev'
7
7
end
30
30
)
31
31
}
32
32
end
33
+ context "Create directory environment" do
34
+ let :title do
35
+ 'dev'
36
+ end
37
+
38
+ let :params do
39
+ {
40
+ :manifest => '/etc/puppet/environments/dev.pp' ,
41
+ :modulepath => '/etc/puppet/environments/modules/' ,
42
+ :puppet_conf => '/etc/puppet/puppet.conf' ,
43
+ :environments => 'directory' ,
44
+ :environmentpath => '/etc/puppet/environments'
45
+ }
46
+ end
47
+ it {
48
+ should contain_ini_setting ( "masterenvmodule#{ title } " ) . with (
49
+ :ensure => 'present' ,
50
+ :section => '' ,
51
+ :setting => 'modulepath' ,
52
+ :path => '/etc/puppet/environments/dev/environment.conf' ,
53
+ :value => params [ :modulepath ]
54
+ )
55
+ should contain_ini_setting ( "masterenvmanifest#{ title } " ) . with (
56
+ :ensure => 'present' ,
57
+ :section => '' ,
58
+ :setting => 'manifest' ,
59
+ :path => '/etc/puppet/environments/dev/environment.conf' ,
60
+ :value => params [ :manifest ]
61
+ )
62
+ should contain_file ( "/etc/puppet/environments/dev" ) . with (
63
+ :ensure => 'directory'
64
+ )
65
+ }
66
+ end
33
67
end
You can’t perform that action at this time.
0 commit comments