Can't get vm name in automation.log


#1

If I execute below command in rails console

 $evm.vmdb('vm').find_each.each { |x| $evm.log(:info, "#{x.name}") }

I see following output(truncated)

[----] I, [2016-08-26T11:15:56.187777 #11788:113d994] INFO – : cfme002
[----] I, [2016-08-26T11:15:56.187860 #11788:113d994] INFO – : changeme
[----] I, [2016-08-26T11:15:56.187972 #11788:113d994] INFO – : vm045
[----] I, [2016-08-26T11:15:56.188100 #11788:113d994] INFO – : pico
[----] I, [2016-08-26T11:15:56.188199 #11788:113d994] INFO – : vm046
[----] I, [2016-08-26T11:15:56.188288 #11788:113d994] INFO – : vm051

But if I execute using an automated method, I get,

[----] I, [2016-08-26T11:49:10.719972 #9099:771b6f8] INFO – : ManageIQ
[----] I, [2016-08-26T11:49:10.722004 #9099:771b6f8] INFO – : ManageIQ
[----] I, [2016-08-26T11:49:10.723928 #9099:771b6f8] INFO – : ManageIQ
[----] I, [2016-08-26T11:49:10.725927 #9099:771b6f8] INFO – : ManageIQ
[----] I, [2016-08-26T11:49:10.727908 #9099:771b6f8] INFO – : ManageIQ
[----] I, [2016-08-26T11:49:10.729907 #9099:771b6f8] INFO – : ManageIQ
[----] I, [2016-08-26T11:49:10.731831 #9099:771b6f8] INFO – : ManageIQ
[----] I, [2016-08-26T11:49:10.733801 #9099:771b6f8] INFO – : ManageIQ
[----] I, [2016-08-26T11:49:10.735674 #9099:771b6f8] INFO – : ManageIQ

Am I missing something?


#2

@psachin - Can you post the automate method that isn’t giving the log output?


#3

The automate method is just one line

 $evm.vmdb('vm').find_each.each { |x| $evm.log(:info, "#{x.name}") }

#4

It should work when pulling out the .find_each method and replacing that with .all.

$evm.vmdb('vm').all.each { |x| $evm.log(:info, "#{x.name}") }


#5

Yes, it worked. I forgot to update the thread