lib/wire/resource/dhcp_range_config.rb
# creates the configuration and restarts dnsmasq
creates the configuration and restarts dnsmasq
creates the configuration and restarts dnsmasq
def up
        filename = create_dnsmaqs_config_filename
        LocalExecution.with("sudo touch #{filename} && " \
                            "sudo chmod u+rw #{filename} && " \
                            "sudo chown #{ENV['USER']} #{filename}",
                            [], { :b_sudo => false, :b_shell => true }) do |up_exec_obj|
          up_exec_obj.run
        end
        $log.debug("(Over-)writing #{filename}")
        File.open(filename, 'w') do |file|
          file.puts "dhcp-range=#{@network_name},#{@address_start},#{@address_end}"
        end
        restart_dnsmasq
      rescue => exception
        $log.error("Error writign dnsmasq config file/restarting dnsmasq, #{exception}")
        return false
      end
def up filename = create_dnsmaqs_config_filename LocalExecution . with ( "sudo touch #{filename} && " "sudo chmod u+rw #{filename} && " "sudo chown #{ENV['USER']} #{filename}" , [ ] , { :b_sudo => false , :b_shell => true } ) do | up_exec_obj | up_exec_obj . run end $log . debug ( "(Over-)writing #{filename}" ) File . open ( filename , 'w' ) do | file | file . puts "dhcp-range=#{@network_name},#{@address_start},#{@address_end}" end restart_dnsmasq rescue => exception $log . error ( "Error writign dnsmasq config file/restarting dnsmasq, #{exception}" ) return false end
creates the configuration and restarts dnsmasq
creates the configuration and restarts dnsmasq
# use sudo'ed touch/chmod to create us the file we need # TODO: add netmask