lib/dev-lxc/server.rb in dev-lxc-2.2.7 vs lib/dev-lxc/server.rb in dev-lxc-2.3.0

- old
+ new

@@ -34,23 +34,21 @@ @container.install_package(package_path) end def start hwaddr = @container.config_item("lxc.network.0.hwaddr") - if @ipaddress - DevLXC.assign_ip_address(@ipaddress, @container.name, hwaddr) - DevLXC.create_dns_record(@additional_fqdn, @container.name, @ipaddress) unless @additional_fqdn.nil? - end + DevLXC.assign_ip_address(@ipaddress, @container.name, hwaddr) if @ipaddress @container.sync_mounts(@mounts) @container.start @container.sync_ssh_keys(@ssh_keys) + puts end def stop hwaddr = @container.config_item("lxc.network.0.hwaddr") if @container.defined? @container.stop - deregister_from_dnsmasq(hwaddr) + deregister_from_dhcp(hwaddr) end def snapshot(comment=nil) unless @container.defined? puts "WARNING: Skipping snapshot of '#{@container.name}' because it does not exist" @@ -145,15 +143,14 @@ if @container.defined? hwaddr = @container.config_item("lxc.network.0.hwaddr") @container.snapshot_list.each { |snapshot| @container.snapshot_destroy(snapshot.first) } end @container.destroy - deregister_from_dnsmasq(hwaddr) + deregister_from_dhcp(hwaddr) end - def deregister_from_dnsmasq(hwaddr) + def deregister_from_dhcp(hwaddr) if @ipaddress - DevLXC.search_file_delete_line("/etc/lxc/addn-hosts.conf", /^#{@ipaddress}\s/) DevLXC.search_file_delete_line("/etc/lxc/dhcp-hosts.conf", /,#{@ipaddress}$/) end unless hwaddr.nil? DevLXC.search_file_delete_line("/etc/lxc/dhcp-hosts.conf", /^#{hwaddr}/) end