Injection failed on fastpower with
RuntimeError Bestellung OK, Eintrag in BBMB fehlgeschlagen: NoMethodError undefined method `inject_order' for # (druby://localhost:12004) /var/www/sandoz.bbmb.ch/vendor/ruby/2.4.0/gems/bbmb-2.3.0/lib/bbmb/util/server.rb:46:in `inject_order' (druby://localhost:12004) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1624:in `perform_without_block' (druby://localhost:12004) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1584:in `perform' (druby://localhost:12004) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1668:in `block (2 levels) in main_loop' (druby://localhost:12004) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1664:in `loop' (druby://localhost:12004) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1664:in `block in main_loop' /var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb:38:in `block in inject' /var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb:16:in `each' /var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb:16:in `each_with_index' /var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb:16:in `inject' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/bundler/gems/xmlconv-22fc7ae96f58/lib/xmlconv/util/transaction.rb:105:in `block in postprocess' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/bundler/gems/xmlconv-22fc7ae96f58/lib/xmlconv/util/transaction.rb:102:in `each' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/bundler/gems/xmlconv-22fc7ae96f58/lib/xmlconv/util/transaction.rb:102:in `postprocess' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/bundler/gems/xmlconv-22fc7ae96f58/lib/xmlconv/util/application.rb:44:in `_execute' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/bundler/gems/xmlconv-22fc7ae96f58/lib/xmlconv/util/application.rb:36:in `execute' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/bundler/gems/xmlconv-22fc7ae96f58/lib/xmlconv/util/application.rb:140:in `execute_with_response' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/bundler/gems/xmlconv-22fc7ae96f58/lib/xmlconv/state/login.rb:28:in `initialize' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/sbsm-1.4.3/lib/sbsm/session.rb:384:in `new' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/sbsm-1.4.3/lib/sbsm/session.rb:384:in `logout' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/sbsm-1.4.3/lib/sbsm/session.rb:224:in `block in process_rack' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/sbsm-1.4.3/lib/sbsm/session.rb:209:in `synchronize' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/sbsm-1.4.3/lib/sbsm/session.rb:209:in `process_rack' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/sbsm-1.4.3/lib/sbsm/app.rb:119:in `call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15:in `call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/static.rb:149:in `call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33:in `call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/tempfile_reaper.rb:15:in `call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33:in `call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/chunked.rb:54:in `call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15:in `call' /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/handler/webrick.rb:86:in `service' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:140:in `service' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:96:in `run' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread' hospital: 99
Why does this not fail locally? Looks like the drb_url is wrong in Bbmb2.inject(drb_url, idtype, transaction=nil). First must ensure that the remote-IP of request is tracked correctly (e.g. it should read 192.168.0.70 if testing via curl from my debian machine). Then testing whether injection fails.
Pushed commit Bumped version to 1.1.2.
After adding the missing rack_interface.rb from xmlconv I was finally able to reproduce the inject error locally. Also this time I have the following error, when I try to display the details of a successfull transaction
NoMethodError at /de/sbsm/transaction/state_id/46928504700780/transaction_id/28311 undefined method `lookup' for nil:NilClass Ruby /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb: in create, line 90 Web GET sandoz.xmlconv.bbmb.ngiger.ch/de/sbsm/transaction/state_id/46928504700780/transaction_id/28311
Placed a pry statement in sbsm/session.rb in process_rack. The remote_ip is found as followed
[4] pry(#<XmlConv::Util::Session>)> rack_request.env[ "HTTP_X_FORWARDED_FOR"] => "192.168.0.70"
Placing a pry in /var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb
[1] pry(XmlConv::PostProcess::Bbmb2)> inject_id => "99" [2] pry(XmlConv::PostProcess::Bbmb2)> order => [{:pcode=>"2508375", :quantity=>2}, {:pcode=>"5195126", :quantity=>2}] [3] pry(XmlConv::PostProcess::Bbmb2)> info => {:reference=>"99"} [4] pry(XmlConv::PostProcess::Bbmb2)> options => {:deliver=>true, :create_missing_customer=>"customer_id", :transaction=>"28327", :customer_name=>""}
Fighting to find the correct values for the smtp users locally.
After setting the host/port/user/pass in /var/www/sandoz.xmlconv.bbmb.ch/etc/polling.yml to the values for gmail, I get a new status "Leer" when testing via the curl command. On Fastpower it is configure to use localhost:10000 which points to the process /usr/sbin/stunnel /etc/stunnel/gmail.conf
, which connects to pop.gmail.com:995
as user sandoz.xundart@bbmb.ch.
As suggested under http://dev.ywesee.com/Yasu/20120509-setup-bbmb-setup-xmlconv I will try to comment out the polling_file. But this leads to another error
Errno::ENOENT: No such file or directory @ rb_sysopen - /home/bbmb/.xmlconv /usr/local/ruby-2.4.0/lib/ruby/2.4.0/psych.rb:472:in `initialize' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/psych.rb:472:in `open' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/psych.rb:472:in `load_file' /home/niklaus/git/xmlconv/lib/xmlconv/state/login.rb:22:in `initialize' /home/niklaus/git/sbsm/lib/sbsm/session.rb:385:in `new' /home/niklaus/git/sbsm/lib/sbsm/session.rb:385:in `logout' /home/niklaus/git/sbsm/lib/sbsm/session.rb:225:in `block in process_rack' /home/niklaus/git/sbsm/lib/sbsm/session.rb:209:in `synchronize' /home/niklaus/git/sbsm/lib/sbsm/session.rb:209:in `process_rack' /home/niklaus/git/sbsm/lib/sbsm/app.rb:119:in `call'
On fastpower it is set via the Apache environment XmlConv::Util::Destination.book(ENV['ACCESS_DESTINATION']). Moving the destination from polling.yml -> xmlconv.yml. Now I am getting the following error
NoMethodError undefined method `forget_credentials!' for "/var/www/sandoz.xmlconv.bbmb.ch/var/output":String /home/niklaus/git/xmlconv/lib/xmlconv/util/transaction.rb:40:in `ensure in execute' /home/niklaus/git/xmlconv/lib/xmlconv/util/transaction.rb:40:in `execute' /home/niklaus/git/xmlconv/lib/xmlconv/util/application.rb:43:in `_execute' /home/niklaus/git/xmlconv/lib/xmlconv/util/application.rb:36:in `execute' /home/niklaus/git/xmlconv/lib/xmlconv/util/application.rb:140:in `execute_with_response' /home/niklaus/git/xmlconv/lib/xmlconv/state/login.rb:28:in `initialize' /home/niklaus/git/sbsm/lib/sbsm/session.rb:385:in `new' /home/niklaus/git/sbsm/lib/sbsm/session.rb:385:in `logout' /home/niklaus/git/sbsm/lib/sbsm/session.rb:225:in `block in process_rack' /home/niklaus/git/sbsm/lib/sbsm/session.rb:209:in `synchronize' /home/niklaus/git/sbsm/lib/sbsm/session.rb:209:in `process_rack' /home/niklaus/git/sbsm/lib/sbsm/app.rb:119:in `call'
Config is now correct, but I get still the same error NoMethodError undefined method `inject_order' for #
as on fastpower.
Singlestepping in sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb
shows
NoMethodError: undefined method `inject_order' for #<BBMB::Util::App:0x00561de1682568> from (druby://localhost:12004) /home/niklaus/git/bbmb/lib/bbmb/util/server.rb:47:in `inject_order'
Restoring the original content of the method inject_order in lib/bbmb/util/server.rb from the last commit before changing to the Rack-Interface. After a small modification this worked.
Now cleaning up everything and preparing a new version of BBMB.
Starting the bin/admin interface for sandoz.xmvconv via sudo -u bbmb bundle exec bbmb_admin config=/var/www/sandoz.xmlconv.bbmb.ch /etc/xmlconv.yml
fails with
/var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/marshal.rb:15:in `load': undefined class/module XmlConv::Util:: (ArgumentError) from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/marshal.rb:15:in `load' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:629:in `restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:319:in `block in fetch_or_restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:314:in `fetch_or_do' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:318:in `fetch_or_restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:66:in `block in bulk_restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:63:in `each' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:63:in `bulk_restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:57:in `bulk_fetch' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:261:in `fetch_collection' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:633:in `restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:319:in `block in fetch_or_restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:314:in `fetch_or_do' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:318:in `fetch_or_restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:305:in `block in fetch_named' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:314:in `fetch_or_do' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:297:in `fetch_named' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:352:in `indices' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:475:in `setup' from /home/niklaus/git/bbmb/lib/bbmb/persistence/odba.rb:41:in `<module:BBMB>' from /home/niklaus/git/bbmb/lib/bbmb/persistence/odba.rb:14:in `<top (required)>' from /home/niklaus/git/bbmb/lib/bbmb/util/app.rb:16:in `require' from /home/niklaus/git/bbmb/lib/bbmb/util/app.rb:16:in `<top (required)>' from /home/niklaus/git/bbmb/bin/bbmb_admin:10:in `require' from /home/niklaus/git/bbmb/bin/bbmb_admin:10:in `<top (required)>' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/bin/bbmb_admin:22:in `load' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/bin/bbmb_admin:22:in `<main>'
Must add support for loading the plugin_dir and postproc_dir mentioned in config.yml
Pushed the following commits
After pushing all commits to update the different versions sandoz.bbmb.ch start, but not sandoz.xml which throws
/var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/marshal.rb:15:in `load': undefined class/module BBMB:: (ArgumentError) from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/marshal.rb:15:in `load' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:629:in `restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:319:in `block in fetch_or_restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:314:in `fetch_or_do' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:318:in `fetch_or_restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:66:in `block in bulk_restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:63:in `each' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:63:in `bulk_restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:57:in `bulk_fetch' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:261:in `fetch_collection' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:633:in `restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:319:in `block in fetch_or_restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:314:in `fetch_or_do' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:318:in `fetch_or_restore' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:305:in `block in fetch_named' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:314:in `fetch_or_do' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:297:in `fetch_named' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:352:in `indices' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:475:in `setup' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/xmlconv-1.1.3/lib/xmlconv/util/application.rb:108:in `start_server' from /var/www/sandoz.xmlconv.bbmb.ch/config.ru:45:in `block in <main>' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize' from /var/www/sandoz.xmlconv.bbmb.ch/config.ru:in `new' from /var/www/sandoz.xmlconv.bbmb.ch/config.ru:in `<main>' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:283:in `start' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:148:in `start' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/rack-2.0.3/bin/rackup:4:in `<top (required)>' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/bin/rackup:22:in `load' from /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/bin/rackup:22:in `<main>'
Fixed with commit Pass config=etc/xmlconv.yml via ARGV to bbmb
Now the command curl -v http://sandoz.xmlconv.bbmb.ngiger.ch/propharma -d@test/data/confuse.xml
completed succesfully. Verified by visiting the following URLs
28338 192.168.0.70 12.06.2017 19:43:49 file:/.../var/output/99_20170612194349078.txt Bestellung via BBMB erfolgreich
I also received the expected E-Mail Bbmb-Order 99-117
Start adapting the apache config, Gemfile and config.ru. Adapting src/util/oddbapp.rb.