Commits

Genki Sugawara committed 219726e

fix A(alias) check bug

Comments (0)

Files changed (2)

Resources/chrome/content/rrset-treeview.js

         var xhr = elbcli.query('DescribeLoadBalancers');
 
         for each (var member in xhr.xml()..LoadBalancerDescriptions.member) {
-          var r = new RegExp(member.DNSName.toString().replace(/\./g, '\\.'));
+          var r = new RegExp('^' + member.DNSName.toString().replace(/\./g, '\\.') + '\\.?$');
 
           if (r.test(result.value)) {
             canonicalHostedZoneNameId = member.CanonicalHostedZoneNameID.toString();
     })();
 
     // CREATE
+    var error_happened = false;
+
     (function() {
       var change_create = new XML('<Change></Change>');
       change_create.Action = 'CREATE';
 
         if (!endpoint) {
           alert('Cannot get ELB endpoint.');
+          error_happened = true;
           return;
         }
 
           var xhr = elbcli.query('DescribeLoadBalancers');
 
           for each (var member in xhr.xml()..LoadBalancerDescriptions.member) {
-            var r = new RegExp(member.DNSName.toString().replace(/\./g, '\\.'));
+            var r = new RegExp('^' + member.DNSName.toString().replace(/\./g, '\\.') + '\\.?$');
 
             if (r.test(result.value)) {
               canonicalHostedZoneNameId = member.CanonicalHostedZoneNameID.toString();
         }.bind(this), $('rrset-window-loader'));
 
         if (!canonicalHostedZoneNameId) {
+          error_happened = true;
           return;
         }
 
       xml.ChangeBatch.Changes.Change += change_create;
     })();
 
+    if (error_happened) {
+      return;
+    }
+
     var xhr = null;
 
     $R53(function(r53cli) {

Resources/chrome/modules/elb-client.jsm

 
 ELBClient.getEndpoint = function(url) {
   for (var i in ENDPOINTS) {
-    var r = new RegExp(i.replace(/\./g, '\\.')+ '.?$');
+    var r = new RegExp(i.replace(/\./g, '\\.')+ '\\.?$');
 
     if (r.test(url)) {
       return ENDPOINTS[i];