@@ -53,7 +53,7 @@ def self.gemlist(options)
53
53
end
54
54
55
55
if options [ :local ]
56
- list = execute_rubygems_list_command ( gem_regex )
56
+ list = execute_rubygems_list_command ( command_options )
57
57
else
58
58
begin
59
59
list = puppetservercmd ( command_options )
@@ -137,7 +137,7 @@ def uninstall
137
137
# for example: json (1.8.3 java)
138
138
# but java platform gems should not be managed by this (or any) provider.
139
139
140
- def self . execute_rubygems_list_command ( gem_regex )
140
+ def self . execute_rubygems_list_command ( command_options )
141
141
puppetserver_default_gem_home = '/opt/puppetlabs/server/data/puppetserver/jruby-gems'
142
142
puppetserver_default_vendored_jruby_gems = '/opt/puppetlabs/server/data/puppetserver/vendored-jruby-gems'
143
143
puppet_default_vendor_gems = '/opt/puppetlabs/puppet/lib/ruby/vendor_gems'
@@ -157,24 +157,15 @@ def self.execute_rubygems_list_command(gem_regex)
157
157
gem_env [ 'GEM_PATH' ] = puppetserver_conf [ 'jruby-puppet' ] . key? ( 'gem-path' ) ? puppetserver_conf [ 'jruby-puppet' ] [ 'gem-path' ] . join ( ':' ) : puppetserver_default_gem_path
158
158
end
159
159
gem_env [ 'GEM_SPEC_CACHE' ] = "/tmp/#{ $$} "
160
- Gem . paths = gem_env
161
-
162
- sio_inn = StringIO . new
163
- sio_out = StringIO . new
164
- sio_err = StringIO . new
165
- stream_ui = Gem ::StreamUI . new ( sio_inn , sio_out , sio_err , false )
166
- gem_list_cmd = Gem ::Commands ::ListCommand . new
167
- gem_list_cmd . options [ :domain ] = :local
168
- gem_list_cmd . options [ :args ] = [ gem_regex ] if gem_regex
169
- gem_list_cmd . ui = stream_ui
170
- gem_list_cmd . execute
160
+
161
+ # Remove the 'gem' from the command_options
162
+ command_options . shift
163
+ gem_out = execute_gem_command ( Puppet ::Type ::Package ::ProviderPuppet_gem . provider_command , command_options , gem_env )
171
164
172
165
# There is no method exclude default gems from the local gem list,
173
166
# for example: psych (default: 2.2.2)
174
167
# but default gems should not be managed by this (or any) provider.
175
- gem_list = sio_out . string . lines . reject { |gem | gem =~ / \( default\: / }
168
+ gem_list = gem_out . lines . reject { |gem | gem =~ / \( default\: / }
176
169
gem_list . join ( "\n " )
177
- ensure
178
- Gem . clear_paths
179
170
end
180
171
end
0 commit comments