If a cert file has a newline at the end of it, the juju action fails with :
$ juju run-action --wait vault/leader upload-signed-csr pem="$(cat signed-csr-vault.pem |base64)" root-ca="$(cat root-ca.pem |base64)" allowed-domains='mydomain.com'
unit-vault-0:
UnitId: vault/0
id: "90"
message: 'hvac.exceptions.InvalidRequest: no data found in PEM block'
results:
Stderr: |
/var/lib/juju/agents/unit-vault-0/charm/lib/charm/vault_pki.py:204: DeprecationWarning: Call to deprecated function '_post'. This method will be removed in version '0.8.0' Please use the 'post' method on the 'hvac.adapters' class moving forward.
json={'certificate': pem})
The charm should be able to handle newline at the end of a cert file. This especially happens when the cert was generated on Windows with CR/LF and it causes headaches for no reason.
https:/ /review. opendev. org/#/c/ 754399/