lib/esgob/client.rb
def domains_slaves_sync(domains, masterip)
    existing_domains = domains_slaves_list

    # Add any missing domains
    responses = []
    domains.each do |domain|
      unless existing_domains.include?(domain)
        response = domains_slaves_add(domain, masterip)
        response[:domain] ||= domain
        responses << response
      end
    end

    # Now check the existing domains
    existing_domains.keys.sort.each do |domain|
      if domains.include?(domain)
        # Update the masterip if it isn't correct
        if existing_domains[domain] != masterip
          response = domains_slaves_updatemasterip(domain, masterip)
          response[:domain] ||= domain
          responses << response
        end
      else
        # Delete domain; not on list
        response = domains_slaves_delete(domain)
        response[:domain] ||= domain
        responses << response
      end
    end

    responses
  end
# Given a list of domains and a master IP, add and delete domains
# so that the Esgob account matches the local list
# @param [Array<String>] domains The an array of domains to add to Esgob
# @param [String] masterip The master IP address to use for all the domains
# @return [Array<Hash>] A list of responses from the Esgob service
Given a list of domains and a master IP, add and delete domains
so that the Esgob account matches the local list
Given a list of domains and a master IP add and delete domains so that the Esgob account matches the local list
def domains_slaves_sync(domains, masterip)
    existing_domains = domains_slaves_list
    responses = []
    domains.each do |domain|
      unless existing_domains.include?(domain)
        response = domains_slaves_add(domain, masterip)
        response[:domain] ||= domain
        responses << response
      end
    end
    existing_domains.keys.sort.each do |domain|
      if domains.include?(domain)
        if existing_domains[domain] != masterip
          response = domains_slaves_updatemasterip(domain, masterip)
          response[:domain] ||= domain
          responses << response
        end
      else
        response = domains_slaves_delete(domain)
        response[:domain] ||= domain
        responses << response
      end
    end
    responses
  end
def domains_slaves_sync ( domains , masterip ) existing_domains = domains_slaves_list responses = [ ] domains . each do | domain | unless existing_domains . include? ( domain ) response = domains_slaves_add ( domain , masterip ) response [ :domain ] ||= domain responses << response end end existing_domains . keys . sort . each do | domain | if domains . include? ( domain ) if existing_domains [ domain ] != masterip response = domains_slaves_updatemasterip ( domain , masterip ) response [ :domain ] ||= domain responses << response end else response = domains_slaves_delete ( domain ) response [ :domain ] ||= domain responses << response end end responses end
Given a list of domains and a master IP, add and delete domains
so that the Esgob account matches the local list
Given a list of domains and a master IP add and delete domains so that the Esgob account matches the local list
# Add any missing domains # Now check the existing domains # Update the masterip if it isn't correct # Delete domain; not on list
A list of responses from the Esgob service
A list of responses from the Esgob service
Array<Hash>
domains
masterip
masterip The master IP address to use for all the domains
masterip The master IP address to use for all the domains