From 618280f7fea44601c5a26f4864d52f03e4814fdf Mon Sep 17 00:00:00 2001 From: shaerpour Date: Mon, 2 Jun 2025 16:29:19 +0330 Subject: [PATCH] fix: Check public_key is not None first --- plugins/modules/ssh_key.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/modules/ssh_key.py b/plugins/modules/ssh_key.py index e7aefd7..0170393 100644 --- a/plugins/modules/ssh_key.py +++ b/plugins/modules/ssh_key.py @@ -191,8 +191,8 @@ class AnsibleHCloudSSHKey(AnsibleHCloud): force = self.module.params.get("force") public_key = self.module.params.get("public_key") - fingerprint = ssh_public_key_md5_fingerprint(public_key) - if fingerprint != self.hcloud_ssh_key.fingerprint: + fingerprint = ssh_public_key_md5_fingerprint(public_key) if public_key is not None else None + if fingerprint is not None and fingerprint != self.hcloud_ssh_key.fingerprint: if not force: self.module.warn( "A new public key with same name has been detected. "