Index: /trunk/DNSDB.pm
===================================================================
--- /trunk/DNSDB.pm	(revision 766)
+++ /trunk/DNSDB.pm	(revision 767)
@@ -1409,16 +1409,16 @@
     if (!$iplist) {
       # not fatal since we do the lookup on export as well
-      return ('WARN',
-        join("\n", $errstr, "No cached data and no live DNS data for ALIAS target ${$args{val}};  record may be SKIPPED on export!") );
+      $warnmsg = "No cached data and no live DNS data for ALIAS target ${$args{val}};  record may be SKIPPED on export!";
     }
   }
 
   # munge the insert/update fieldlist and data array
-  if ($iplist ne $liveips) {
+  # note we always force this;  if the target has changed the cached data is almost certainly invalid anyway
+  if ($liveips && ($iplist ne $liveips)) {
     ${$args{fields}} .= "auxdata,";
     push @{$args{vallist}}, $liveips;
   }
 
-  return ('WARN', $warnmsg) if $warnmsg;
+  return ('WARN', join("\n", $errstr, $warnmsg) ) if $warnmsg;
   
   return ('OK','OK');
@@ -1438,5 +1438,5 @@
   my $reply = $res->query($target);
 
-  my $liveips;
+  my $liveips = '';
   if ($reply) {
     # default to a one-hour TTL, which should be variously modified down the chain.  Arguably this could
@@ -1453,5 +1453,6 @@
     $minttl = 60 if $minttl < 60;
     # we don't need this to be perfectly correct IP address order, just consistent.
-    $liveips = "$minttl:".join(':', sort(@newlist));
+    $liveips = "$minttl:".join(':', sort(@newlist)) if @newlist;
+#fixme:  should it be a formal error case if there are no A records returned?
   } else {
     $errstr = "Lookup failure retrieving ALIAS IP list: ".$res->errorstring;
@@ -6760,8 +6761,10 @@
 
     my ($iplist) = $self->{dbh}->selectrow_array("SELECT auxdata FROM records WHERE record_id = ?", undef, $recid);
+    $iplist = '' if !$iplist;
 
     # shared target-name-to-IP converter
     my $liveips = $self->_grab_65300($recid, $val);
-    if ($iplist ne $liveips) {
+    # only update the cache if the live lookup actually returned data
+    if ($liveips && ($iplist ne $liveips)) {
       $self->{dbh}->do("UPDATE records SET auxdata = ? WHERE record_id = ?", undef, $liveips, $recid);
       $iplist = $liveips;
