From 1c1e6127a35eb005d28acf3384f2222a221e78d1 Mon Sep 17 00:00:00 2001 From: Troy Siedsma Date: Mon, 15 Jul 2019 13:21:50 -0500 Subject: [PATCH] Chg: Issues List Fix: Adding / Removing Records --- ISSUES.md | 12 ++++-------- src/Module.php | 25 ++++++++++++++----------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/ISSUES.md b/ISSUES.md index 1fffe87..7686259 100644 --- a/ISSUES.md +++ b/ISSUES.md @@ -1,19 +1,15 @@ ## Issues List: ## 1) Deleting a Site deletes the zone and then tries to delete records but they were already deleted with the zone -2) Creating MX records just doesn't work -3) Deleting records seems to fail at $id = $this->getRecordId($record); +ERROR : Failed to transfer DNS records from PowerDNS - try again later. Response code: 404 +I know that's generated in the zoneAxfr method, but not sure why it happens during delete. - -### Issue 1 ### -I know the "ERROR" is generated in the zoneAxfr method, but not sure why it happens during delete. -```ERROR : Failed to transfer DNS records from PowerDNS - try again later. Response code: 404 DEBUG : 0.68447: Dns_Module -> _delete DEBUG : 0.04320: Mysql_Module -> _delete DEBUG : 0.00006: Ipinfo_Module -> _delete DEBUG : Service config `billing' disabled for site - disabling calling hook `_delete' on `Billing_Module' DEBUG : Service config `pgsql' disabled for site - disabling calling hook `_delete' on `Pgsql_Module' DEBUG : 0.00054: Site_Module -> _delete -ERROR : Failed to transfer DNS records from PowerDNS - try again later. Response code: 404``` +ERROR : Failed to transfer DNS records from PowerDNS - try again later. Response code: 404 -Seems to be trying to delete records after deleting the zone which deletes the records... +Seems to be trying to delete records after deleting the zone which deletes the records... \ No newline at end of file diff --git a/src/Module.php b/src/Module.php index 21730a0..741078a 100644 --- a/src/Module.php +++ b/src/Module.php @@ -138,7 +138,7 @@ protected function formatRecord(Record $r): ?array case 'MX': $priority = (int) $r->getMeta('priority'); $content = sprintf( - '%d%s', + '%d %s', $r->getMeta('priority'), $this->canonical($r->getMeta('data')) ); @@ -238,7 +238,7 @@ private function renderMessage(ClientException $e): string public function remove_record(string $zone, string $subdomain, string $rr, string $param = null): bool { $zone = trim($zone, '.'); - if (! $this->canonicalizeRecord($zone, $subdomain, $rr, $param)) + if (! $canonicalZone = $this->canonicalizeRecord($zone, $subdomain, $rr, $param)) { return false; } @@ -247,23 +247,26 @@ public function remove_record(string $zone, string $subdomain, string $rr, strin 'name' => $subdomain, 'rr' => $rr, 'parameter' => $param, - 'ttl' => self::DNS_TTL, ]); + // Not sure how this is used +// $id = $this->getRecordId($record); + if ($record['name'] === '@') { - $record['name'] = ''; + $record['name'] = $this->canonical($zone); + } else { + $record['name'] = $this->canonical(implode('.', [$subdomain, $zone])); } $api = $this->makeApi(); - $id = $this->getRecordId($record); - if (! $id) - { - $fqdn = implode('.', [$subdomain, $zone]); - - return error("Record '%s' (rr: '%s', param: '%s') does not exist", $fqdn, $rr, $param); - } +// if (! $id) +// { +// $fqdn = implode('.', [$subdomain, $zone]); +// +// return error("Record '%s' (rr: '%s', param: '%s') does not exist", $fqdn, $rr, $param); +// } $rrsets[] = [ 'records' => '',