| 76 | |
| 77 | # Mock the AnsibleModule for testing |
| 78 | class MockModule: |
| 79 | def __init__(self, params): |
| 80 | self.params = params |
| 81 | self.result = {} |
| 82 | |
| 83 | def fail_json(self, **kwargs): |
| 84 | raise Exception(f"Module failed: {kwargs}") |
| 85 | |
| 86 | def exit_json(self, **kwargs): |
| 87 | self.result = kwargs |
| 88 | |
| 89 | with tempfile.NamedTemporaryFile(suffix=".pub", delete=False) as temp_pub: |
| 90 | public_key_path = temp_pub.name |
no outgoing calls