Browse Source

skip nonexisting domains

Serghey Rodin 12 years ago
parent
commit
0f7c02ee4e
1 changed files with 11 additions and 2 deletions
  1. 11 2
      bin/v-add-remote-dns-domain

+ 11 - 2
bin/v-add-remote-dns-domain

@@ -26,8 +26,6 @@ source $VESTA/conf/vesta.conf
 check_args '2' "$#" 'USER DOMAIN'
 validate_format 'user' 'domain'
 is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
-is_object_valid 'user' 'USER' "$user"
-is_object_valid 'dns' 'DOMAIN' "$domain"
 
 if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then
     echo "Error: dns-cluster.conf doesn't exist"
@@ -47,6 +45,17 @@ fi
 #                       Action                             #
 #----------------------------------------------------------#
 
+# Check domain existance
+check_local_domain=$(grep "DOMAIN='$domain'" $USER_DATA/dns.conf 2>/dev/null)
+if [ -z "$check_local_domain" ]; then
+    pipe="$VESTA/data/queue/dns-cluster.pipe"
+    str=$(grep -n "$SCRIPT $1 $2$" $pipe | cut -f1 -d: | head -n1)
+    if [ ! -z "$str" ]; then
+        sed -i "$str d"  $pipe
+    fi
+    exit
+fi
+
 old_ifs="$IFS"
 IFS=$'\n'