File tree 3 files changed +52
-34
lines changed
3 files changed +52
-34
lines changed Original file line number Diff line number Diff line change @@ -49,29 +49,15 @@ def self.default_cadir
49
49
end
50
50
51
51
def self . default_basemodulepath
52
- if Puppet ::Util ::Platform . windows?
53
- path = [ '$codedir/modules' ]
54
- installdir = ENV [ "FACTER_env_windows_installdir" ]
55
- if installdir
56
- path << "#{ installdir } /puppet/modules"
57
- end
58
- path . join ( File ::PATH_SEPARATOR )
59
- else
60
- '$codedir/modules:/opt/puppetlabs/puppet/modules'
52
+ path = [ '$codedir/modules' ]
53
+ if ( run_mode_dir = Puppet . run_mode . common_module_dir )
54
+ path << run_mode_dir
61
55
end
56
+ path . join ( File ::PATH_SEPARATOR )
62
57
end
63
58
64
59
def self . default_vendormoduledir
65
- if Puppet ::Util ::Platform . windows?
66
- installdir = ENV [ "FACTER_env_windows_installdir" ]
67
- if installdir
68
- "#{ installdir } \\ puppet\\ vendor_modules"
69
- else
70
- nil
71
- end
72
- else
73
- '/opt/puppetlabs/puppet/vendor_modules'
74
- end
60
+ Puppet . run_mode . vendor_module_dir
75
61
end
76
62
77
63
############################################################################################
Original file line number Diff line number Diff line change 6
6
7
7
confine :true => Puppet . runtime [ :facter ] . value ( :aio_agent_version )
8
8
9
- def self . windows_gemcmd
10
- puppet_dir = Puppet ::Util . get_env ( 'PUPPET_DIR' )
11
- if puppet_dir
12
- File . join ( Puppet ::Util . get_env ( 'PUPPET_DIR' ) . to_s , 'bin' , 'gem.bat' )
13
- else
14
- File . join ( Gem . default_bindir , 'gem.bat' )
15
- end
16
- end
17
-
18
- if Puppet ::Util ::Platform . windows?
19
- commands :gemcmd => windows_gemcmd
20
- else
21
- commands :gemcmd => "/opt/puppetlabs/puppet/bin/gem"
22
- end
9
+ commands :gemcmd => Puppet . run_mode . gem_cmd
23
10
24
11
def uninstall
25
12
super
@@ -28,7 +15,9 @@ def uninstall
28
15
end
29
16
30
17
def self . execute_gem_command ( command , command_options , custom_environment = { } )
31
- custom_environment [ 'PKG_CONFIG_PATH' ] = '/opt/puppetlabs/puppet/lib/pkgconfig' unless Puppet ::Util ::Platform . windows?
18
+ if ( pkg_config_path = Puppet . run_mode . pkg_config_path )
19
+ custom_environment [ 'PKG_CONFIG_PATH' ] = pkg_config_path
20
+ end
32
21
super ( command , command_options , custom_environment )
33
22
end
34
23
end
Original file line number Diff line number Diff line change @@ -85,6 +85,22 @@ def run_dir
85
85
def log_dir
86
86
which_dir ( "/var/log/puppetlabs/puppet" , "~/.puppetlabs/var/log" )
87
87
end
88
+
89
+ def pkg_config_path
90
+ '/opt/puppetlabs/puppet/lib/pkgconfig'
91
+ end
92
+
93
+ def gem_cmd
94
+ '/opt/puppetlabs/puppet/bin/gem'
95
+ end
96
+
97
+ def common_module_dir
98
+ '/opt/puppetlabs/puppet/modules'
99
+ end
100
+
101
+ def vendor_module_dir
102
+ '/opt/puppetlabs/puppet/vendor_modules'
103
+ end
88
104
end
89
105
90
106
class WindowsRunMode < RunMode
@@ -112,8 +128,35 @@ def log_dir
112
128
which_dir ( File . join ( windows_common_base ( "puppet/var/log" ) ) , "~/.puppetlabs/var/log" )
113
129
end
114
130
131
+ def pkg_config_path
132
+ nil
133
+ end
134
+
135
+ def gem_cmd
136
+ puppet_dir = Puppet ::Util . get_env ( 'PUPPET_DIR' )
137
+ if puppet_dir
138
+ File . join ( puppet_dir . to_s , 'bin' , 'gem.bat' )
139
+ else
140
+ File . join ( Gem . default_bindir , 'gem.bat' )
141
+ end
142
+ end
143
+
144
+ def common_module_dir
145
+ # TODO: use File.join?
146
+ "#{ installdir } /puppet/modules" if installdir
147
+ end
148
+
149
+ def vendor_module_dir
150
+ # TODO: use File.join?
151
+ "#{ installdir } \\ puppet\\ vendor_modules" if installdir
152
+ end
153
+
115
154
private
116
155
156
+ def installdir
157
+ ENV [ "FACTER_env_windows_installdir" ]
158
+ end
159
+
117
160
def windows_common_base ( *extra )
118
161
[ ENV [ 'ALLUSERSPROFILE' ] , "PuppetLabs" ] + extra
119
162
end
You can’t perform that action at this time.
0 commit comments