Removed two dockerfiles, which I wrongly added with my previous commit. See Removed Dockerfiles which I used for testing
Investigating whether it is possible to test all the bin/yus_* commands without using a persistent storage. E.g. bbmb has a file lib/bbmb/persistence/none.rb. Would such an approach also work with yus? Oh yes! There is a file lib/yus/persistence/og.rb which seems to achieve exactly this. But I cannot find anywhere a implementation of Og (google found only http://scm.ywesee.com/?p=ch.oddb.org/.git;a=patch;h=refs/tags/0.9). But I think it should not be too difficult to write an mock implementation. But may be it would be easier to use/revive sqlite3 as a backend for odba for unit tests. Or use ruby YAML::Store to use a simple to debug yml file. Abandoning the idea to write unit tests for the moment.
But running /usr/local/bin/yus_show --server_url=druby://localhost:12005 ngiger@ywesee.com
still access the default yusd on port 9997 and not the yusd for bbmb running at port 12005. Why? Fixed the problem. Found more problems which were fixed by commit Fixed error running yus_show, yus_dump and yus_passwd
After reloading the sandoz_yus-2016-05-17-backup.gz I get the following error in /service/sandoz.bbmb.ch-yus/log/main/current
@400000005744258a2217a364 /usr/local/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `initialize' may cause serious problems @400000005744258a2217d244 /usr/local/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `object_id' may cause serious problems @400000005744258a2217d62c /usr/local/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `__send__' may cause serious problems @400000005744258a23a655cc FEHLER: Relation »object« existiert bereits @400000005744258a23ad56c4 FEHLER: Relation »prefetchable_index« existiert bereits @400000005744258a23b2d8ec FEHLER: Relation »extent_index« existiert bereits @400000005744258a23b6ad64 FEHLER: Relation »object_connection« existiert bereits @400000005744258a23bbf4f4 FEHLER: Relation »target_id_index« existiert bereits @400000005744258a23be90ec FEHLER: Relation »collection« existiert bereits @400000005744258a2513822c /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/marshal.rb:15:in `load': undefined class/module Encoding::Character:: (ArgumentError) @400000005744258a25140ecc from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/marshal.rb:15:in `load' @400000005744258a251412b4 from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:629:in `restore' @400000005744258a251412b4 from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:319:in `block in fetch_or_restore' @400000005744258a2514169c from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:314:in `fetch_or_do' @400000005744258a2514169c from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:318:in `fetch_or_restore' @400000005744258a25142254 from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:66:in `block in bulk_restore' @400000005744258a25142254 from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:63:in `each' @400000005744258a2514263c from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:63:in `bulk_restore' @400000005744258a2514263c from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:57:in `bulk_fetch' @400000005744258a25144d4c from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:261:in `fetch_collection' @400000005744258a25145134 from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:633:in `restore' @400000005744258a25145134 from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:319:in `block in fetch_or_restore' @400000005744258a251460d4 from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:314:in `fetch_or_do' @400000005744258a251460d4 from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:318:in `fetch_or_restore' @400000005744258a251464bc from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:305:in `block in fetch_named' @400000005744258a251464bc from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:314:in `fetch_or_do' @400000005744258a25146c8c from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:297:in `fetch_named' @400000005744258a25146c8c from /usr/local/lib/ruby/gems/2.3.0/gems/yus-1.0.3/lib/yus/persistence/odba.rb:14:in `initialize' @400000005744258a25147074 from /usr/local/lib/ruby/gems/2.3.0/gems/yus-1.0.3/bin/yusd:54:in `new' @400000005744258a25147074 from /usr/local/lib/ruby/gems/2.3.0/gems/yus-1.0.3/bin/yusd:54:in `<top (required)>' @400000005744258a25147844 from /usr/local/bin/yusd:23:in `load' @400000005744258a25147844 from /usr/local/bin/yusd:23:in `<main>'
Looks like I have to migrate the YUS database, too. Changed bin/yus_dump to use a root session to dump all entities. Some of them contain UTF-8 characters (e.g. adresses like Zürich). But migration still failes with
2016-05-24 15:00:36 +0200: Loading /mnt/src/yus/bin/migrate_to_utf_8 Ignoring ffi-1.9.10 because its extensions are not built. Try: gem pristine ffi --version 1.9.10 Ignoring byebug-8.2.4 because its extensions are not built. Try: gem pristine byebug --version 8.2.4 Ignoring ffi-1.9.10 because its extensions are not built. Try: gem pristine ffi --version 1.9.10 /usr/local/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `initialize' may cause serious problems /usr/local/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `object_id' may cause serious problems /usr/local/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `__send__' may cause serious problems FEHLER: Relation �object� existiert bereits FEHLER: Relation �prefetchable_index� existiert bereits FEHLER: Relation �extent_index� existiert bereits FEHLER: Relation �object_connection� existiert bereits FEHLER: Relation �target_id_index� existiert bereits FEHLER: Relation �collection� existiert bereits I, [2016-05-24T15:00:37.715842 #30527] INFO -- Yus::Server: Authentication succeeded for root: ngiger@ywesee.com 2016-05-24 15:00:37 +0200: Start migrating 587 entities FEHLER: Relation �object� existiert bereits FEHLER: Relation �prefetchable_index� existiert bereits FEHLER: Relation �extent_index� existiert bereits FEHLER: Relation �object_connection� existiert bereits FEHLER: Relation �target_id_index� existiert bereits FEHLER: Relation �collection� existiert bereits 149: ignoring Yus::Privilege force_encoding from ISO_8859_1 ASCII-8BIT. is now regulabinder@sunrise.ch force_encoding from ISO_8859_1 ASCII-8BIT. is now edc52c3c210992fdc5c6b0ec21bd10a3c8a52e1b3c45a8cc2867bbb1afd7699a 149: ignoring Hash marshal.rb:10 obj #<Yus::Entity:0x0000000161c898 @odba_observers=nil, @odba_persistent=true, @privileges={"set_password"=>#<Yus::Privilege:0x000000027be358 @items={"regulabinder@sunrise.ch"=>:never}>}, @affiliations=#<ODBA::Stub:11574560#1184 @odba_class=Array @odba_container=11592780#433>, @valid_from=2008-10-17 23:27:53 +0200, @last_logins={"oddb.org"=>2008-10-17 23:27:55 +0200}, @name="regulabinder@sunrise.ch", @valid_until=nil, @passhash="edc52c3c210992fdc5c6b0ec21bd10a3c8a52e1b3c45a8cc2867bbb1afd7699a", @odba_id=433, @preferences={"oddb.org"=>{:name_last=>"Binder", :salutation=>"salutation_f", :name_first=>"Regula"}, "global"=>{}}, @tokens={}> /usr/local/lib/ruby/2.3.0/drb/drb.rb:393:in `_dump': can't dump (TypeError) from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/marshal.rb:12:in `dump' from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/marshal.rb:12:in `dump' from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/persistable.rb:269:in `odba_isolated_dump' from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/cache.rb:511:in `store' from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/persistable.rb:274:in `odba_isolated_store' from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/persistable.rb:395:in `block in odba_store_unsaved' from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/persistable.rb:392:in `each' from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/persistable.rb:392:in `odba_store_unsaved' from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/persistable.rb:380:in `odba_store' from /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.2/lib/odba/drbwrapper.rb:28:in `method_missing' from /mnt/src/yus/bin/migrate_to_utf_8:73:in `_migrate_to_utf8' from /mnt/src/yus/bin/migrate_to_utf_8:171:in `<main>'
Why the hell is it impossible to save the changed entity? Or shall I create a yus_load which could load the UTF-8 yaml file generated by yus_dump?
Trying to run yus with Ruby 1.8.6 again. This does not work as I no longer have a gem186 command laying around. And gem was not compiled when compiling ruby 1.8.6.
Trying rbenv install 1.8.6-p383 and rbenv install 1.8.6-p420. Following instructions by zdavatz https://github.com/rbenv/ruby-build/issues/88 to compile
wget http://www.openssl.org/source/openssl-0.9.8zb.tar.gz tar xzf openssl-0.9.8zb.tar.gz cd openssl-0.9.8zb ./config --prefix=/usr/local make make install CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" \ RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/bin" \ MAKEOPTS="" rbenv install 1.8.6-p420
Also on thinpower I am no longer able to list all the 1.8.6 gems as I get
ywesee@thinpower ~ $ gem186 list /usr/local/bin/gem186:8:in `require': no such file to load -- rubygems (LoadError) from /usr/local/bin/gem186:8
Now using in /usr/local/src/yus18 rbenv local 1.8.6-p420
, gem install yus --version=1.0.0
, gem install rclconf
, gem install odba --version=1.0.0
, gem install dbi --version=0.4.5
. But dbi must point to our special version of (ydbi) or a the git checkout. I think I must add these into the site_ruby of the rbenv and show how I can use rbenv safely inside the apache user.
TODO: for tomorrow.