From 829707fc5a092d5ebad77e1c9b9f4b7ab8f0f1f8 Mon Sep 17 00:00:00 2001 From: Andrew Pantuso Date: Mon, 19 Sep 2022 14:10:21 -0400 Subject: [PATCH] fix: add warning when openssh-keypair has private_key_format specified with opensshbin (#512) --- plugins/module_utils/openssh/backends/keypair_backend.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/module_utils/openssh/backends/keypair_backend.py b/plugins/module_utils/openssh/backends/keypair_backend.py index 95da8597..8cc39c6f 100644 --- a/plugins/module_utils/openssh/backends/keypair_backend.py +++ b/plugins/module_utils/openssh/backends/keypair_backend.py @@ -312,6 +312,12 @@ class KeypairBackendOpensshBin(KeypairBackend): def __init__(self, module): super(KeypairBackendOpensshBin, self).__init__(module) + if self.module.params['private_key_format'] != 'auto': + self.module.fail_json( + msg="'auto' is the only valid option for " + + "'private_key_format' when 'backend' is not 'cryptography'" + ) + self.ssh_keygen = KeygenCommand(self.module) def _generate_keypair(self, private_key_path):