Opennebula 5.8.4: "onedb purge-done" error

Please, describe the problem here and provide additional information below (if applicable) …

$ onedb purge-done
each_page
["/usr/lib/one/ruby/onedb/onedb_live.rb:218:in `purge_done_vm'",
 "/bin/onedb:514:in `block (2 levels) in '",
 "/usr/lib/one/ruby/cli/command_parser.rb:470:in `call'",
 "/usr/lib/one/ruby/cli/command_parser.rb:470:in `run'",
 "/usr/lib/one/ruby/cli/command_parser.rb:84:in `initialize'",
 "/bin/onedb:302:in `new'",
 "/bin/onedb:302:in `'"]


Versions of the related components and OS (frontend, hypervisors, VMs):

# cat /etc/*release
CentOS Linux release 7.6.1810 (Core)
# ruby  -v
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]

Steps to reproduce:

Current results:

Expected results:

Hello @telecast

Could you please execute the following command ruby -wd onedb purge-done?

Note: before executing it, you should go to bin directory cd /usr/bin.

Hello @ahuertas

Thank for your response.

STDOUT :

bin]# ruby -wd onedb purge-done
Exception `LoadError' at /usr/share/rubygems/rubygems.rb:1097 - cannot load such file -- rubygems/defaults/ruby
Exception `LoadError' at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- abrt
Exception `LoadError' at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:141 - cannot load such file -- abrt
onedb:302: warning: assigned but unused variable - cmd
/usr/lib/one/ruby/cli/command_parser.rb:455: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/cli/command_parser.rb:517: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/cli/command_parser.rb:520: warning: shadowing outer local variable - e
/usr/lib/one/ruby/cli/command_parser.rb:528: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/cli/command_parser.rb:545: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/cli/command_parser.rb:564: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/cli/command_parser.rb:596: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/onedb/onedb.rb:32: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/onedb/onedb.rb:42: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/onedb/onedb.rb:214: warning: assigned but unused variable - i
/usr/lib/one/ruby/onedb/onedb_backend.rb:28: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/onedb/onedb_backend.rb:91: warning: assigned but unused variable - comment
/usr/lib/one/ruby/onedb/onedb_backend.rb:129: warning: assigned but unused variable - query
Exception `LoadError' at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- sequel
/usr/local/share/gems/gems/sequel-5.17.0/lib/sequel/dataset/query.rb:84: warning: statement not reached
/usr/lib/one/ruby/onedb/onedb_live.rb:191: warning: shadowing outer local variable - seq
/usr/lib/one/ruby/onedb/onedb_live.rb:364: warning: shadowing outer local variable - e
/usr/lib/one/ruby/onedb/onedb_live.rb:418: warning: shadowing outer local variable - e
/usr/lib/one/ruby/onedb/onedb_live.rb:461: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/onedb/onedb_live.rb:530: warning: assigned but unused variable - federate
/usr/lib/one/ruby/opennebula/xml_utils.rb:94: warning: `-' after local variable is interpreted as binary operator
/usr/lib/one/ruby/opennebula/xml_utils.rb:94: warning: even though it seems like unary operator
Exception `LoadError' at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- nokogiri
Exception `LoadError' at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- nokogiri/2.0/nokogiri
Exception `LoadError' at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:141 - cannot load such file -- nokogiri/2.0/nokogiri
Exception `LoadError' at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- ox
Exception `LoadError' at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- xmlparser
Exception `LoadError' at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:141 - cannot load such file -- xmlparser
/usr/lib/one/ruby/opennebula/virtual_machine.rb:715: warning: mismatched indentations at 'end' with 'def' at 713
/usr/lib/one/ruby/opennebula/virtual_machine_pool.rb:338: warning: assigned but unused variable - acct_hash
/usr/lib/one/ruby/opennebula/host.rb:137: warning: ambiguous first argument; put parentheses or even spaces
Exception `NameError' at /usr/share/ruby/psych/core_ext.rb:16 - method `to_yaml' not defined in Object
Exception `NameError' at /usr/share/ruby/psych/core_ext.rb:29 - method `yaml_as' not defined in Module
Exception `NameError' at /usr/share/ruby/psych/deprecated.rb:81 - undefined method `to_yaml_properties' for class `Object'
/usr/lib/one/ruby/opennebula/vdc.rb:176: warning: method redefined; discarding old add_host
/usr/lib/one/ruby/opennebula/vdc.rb:164: warning: previous definition of add_host was here
/usr/lib/one/ruby/opennebula/vdc.rb:192: warning: method redefined; discarding old del_host
/usr/lib/one/ruby/opennebula/vdc.rb:186: warning: previous definition of del_host was here
/usr/lib/one/ruby/cli/one_helper.rb:663: warning: mismatched indentations at 'end' with 'if' at 659
/usr/lib/one/ruby/cli/one_helper.rb:603: warning: assigned but unused variable - ps
/usr/lib/one/ruby/cli/one_helper.rb:682: warning: assigned but unused variable - ps
/usr/lib/one/ruby/cli/one_helper.rb:933: warning: assigned but unused variable - desc
/usr/lib/one/ruby/cli/one_helper.rb:1139: warning: assigned but unused variable - st
/usr/lib/one/ruby/cli/one_helper.rb:1183: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/cli/one_helper.rb:1206: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/cli/one_helper.rb:1254: warning: mismatched indentations at 'end' with 'if' at 1250
/usr/lib/one/ruby/cli/one_helper.rb:1589: warning: shadowing outer local variable - res
/usr/lib/one/ruby/cli/cli_helper.rb:357: warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/one/ruby/cli/cli_helper.rb:387: warning: assigned but unused variable - e
/usr/lib/one/ruby/cli/cli_helper.rb:399: warning: ambiguous first argument; put parentheses or even spaces
Exception `NoMethodError' at /usr/lib/one/ruby/onedb/onedb_live.rb:218 - undefined method `each_page' for #
each_page
["/usr/lib/one/ruby/onedb/onedb_live.rb:218:in `purge_done_vm'",
 "onedb:514:in `block (2 levels) in '",
 "/usr/lib/one/ruby/cli/command_parser.rb:470:in `call'",
 "/usr/lib/one/ruby/cli/command_parser.rb:470:in `run'",
 "/usr/lib/one/ruby/cli/command_parser.rb:84:in `initialize'",
 "onedb:302:in `new'",
 "onedb:302:in `'"]

Hello @telecast

It seems you don’t have the correct onedb_live file, did you update via public packages or compiling yourself?

Hello @ahuertas

By myself compiling by use this repo https://github.com/OpenNebula/packages
My steps:

```
git clone https://github.com/OpenNebula/one opennebula-X.Y.Z
cd opennebula-X.Y.Z
git checkout tags/release-X.Y.Z

# manual pages
cd share/man
./build.sh
cd ../../

# sunstone
cd  src/sunstone/public
./build.sh -d
export PATH=$PATH:$PWD/node_modules/.bin
./build.sh
rm -rf node_modules/
cd ../../../../

tar -czf opennebula-X.Y.Z.tar.gz opennebula-X.Y.Z/
cd packages/
./centos7.sh ../opennebula-X.Y.Z.tar.gz
```

It seams that function each_page is missing in pool.rb. Could you please check the file /usr/lib/one/ruby/opennebula/pool.rb and find the funcion each_page?

Yes you are right, I can’t find this function:

]# less /usr/lib/one/ruby/opennebula/pool.rb | grep each_page
]#

The changes were done in this commit. So check it and add the missing method.

@ahuertas

Thank you for link to commit, now “onedb purge-done” it’s work correctly!
Solved

That’s perfect!