Skip to content

Commit ad64a8d

Browse files
authored
Merge pull request #9035 from mhashizume/PUP-11119/main/remove-extra
(PUP-11119) Removes "extra" CLI option
2 parents 4af5cdd + e628254 commit ad64a8d

File tree

5 files changed

+9
-25
lines changed

5 files changed

+9
-25
lines changed

lib/puppet/face/help/action.erb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ undocumented option
5454
end
5555
unless action.options.empty?
5656
action.options.sort.each do |name|
57-
next if name == :extra
5857
option = action.get_option name -%>
5958
<%= " " + option.optparse.join(" | ")[0,(optionroom - 1)].ljust(optionroom) + ' - ' -%>
6059
<% if !(option.summary) -%>

lib/puppet/face/help/face.erb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ undocumented option
4949
end
5050
unless face.options.empty?
5151
face.options.sort.each do |name|
52-
next if name == :extra
5352
option = face.get_option name -%>
5453
<%= " " + option.optparse.join(" | ")[0,(optionroom - 1)].ljust(optionroom) + ' - ' -%>
5554
<% if !(option.summary) -%>

lib/puppet/indirector/face.rb

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,10 @@ def call_indirection_method(method, key, options)
5454
return result
5555
end
5656

57-
option "--extra " + _("HASH") do
58-
summary _("Extra arguments to pass to the indirection request")
59-
description <<-EOT
60-
A terminus can take additional arguments to refine the operation, which
61-
are passed as an arbitrary hash to the back-end. Anything passed as
62-
the extra value is just send direct to the back-end.
63-
EOT
64-
default_to do Hash.new end
65-
end
66-
6757
action :destroy do
6858
summary _("Delete an object.")
6959
arguments _("<key>")
70-
when_invoked {|key, options| call_indirection_method :destroy, key, options[:extra] }
60+
when_invoked {|key, options| call_indirection_method :destroy, key, {} }
7161
end
7262

7363
action :find do
@@ -77,11 +67,10 @@ def call_indirection_method(method, key, options)
7767
# Default the key to Puppet[:certname] if none is supplied
7868
if args.length == 1
7969
key = Puppet[:certname]
80-
options = args.last
8170
else
82-
key, options = *args
71+
key = args.first
8372
end
84-
call_indirection_method :find, key, options[:extra]
73+
call_indirection_method :find, key, {}
8574
end
8675
end
8776

@@ -93,13 +82,13 @@ def call_indirection_method(method, key, options)
9382
currently accept data from STDIN, save actions cannot currently be invoked
9483
from the command line.
9584
EOT
96-
when_invoked {|key, options| call_indirection_method :save, key, options[:extra] }
85+
when_invoked {|key, options| call_indirection_method :save, key, {} }
9786
end
9887

9988
action :search do
10089
summary _("Search for an object or retrieve multiple objects.")
10190
arguments _("<query>")
102-
when_invoked {|key, options| call_indirection_method :search, key, options[:extra] }
91+
when_invoked {|key, options| call_indirection_method :search, key, {} }
10392
end
10493

10594
# Print the configuration for the current terminus class

lib/puppet/interface/documentation.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ def build_synopsis(face, action = nil, arguments = nil)
7676
s.text(" ")
7777

7878
options.each do |option|
79-
next if option == :extra
8079
option = get_option(option)
8180
wrap = option.required? ? %w{ < > } : %w{ [ ] }
8281

spec/unit/indirector/face_spec.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
instance
1212
end
1313

14-
it { is_expected.to be_option :extra }
15-
1614
it "should be able to return a list of indirections" do
1715
expect(Puppet::Indirector::Face.indirections).to be_include("catalog")
1816
end
@@ -56,14 +54,14 @@ def params(method, options)
5654
end
5755

5856
it "should forward passed options" do
59-
expect(subject.indirection).to receive(method).with(:test, *params(method, {'one'=>'1'}))
60-
subject.send(method, :test, :extra => {'one'=>'1'})
57+
expect(subject.indirection).to receive(method).with(:test, *params(method, {}))
58+
subject.send(method, :test, {})
6159
end
6260
end
6361

6462
it "should default key to certname for find action" do
65-
expect(subject.indirection).to receive(:find).with(Puppet[:certname], {'one'=>'1'})
66-
subject.send(:find, :extra => {'one'=>'1'})
63+
expect(subject.indirection).to receive(:find).with(Puppet[:certname], {})
64+
subject.send(:find, {})
6765
end
6866

6967
it "should be able to override its indirection name" do

0 commit comments

Comments
 (0)