lib/roku_builder/plugins/profiler.rb in roku_builder-4.25.5 vs lib/roku_builder/plugins/profiler.rb in roku_builder-4.25.6

- old
+ new

@@ -60,14 +60,17 @@ end @connection.close if @connection end def sgperf(options:) - telnet_config ={ - 'Host' => @roku_ip_address, - 'Port' => 8080 - } + telnet_config = nil + get_device(no_lock: true) do |device| + telnet_config ={ + 'Host' => device.ip, + 'Port' => 8080 + } + end @connection = Net::Telnet.new(telnet_config) @connection.puts("sgperf clear\n") @connection.puts("sgperf start\n") start_reg = /thread/ end_reg = /#{SecureRandom.uuid}/ @@ -95,14 +98,17 @@ @connection.close if @connection end end def devlog(options:) - telnet_config ={ - 'Host' => @roku_ip_address, - 'Port' => 8080 - } + telnet_config = nil + get_device(no_lock: true) do |device| + telnet_config ={ + 'Host' => device.ip, + 'Port' => 8080 + } + end connection = Net::Telnet.new(telnet_config) connection.puts("enhanced_dev_log #{options[:devlog]} #{options[:devlog_function]}\n") end def node_tracking(options:) @@ -170,11 +176,11 @@ end def handle_node(stats:, node:) if node node.element_children.each do |element| - attributes = element.attributes.map{|attr| {"#{attr.name}": attr.value}}.reduce({}, :merge) + attributes = element.attributes.map{|key,attr| {"#{key}": attr.value}}.reduce({}, :merge) stats[element.name] ||= {count: 0, ids: []} stats[element.name][:count] += 1 stats[element.name][:ids].push(attributes[:name]) if attributes[:name] stats["Total"][:count] += 1 handle_node(stats: stats, node: element) @@ -215,12 +221,12 @@ end_reg = /<\/Root_Nodes>/ lines = get_command_response(command: "sgnodes roots", start_reg: start_reg, end_reg: end_reg) lines.each {|line| print line} end def print_nodes_by_id(id) - start_reg = /<#{id}>/ - end_reg = /<\/#{id}>/ + start_reg = /#{id}/ + end_reg = /#{id}/ lines = get_command_response(command: "sgnodes #{id}", start_reg: start_reg, end_reg: end_reg) lines.each {|line| print line} end def print_image_information start_reg = /RoGraphics instance/ @@ -257,13 +263,16 @@ waitfor_config = { 'Match' => /.+/, 'Timeout' => 1 } unless @connection - telnet_config ={ - 'Host' => @roku_ip_address, - 'Port' => 8080 - } + telnet_config = nil + get_device(no_lock: true) do |device| + telnet_config ={ + 'Host' => device.ip, + 'Port' => 8080 + } + end @connection = Net::Telnet.new(telnet_config) end @lines = [] @all_txt = ""