Project

General

Profile

Bug #13346

provider native_ms - use of '.each_line' on array breakes smart proxy

Added by Daniel Helgenberger over 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
High
Category:
DHCP
Target version:

Description

Issue #7766 uses .each_line instead of .each on an array.

I could not find where this got merged; since
https://github.com/theforeman/smart-proxy/pull/294
is still open.

At least with ruby 2.0, .readlines seems to become an array:

std_in, std_out, std_err  = Open3.popen3(command)
response  = std_out.readlines
response += std_err.readlines

https://github.com/theforeman/smart-proxy/blob/1.10-stable/modules/dhcp/providers/server/native_ms.rb#L211

Using each_line will result in a no method error:

D, [2016-01-23T00:23:58.253684 #3068] DEBUG -- : Loading subnets for 127.0.0.1
D, [2016-01-23T00:23:58.253684 #3068] DEBUG -- : executing: c:\windows\system32\cmd.exe /c c:\Windows\System32\netsh.exe -c dhcp server 127.0.0.1 show scope
I, [2016-01-23T00:23:58.331907 #3068]  INFO -- : Enumerated the scopes on 127.0.0.1
E, [2016-01-23T00:23:58.331907 #3068] ERROR -- : undefined method `each_line' for #<Array:0x00000000a5b090>
D, [2016-01-23T00:23:58.347502 #3068] DEBUG -- : C:/TheForeman/smart-proxy/modules/dhcp/providers/server/native_ms.rb:184:in `find_all_subnets'
C:/TheForeman/smart-proxy/modules/dhcp/providers/server/native_ms.rb:197:in `loadSubnets'
C:/TheForeman/smart-proxy/modules/dhcp/dhcp_api.rb:29:in `block in <class:DhcpApi>'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:in `block in compile!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1014:in `[]'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1014:in `block in process_route'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:in `catch'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:in `process_route'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:965:in `block in filter!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:965:in `each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:965:in `filter!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1083:in `block in dispatch!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `block in invoke'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `catch'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `invoke'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1081:in `dispatch!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in `block in call!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `block in invoke'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `catch'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `invoke'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in `call!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:894:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/methodoverride.rb:21:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/commonlogger.rb:33:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:218:in `call'
C:/TheForeman/smart-proxy/lib/proxy/log.rb:58:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/nulllogger.rb:9:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/head.rb:11:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/show_exceptions.rb:21:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:181:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:2021:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in `block in call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1795:in `synchronize'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/builder.rb:138:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/urlmap.rb:65:in `block in call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/urlmap.rb:50:in `each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/urlmap.rb:50:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/builder.rb:138:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/handler/webrick.rb:60:in `service'
C:/Ruby200-x64/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
C:/Ruby200-x64/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

Associated revisions

Revision 35d9fb35 (diff)
Added by Daniel Helgenberger over 3 years ago

Fixes #13346 - use of .each_line on array

History

#1 Updated by The Foreman Bot over 3 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/smart-proxy/pull/365 added

#2 Updated by Dominic Cleal over 3 years ago

  • Project changed from Foreman to Smart Proxy
  • Subject changed from [smart-proxy]: provider native_ms - use of '.each_line' on array breakes smart proxy to provider native_ms - use of '.each_line' on array breakes smart proxy
  • Category changed from DHCP to DHCP
  • Legacy Backlogs Release (now unused) deleted (71)

#3 Updated by The Foreman Bot over 3 years ago

  • Pull request https://github.com/theforeman/smart-proxy/pull/366 added

#4 Updated by Anonymous over 3 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Dominic Cleal over 3 years ago

  • Assignee set to Daniel Helgenberger
  • Legacy Backlogs Release (now unused) set to 123

#6 Updated by The Foreman Bot over 3 years ago

  • Pull request https://github.com/theforeman/smart-proxy/pull/388 added

Also available in: Atom PDF