Calling Spicerack's puppetserver.destroy when a certificate does not exist fails with:
----- OUTPUT of 'sudo -i puppetse....wikimedia.cloud' ----- Error: Could not find files to clean for toolsbeta-static-2.toolsbeta.eqiad1.wikimedia.cloud ================ 100.0% (1/1) of nodes failed to execute command 'sudo -i puppetse....wikimedia.cloud': toolsbeta-puppetserver-1.toolsbeta.eqiad1.wikimedia.cloud 0.0% (0/1) success ratio (< 100.0% threshold) for command: 'sudo -i puppetse....wikimedia.cloud'. Aborting. 0.0% (0/1) success ratio (< 100.0% threshold) of nodes successfully executed all commands. Aborting. Exception raised while executing cookbook wmcs.vps.refresh_puppet_certs: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/spicerack/_menu.py", line 250, in _run raw_ret = runner.run() File "/home/taavi/cookbooks_testing/cookbooks/wmcs_libs/common.py", line 751, in _wrapped_run return object.__getattribute__(self, __name)(*args, **kwargs) File "/home/taavi/cookbooks_testing/cookbooks/cookbooks/wmcs/vps/refresh_puppet_certs.py", line 146, in run _refresh_cert(spicerack=self.spicerack, remote_host=remote_host) File "/home/taavi/cookbooks_testing/cookbooks/cookbooks/wmcs/vps/refresh_puppet_certs.py", line 54, in _refresh_cert puppetserver.destroy(hostname=fqdn) File "/usr/lib/python3/dist-packages/spicerack/puppet.py", line 423, in destroy self.server_host.run_sync(f"puppetserver ca clean --certname {hostname}", print_progress_bars=False) File "/usr/lib/python3/dist-packages/spicerack/remote.py", line 514, in run_sync return self._execute( File "/usr/lib/python3/dist-packages/spicerack/remote.py", line 720, in _execute raise RemoteExecutionError(ret, "Cumin execution failed", worker.get_results()) spicerack.remote.RemoteExecutionError: Cumin execution failed (exit_code=2)
This is different from the old Puppet 5 Puppetserver behaviour, and does not match the documentation of that method which says:
If there is no certificate to remove it doesn't raise exception as the Puppet CA just outputs 'Nothing was deleted'.