Browse Source

Fix Route53 API consumer

Ignoring the Chthlulu argument :smiley:, Route53 returns its XML all on one line, making not possible to grep the hosted zone record with egrep/sed.

This change splits the XML in multiple lines, so that parsing can succeed.
Marcello Barnaba 8 years ago
parent
commit
c12be766e9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      dnsapi/dns_aws.sh

+ 1 - 1
dnsapi/dns_aws.sh

@@ -72,7 +72,7 @@ _get_root() {
       fi
 
       if _contains "$response" "<Name>$h.</Name>"; then
-        hostedzone="$(echo "$response" | _egrep_o "<HostedZone>.*<Name>$h.</Name>.*</HostedZone>")"
+        hostedzone="$(echo "$response" | sed 's/<HostedZone>/\n&/g' | _egrep_o "<HostedZone>.*<Name>$h.</Name>.*</HostedZone>")"
         _debug hostedzone "$hostedzone"
         if [ -z "$hostedzone" ]; then
           _err "Error, can not get hostedzone."