Skip to content

Commit b99d238

Browse files
(maint) Merge up 1c40231 to main
Generated by CI * commit '1c4023187f1d875bab4ec3a63e066b5bdf5c2067': (PUP-11895) ssl application's clean shouldn't allow extra args
2 parents 2bec399 + 1c40231 commit b99d238

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/puppet/application/ssl.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ def main
147147
when 'verify'
148148
verify(certname)
149149
when 'clean'
150+
possible_extra_args = command_line.args.drop(1)
151+
unless possible_extra_args.empty?
152+
raise Puppet::Error, _(<<END) % { args: possible_extra_args.join(' ')}
153+
Extra arguments detected: %{args}
154+
Did you mean to run:
155+
puppetserver ca clean --certname <name>
156+
Or:
157+
puppet ssl clean --target <name>
158+
END
159+
end
150160
clean(certname)
151161
when 'bootstrap'
152162
if !Puppet::Util::Log.sendlevel?(:info)

spec/unit/application/ssl_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,11 @@ def expects_command_to_fail(message)
391391
expects_command_to_fail(%r{Failed to connect to the CA to determine if certificate #{name} has been cleaned})
392392
end
393393

394+
it 'raises if we have extra args' do
395+
ssl.command_line.args << 'hostname.example.biz'
396+
expects_command_to_fail(/Extra arguments detected: hostname.example.biz/)
397+
end
398+
394399
context 'when deleting local CA' do
395400
before do
396401
ssl.command_line.args << '--localca'

0 commit comments

Comments
 (0)