1
votes

Using Windows 10E ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32] puma v 2.13.4

I'm a HUGE PUMA noob, so please excuse me. I know code (python, php, just not rails, ruby)

So, I'm trying to revive an old project my buddy dumped off to me. I've been working at this for 12+ hours and I've come a long way, but I can't get past this error...and I'm afraid the resolution is gonna be out of my league, but I'll give it a shot:

When I try to launch the application, I get this error:

C:\inetpub\wwwroot\Plex-Board>sh runserver.sh * SIGUSR2 not implemented, signal based restart unavailable! * SIGUSR1 not implemented, signal based restart unavailable! *** SIGHUP not implemented, signal based logs reopening unavailable! Puma starting in single mode...

Version 2.13.4 (ruby 2.3.3-p222), codename: A Midsummer Code's Dream Min threads: 0, max threads: 16 Environment: production ! Unable to load application: NameError: uninitialized constant Service::Resolv C:/inetpub/wwwroot/Plex-Board/app/models/service.rb:14:in class:Service': uninitialized constant Service::Resolv (NameError) from C:/inetpub/wwwroot/Plex-Board/app/models/service.rb:1:in' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/engine.rb:472:in block (2 levels) in eager_load!' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/engine.rb:471:ineach' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/engine.rb:471:in block in eager_load!' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/engine.rb:469:ineach' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/engine.rb:469:in eager_load!' from C:ineager_load!' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/application/finisher.rb:56:in each' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/application/finisher.rb:56:inblock in module:Finisher' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/initializable.rb:30:in instance_exec' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/initializable.rb:30:inrun' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/initializable.rb:55:in block in run_initializers' from C:/Ruby23/lib/ruby/2.3.0/tsort.rb:228:inblock in tsort_each' from C:/Ruby23/lib/ruby/2.3.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component' from C:/Ruby23/lib/ruby/2.3.0/tsort.rb:431:ineach_strongly_connected_component_from' from C:/Ruby23/lib/ruby/2.3.0/tsort.rb:349:in block in each_strongly_connected_component' from C:/Ruby23/lib/ruby/2.3.0/tsort.rb:347:ineach' from C:/Ruby23/lib/ruby/2.3.0/tsort.rb:347:in call' from C:/Ruby23/lib/ruby/2.3.0/tsort.rb:347:ineach_strongly_connected_component' from C:/Ruby23/lib/ruby/2.3.0/tsort.rb:226:in tsort_each' from C:/Ruby23/lib/ruby/2.3.0/tsort.rb:205:intsort_each' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/initializable.rb:54:in run_initializers' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/application.rb:352:ininitialize!' from C:/inetpub/wwwroot/Plex-Board/config/environment.rb:5:in ' from C:/Ruby23/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire' from C:/Ruby23/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from config.ru:3:inblock in ' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/puma-2.13.4/lib/puma/rack/builder.rb:184:in instance_eval' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/puma-2.13.4/lib/puma/rack/builder.rb:184:ininitialize' from config.ru:in new' from config.ru:in' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/puma-2.13.4/lib/puma/rack/builder.rb:170:in eval' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/puma-2.13.4/lib/puma/rack/builder.rb:170:innew_from_string' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/puma-2.13.4/lib/puma/rack/builder.rb:161:in parse_file' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/puma-2.13.4/lib/puma/configuration.rb:129:inload_rackup' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/puma-2.13.4/lib/puma/configuration.rb:96:in app' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/puma-2.13.4/lib/puma/runner.rb:113:inload_and_bind' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/puma-2.13.4/lib/puma/single.rb:79:in run' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/puma-2.13.4/lib/puma/cli.rb:215:inrun' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/puma-2.13.4/bin/puma:10:in ' from C:/Ruby23/bin/puma:22:inload' from C:/Ruby23/bin/puma:22:in `'

The file in question ( C:/inetpub/wwwroot/Plex-Board/app/models/service.rb) has this line in it:


class Service < ActiveRecord::Base belongs_to :service_flavor, polymorphic: :true # before_destroy :destroy_associated after_initialize :init

attr_accessor :timeout
strip_attributes only: [:ip, :url, :dns_name], collapse_spaces: true

validates_associated :service_flavor
validates :name, presence: true, uniqueness: true, allow_blank: false
validates :url, presence: true, uniqueness: true, allow_blank: false
validates_inclusion_of :port, in: 1..65535
validates :ip, length: { minimum: 7, maximum: 45 },
    format: { with: Resolv::IPv4::Regex },
    uniqueness: { scope: :port }, allow_blank: true
validates :dns_name, length: { minimum: 2, maximum: 127 },
    uniqueness: { scope: :port }, allow_blank: true
validates :ip, presence: true, if: (:ip_and_dns_name_dont_exist)
validates :dns_name, presence: true, if: (:ip_and_dns_name_dont_exist)

def init
  @timeout ||= 5
  self.online_status ||= false
end

def ip_and_dns_name_dont_exist
    if (ip.blank? || ip.to_s.empty?) && (dns_name.blank? || dns_name.to_s.empty?)
        self.errors.add(:base, 'IP Address or DNS Name must exist')
        true
    else
        false
    end
end

def ping ping_destination = connect_method begin Timeout.timeout(@timeout) do s = TCPSocket.new(ping_destination, self.port) s.close self.update(online_status: true, last_seen: Time.now) return true end rescue Errno::ECONNREFUSED self.update(online_status: true, last_seen: Time.now) return true rescue Timeout::Error, Errno::ENETUNREACH, Errno::EHOSTUNREACH, SocketError self.update(online_status: false) return false end end

def connect_method if !self.dns_name.blank? self.dns_name else self.ip end end end


I can guess what this code does, but I'm not sure how to fix it or even if it's possible to fix.

Sooo, any ideas?

1
can you paste the model service.rbDias
@dias - Edited the OP.Sean Vreeland
where is this module or class defined Resolv::IPv4::Regex ?Dias
Please try with the answer I wroteDias

1 Answers

0
votes

Try in rails console, to check this class is loaded or not

Resolv::IPv4::Regex.

If not then you should need to add

gem 'rubysl-resolv'

in your Gemfile and then bundle install