|
10 | 10 | # Add script directory to path to import dns_providers |
11 | 11 | sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) |
12 | 12 |
|
| 13 | +from .dns_providers.base import DNSProvider |
13 | 14 | from dns_providers import DNSProviderFactory |
14 | 15 |
|
15 | 16 |
|
@@ -238,27 +239,6 @@ def _debug_plugin_registration(self) -> None: |
238 | 239 | except Exception as debug_error: |
239 | 240 | print(f"Debug failed: {debug_error}") |
240 | 241 |
|
241 | | - def _validate_provider_credentials(self) -> bool: |
242 | | - """Validate provider credentials by testing API access.""" |
243 | | - print(f"Validating {self.provider_type} API credentials...") |
244 | | - |
245 | | - try: |
246 | | - # For Namecheap, test API access |
247 | | - if hasattr(self.provider, '_make_request'): |
248 | | - test_result = self.provider._make_request("namecheap.users.getBalances") |
249 | | - if test_result.get("success", False): |
250 | | - print(f"✓ {self.provider_type} API credentials are valid") |
251 | | - return True |
252 | | - else: |
253 | | - print(f"✗ {self.provider_type} API validation failed: {test_result.get('errors', ['Unknown error'])}") |
254 | | - return False |
255 | | - else: |
256 | | - print(f"No API validation available for {self.provider_type}, skipping") |
257 | | - return True |
258 | | - except Exception as e: |
259 | | - print(f"Error validating {self.provider_type} credentials: {e}") |
260 | | - return False |
261 | | - |
262 | 242 | def setup_credentials(self) -> bool: |
263 | 243 | """Setup credentials file for certbot using provider implementation.""" |
264 | 244 | result = self.provider.setup_certbot_credentials() |
@@ -304,7 +284,7 @@ def obtain_certificate(self, domain: str, email: str) -> bool: |
304 | 284 | return False |
305 | 285 |
|
306 | 286 | # Validate credentials before proceeding |
307 | | - if not self._validate_provider_credentials(): |
| 287 | + if not self.provider.validate_credentials(): |
308 | 288 | print(f"Failed to validate credentials for {self.provider_type}", file=sys.stderr) |
309 | 289 | return False |
310 | 290 |
|
|
0 commit comments