Bug 1302783 - ERROR -- : Method STDERR: -:53: warning: wrong element type nil at 0 (expected array)
ERROR -- : Method STDERR: -:53: warning: wrong element type nil at 0 (expecte...
Status: CLOSED NOTABUG
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate (Show other bugs)
5.5.0
All All
unspecified Severity medium
: GA
: 5.6.0
Assigned To: Greg McCullough
Dave Johnson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-28 10:43 EST by Kevin Morey
Modified: 2016-01-28 14:49 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-01-28 14:05:21 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Kevin Morey 2016-01-28 10:43:09 EST
Description of problem:
When trying to collect $evm.root attributes into a Hash a STDERR message is thrown into the automation.log. I did not see this message in cfme 5.4 so something has changed to cause this to happen. If this is due to a deprecation error then i am open to a work-around. 


Version-Release number of selected component (if applicable):
5.5.2.1

How reproducible:
100%

Steps to Reproduce:
1. Using simulation run the following:

dialog_add_disks_hash = Hash[$evm.root.attributes.sort.collect do |k, v| [k, v] if k.kind_of?(String) && k.starts_with?('dialog_add_disk') }]
puts "#{dialog_add_disks_hash}"

2.
3.

Actual results:
STDERR is thrown

Expected results:
No errors

Additional info:
[----] E, [2016-01-28T01:14:08.439391 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: wrong element type nil at 0 (expected array)
[----] E, [2016-01-28T01:14:08.439516 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: ignoring wrong elements is deprecated, remove them explicitly
[----] E, [2016-01-28T01:14:08.439594 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: this causes ArgumentError in the next release
[----] E, [2016-01-28T01:14:08.439692 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: wrong element type nil at 1 (expected array)
[----] E, [2016-01-28T01:14:08.439801 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: ignoring wrong elements is deprecated, remove them explicitly
[----] E, [2016-01-28T01:14:08.439880 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: this causes ArgumentError in the next release
[----] E, [2016-01-28T01:14:08.439983 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: wrong element type nil at 2 (expected array)
[----] E, [2016-01-28T01:14:08.440091 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: ignoring wrong elements is deprecated, remove them explicitly
[----] E, [2016-01-28T01:14:08.440318 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: this causes ArgumentError in the next release
[----] E, [2016-01-28T01:14:08.440401 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: wrong element type nil at 3 (expected array)
[----] E, [2016-01-28T01:14:08.440487 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: ignoring wrong elements is deprecated, remove them explicitly
[----] E, [2016-01-28T01:14:08.440567 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: this causes ArgumentError in the next release
[----] E, [2016-01-28T01:14:08.440641 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: wrong element type nil at 4 (expected array)
[----] E, [2016-01-28T01:14:08.440717 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: ignoring wrong elements is deprecated, remove them explicitly
[----] E, [2016-01-28T01:14:08.440816 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: this causes ArgumentError in the next release
[----] E, [2016-01-28T01:14:08.440892 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: wrong element type nil at 5 (expected array)
[----] E, [2016-01-28T01:14:08.441004 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: ignoring wrong elements is deprecated, remove them explicitly
[----] E, [2016-01-28T01:14:08.441096 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: this causes ArgumentError in the next release
[----] E, [2016-01-28T01:14:08.441177 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: wrong element type nil at 6 (expected array)
[----] E, [2016-01-28T01:14:08.441252 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: ignoring wrong elements is deprecated, remove them explicitly
[----] E, [2016-01-28T01:14:08.441441 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: this causes ArgumentError in the next release
[----] E, [2016-01-28T01:14:08.441518 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: wrong element type nil at 7 (expected array)
[----] E, [2016-01-28T01:14:08.441592 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: ignoring wrong elements is deprecated, remove them explicitly
[----] E, [2016-01-28T01:14:08.441679 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: this causes ArgumentError in the next release
[----] E, [2016-01-28T01:14:08.441773 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: wrong element type nil at 8 (expected array)
[----] E, [2016-01-28T01:14:08.441848 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: ignoring wrong elements is deprecated, remove them explicitly
[----] E, [2016-01-28T01:14:08.441945 #3049:a38ef3c] ERROR -- : Method STDERR: -:53: warning: this causes ArgumentError in the next release
Comment 2 Greg McCullough 2016-01-28 14:05:21 EST
The change is that STDERR is now being logged.  The error is with the script logic which will produce the same errors if you running it in the rails console. (with minor tweaks to replace $evm with a usable hash for testing.)

Here is an example of how you can rewrite the method to avoid the errors:

dialog_add_disks_hash = $evm.root.attributes.sort.each_with_object({}) do |(k, v), h|
  h[k] = v if k.kind_of?(String) && k.starts_with?('dialog_add_disk')
do
puts "#{dialog_add_disks_hash.inspect}"


Also I do not think the sort is required and if so it could be done after on the shorter filtered list of items.  In place of the "kind_of?" check you can replaced it with a simple ".to_s" call as in this version:

dialog_add_disks_hash = $evm.root.attributes.each_with_object({}) do |(k, v), h|
  h[k] = v if k.to_s.starts_with?('dialog_add_disk')
end
puts "#{dialog_add_disks_hash.inspect}"

Note You need to log in before you can comment on or make changes to this bug.