Continue work to see why the auto_session login does not work. Adapting my enviornment to be able to run the old virbac and the new virbac in two different directories to enable useage of pry. The two directories under /var/www allow me to start
sudo -u bbmb /usr/local/bin/bundle-240 exec /usr/local/bin/ruby-240 -I/var/www/virbac.bbmb.ch/lib -rydim/invoice /usr/local/bin/bbmbd config=/var/www/virbac.bbmb.ch/etc/config.yml
.
sudo -u bbmb /usr/local/bin/bundle-240 exec rackup
Both use the same YUSD (Ruby 2.4.0, yus 1.0.4 using config=/var/www/virbac.bbmb.ch/etc/yus.yml).
After adding an auth attribute to the SBSM::App class an initializing it correctly. I get a little further. Error is now that I cannot connect to YUS on port 12001 which is for sandoz. Therefore a read from a wrong config file. And the default value specified in bmb/lib/bbmb/config.rb as 'auth_url' => 'druby://localhost:12001'
. Therefore loading is config is not yet done.
Added loading the etc/config.yml to config.ru and now I get connected to right YUS server and the login with admin works. However serving localhost/de/bbmb fails. Must use the virbac_rack.ngiger.ch as hostname. Fixed bbmb/lib/bbmb/html/util/session.rb to use the config variable http_server to set the SERVER_NAME as default. This took me little further, but it was easier to reconfigure Apache to redirect traffice to virbac_rack.ngiger.ch to the port 8008 of the rack based virbac app.
Now I am again at the problem that BBMB::Html::State::Login#login does not work, as seen by this pry snippet
[4] pry(#<BBMB::Html::State::Login>)> reconsider_permissions(@session.login) session.rb:24:in `login' BBMB::Html::Util::Session login claude.meier@gmx.net 5972659ce6c7f9b2356c0e650c7c40a3 ArgumentError: wrong number of arguments (given 2, expected 3) from (druby://virbac.bbmb.ngiger.ch:12003) /usr/local/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/yus-1.0.4/lib/yus/server.rb:24:in `login'
Looks we are not using the right login method (In bbmb/lib/bbmb/html/util/session.rb:25) we use @app.auth.login(user_input(:email), user_input(:pass)). Two changed lines in bbmb/lib/bbmb/html/util/session.rb were wrong. Reverted the changes. Now I get
session.rb:24:in `login' BBMB::Html::Util::Session login claude.meier@gmx.net 5972659ce6c7f9b2356c0e650c7c40a3 session.rb:244:in `rescue in process_rack' Error in process_rack /home/niklaus/git/sbsm/lib/sbsm/session.rb:144:in `method_missing' /home/niklaus/git/bbmb/lib/bbmb/html/util/known_user.rb:45:in `remote_call' /home/niklaus/git/bbmb/lib/bbmb/html/util/known_user.rb:30:in `allowed?' /home/niklaus/git/bbmb/lib/bbmb/html/state/login.rb:68:in `block in viral_modules' /home/niklaus/git/bbmb/lib/bbmb/html/state/login.rb:67:in `each' /home/niklaus/git/bbmb/lib/bbmb/html/state/login.rb:67:in `viral_modules' NoMethodError: undefined method `allowed?' for #<BBMB::Util::App:0x0055f59cd278e0> /home/niklaus/git/sbsm/lib/sbsm/session.rb:144:in `method_missing' /home/niklaus/git/bbmb/lib/bbmb/html/util/known_user.rb:45:in `remote_call' /home/niklaus/git/bbmb/lib/bbmb/html/util/known_user.rb:30:in `allowed?' /home/niklaus/git/bbmb/lib/bbmb/html/state/login.rb:68:in `block in viral_modules' /home/niklaus/git/bbmb/lib/bbmb/html/state/login.rb:67:in `each' /home/niklaus/git/bbmb/lib/bbmb/html/state/login.rb:67:in `viral_modules' /home/niklaus/git/bbmb/lib/bbmb/html/state/login.rb:59:in `reconsider_permissions' /home/niklaus/git/bbmb/lib/bbmb/html/state/login.rb:18:in `login' /home/niklaus/git/sbsm/lib/sbsm/state.rb:197:in `_trigger' /home/niklaus/git/sbsm/lib/sbsm/state.rb:186:in `trigger' /home/niklaus/git/sbsm/lib/sbsm/session.rb:217:in `block in process_rack' /home/niklaus/git/sbsm/lib/sbsm/session.rb:208:in `synchronize' /home/niklaus/git/sbsm/lib/sbsm/session.rb:208:in `process_rack' /home/niklaus/git/sbsm/lib/sbsm/app.rb:131:in `call'
Placed a pry debug statement in the old virbac and noted that there the auth_session is a DRb::DRbObject. And it is a Yus::EntitySession as shown by this pry snippet
[4] pry(#<BBMB::Html::Util::KnownUser>)> @auth_session.config NoMethodError: undefined method `config' for #<Yus::EntitySession:0x005625af1d0e90> from (druby://127.0.0.1:12003) /usr/local/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/odba-1.1.2/lib/odba/drbwrapper.rb:28:in `method_missing'
Looks for me as the connection to the ydim-html did not work as we find in lib/ydim/server.rb
auth = RRBA::Server.new
. RRBA is a gem I mostly ignored until now. It stands for Ruby Role-Based Authentication. But this looks simple and I do not think that we have problems there.
Setting a breakpoint in the old Virbac where the autosession is initialized I see that the session is a DRbObject (uri @uri="druby://127.0.0.1:12003"). Its backtrace is
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/pry-byebug-3.4.2/lib/byebug/processors/pry_processor.rb:115:in `block in resume_pry' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/pry-byebug-3.4.2/lib/byebug/processors/pry_processor.rb:28:in `block in run' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/pry-byebug-3.4.2/lib/byebug/processors/pry_processor.rb:27:in `catch' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/pry-byebug-3.4.2/lib/byebug/processors/pry_processor.rb:27:in `run' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/pry-byebug-3.4.2/lib/byebug/processors/pry_processor.rb:111:in `resume_pry' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/pry-byebug-3.4.2/lib/byebug/processors/pry_processor.rb:63:in `at_line' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/byebug-9.0.6/lib/byebug/context.rb:96:in `at_line' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.3/lib/bbmb/html/util/known_user.rb:27:in `initialize' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.3/lib/bbmb/util/server.rb:75:in `new' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.3/lib/bbmb/util/server.rb:75:in `login' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.3/lib/bbmb/html/util/session.rb:25:in `login' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.3/lib/bbmb/html/state/login.rb:18:in `login' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.0/lib/sbsm/state.rb:203:in `_trigger' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.0/lib/sbsm/state.rb:192:in `trigger' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.0/lib/sbsm/session.rb:356:in `process' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.3/lib/bbmb/html/util/session.rb:50:in `process' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.0/lib/sbsm/session.rb:166:in `block in drb_process' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.0/lib/sbsm/session.rb:165:in `synchronize' /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.0/lib/sbsm/session.rb:165:in `drb_process' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1624:in `perform_without_block' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1584:in `perform' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1668:in `block (2 levels) in main_loop' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1664:in `loop' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1664:in `block in main_loop'