File tree Expand file tree Collapse file tree 2 files changed +45
-5
lines changed Expand file tree Collapse file tree 2 files changed +45
-5
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
+ ) {
22
28
23
- case $::puppet::master:: environments {
29
+ case $environments {
24
30
' directory' : {
25
- $path = " ${::puppet::master:: environmentpath} /${name} /environment.conf"
31
+ $path = " ${environmentpath} /${name} /environment.conf"
26
32
$section = ' '
27
- file { "${::puppet::master:: environmentpath}/${name}" :
33
+ file { "${environmentpath}/${name}" :
28
34
ensure => directory ,
29
35
}
30
36
}
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