diff --git a/lib/puppet/application/ssl.rb b/lib/puppet/application/ssl.rb index 5f39a2cfea0..5fa804e7d9e 100644 --- a/lib/puppet/application/ssl.rb +++ b/lib/puppet/application/ssl.rb @@ -146,6 +146,16 @@ def main when 'verify' verify(certname) when 'clean' + possible_extra_args = command_line.args.drop(1) + unless possible_extra_args.empty? + raise Puppet::Error, _(< +Or: + puppet ssl clean --target +END + end clean(certname) when 'bootstrap' if !Puppet::Util::Log.sendlevel?(:info) diff --git a/spec/unit/application/ssl_spec.rb b/spec/unit/application/ssl_spec.rb index b790e70d065..48181280281 100644 --- a/spec/unit/application/ssl_spec.rb +++ b/spec/unit/application/ssl_spec.rb @@ -391,6 +391,11 @@ def expects_command_to_fail(message) expects_command_to_fail(%r{Failed to connect to the CA to determine if certificate #{name} has been cleaned}) end + it 'raises if we have extra args' do + ssl.command_line.args << 'hostname.example.biz' + expects_command_to_fail(/Extra arguments detected: hostname.example.biz/) + end + context 'when deleting local CA' do before do ssl.command_line.args << '--localca'