File tree Expand file tree Collapse file tree 2 files changed +25
-15
lines changed Expand file tree Collapse file tree 2 files changed +25
-15
lines changed Original file line number Diff line number Diff line change 6
6
7
7
confine :true => 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,14 @@ 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
88
96
end
89
97
90
98
class WindowsRunMode < RunMode
@@ -112,6 +120,19 @@ def log_dir
112
120
which_dir ( File . join ( windows_common_base ( "puppet/var/log" ) ) , "~/.puppetlabs/var/log" )
113
121
end
114
122
123
+ def pkg_config_path
124
+ nil
125
+ end
126
+
127
+ def gem_cmd
128
+ puppet_dir = Puppet ::Util . get_env ( 'PUPPET_DIR' )
129
+ if puppet_dir
130
+ File . join ( Puppet ::Util . get_env ( 'PUPPET_DIR' ) . to_s , 'bin' , 'gem.bat' )
131
+ else
132
+ File . join ( Gem . default_bindir , 'gem.bat' )
133
+ end
134
+ end
135
+
115
136
private
116
137
117
138
def windows_common_base ( *extra )
You can’t perform that action at this time.
0 commit comments