@@ -53,7 +53,7 @@ def self.gemlist(options)
5353 end
5454
5555 if options [ :local ]
56- list = execute_rubygems_list_command ( gem_regex )
56+ list = execute_rubygems_list_command ( command_options )
5757 else
5858 begin
5959 list = puppetservercmd ( command_options )
@@ -137,7 +137,7 @@ def uninstall
137137 # for example: json (1.8.3 java)
138138 # but java platform gems should not be managed by this (or any) provider.
139139
140- def self . execute_rubygems_list_command ( gem_regex )
140+ def self . execute_rubygems_list_command ( command_options )
141141 puppetserver_default_gem_home = '/opt/puppetlabs/server/data/puppetserver/jruby-gems'
142142 puppetserver_default_vendored_jruby_gems = '/opt/puppetlabs/server/data/puppetserver/vendored-jruby-gems'
143143 puppet_default_vendor_gems = '/opt/puppetlabs/puppet/lib/ruby/vendor_gems'
@@ -157,24 +157,15 @@ def self.execute_rubygems_list_command(gem_regex)
157157 gem_env [ 'GEM_PATH' ] = puppetserver_conf [ 'jruby-puppet' ] . key? ( 'gem-path' ) ? puppetserver_conf [ 'jruby-puppet' ] [ 'gem-path' ] . join ( ':' ) : puppetserver_default_gem_path
158158 end
159159 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 )
171164
172165 # There is no method exclude default gems from the local gem list,
173166 # for example: psych (default: 2.2.2)
174167 # 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\: / }
176169 gem_list . join ( "\n " )
177- ensure
178- Gem . clear_paths
179170 end
180171end
0 commit comments