class RanchManager::IpManager

Public Class Methods

add(host, ip=current_ip_address.strip) click to toggle source
# File lib/ranch-manager/ip_manager.rb, line 13
def self.add(host, ip=current_ip_address.strip)
  Logger.info "Adding #{host} to rancher-manager with ip #{ip}"

  host = Hostname.new(*[host, ip].compact)
  Ghost.store.add(host)
end
remove(host) click to toggle source
# File lib/ranch-manager/ip_manager.rb, line 20
def self.remove(host)
  Logger.info "Removing #{host} from rancher-manager"
  Ghost.store.delete(host)
end
update(host, ip=current_ip_address.strip) click to toggle source
# File lib/ranch-manager/ip_manager.rb, line 25
def self.update(host, ip=current_ip_address.strip)
  Logger.info "Updating ip address for #{host}"
  remove(host)
  add(host, ip)
end
update_all(ip=current_ip_address.strip) click to toggle source
# File lib/ranch-manager/ip_manager.rb, line 3
def self.update_all(ip=current_ip_address.strip)
  hostnames.each do |host|
    if %x`ghost list | grep '#{host}'`
      update(host, ip)
    else
      add(host, ip)
    end
  end
end