view · edit · sidebar · attach · print · history

< Niklaus.20170530-virbac-error | Index | Niklaus.20170524-brand2csv >>

20170529-vetiquinol-importer

Summary

  • Vetoquinol updater problem
  • Port sandoz.bbmb.ch to use the rack based SBSM
  • Keep in Mind

Commits

Index

Vetoquinol updater problem

Must fix the error reported by email like

NameError
uninitialized constant BBMB::Util::ProductImporter
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/updater.rb:21:in `import'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/updater.rb:16:in `block in run'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/polling_manager.rb:91:in `poll_message'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/polling_manager.rb:86:in `block in poll_message'
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/delegate.rb:341:in `each'
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/delegate.rb:341:in `block in delegating_block'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/polling_manager.rb:85:in `poll_message'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/polling_manager.rb:71:in `block in poll'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/polling_manager.rb:69:in `each'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/polling_manager.rb:69:in `poll'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/polling_manager.rb:150:in `block in poll_sources'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/polling_manager.rb:143:in `block in load_sources'
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/psych/deprecated.rb:32:in `each'
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/psych/deprecated.rb:32:in `load_documents'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/polling_manager.rb:142:in `load_sources'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/polling_manager.rb:149:in `poll_sources'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/updater.rb:13:in `run'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/server.rb:41:in `update'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/server.rb:95:in `block (2 levels) in run_updater'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/server.rb:84:in `loop'
/var/www/vetoquinol.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/util/server.rb:84:in `block in run_updater'

The missing require stems from the fact, that the importers to be run are defined by the config.yml. The file bbmb/util/csv_importer.rb from BBMB is overridden in vetoquinol. Therefore we must load (not require) it in the config.ru. Fixed with commit Load CSV-Importer to fix running importers

Port sandoz.bbmb.ch to use the rack based SBSM

Trying to make bundle exec rackup work. Copied yml files from fastpower /var/www/sandoz.bbmb.ch/etc. Copying also doc/ressources/.

Now bundle sudo -u bbmb bundle-240 exec rackup works and the login displays correctyl (images). Login as admin works, but clicking on any link, column title has no effect.

Fixes for javascripts like require(["dojo/domReady! taken from virbac.bbmb.ch.

Asking myself why it does not display the customer when logged in as admin and visiting http://sandoz_rack.ngiger.ch/de/customer/customer_id/4100609297. Javascripts displays no error.

In the virbac app.log, we see that the log entry for app.rb:137:in `call' finish session_id.2 contains a headers parameter "Set-Cookie"=>"language=de; path=/" which is missing in the sandoz app.log. Why? SBSM::Session#import_cookies: does not work correclty as self::class::PERSISTENT_COOKIE_NAME is bbmb-barcodereader and not sandoz.bbmb as specified in the config.ru. Okay. We have a confusion of the PERSISTENT_COOKIE_NAME which is used in SBSM::Session and SBSM::RackInterface. Where do we have to place it? I think it should not be fixed constant, as it is probably a good idea to have different names for virbac and sandoz. Therefor I want to place it with the same default value into the BBMB.config. Now the cookie gets stored correctly, but I still do no see the customers info.

Stepping with pry when path is de/customer/customer_id/4100609297. After calling import_user_import in SBSM::Session#process_rack the @valid_input.keys.last returns ": 4100609297". Why? The path is /de/customer/customer_id/4100609297 instead of /de/bbmb/customer/customer_id/4100609297

Sandoz.bbmb.ch used a non flavour approach. By removing the method base_url and it alias :orig_base_url in lib/bbmb/html/util/lookandfeel.rb we use the bbmb flavor as elsewhere and everything is working fine. Creating manual_test.md and testing the app here. The Admin interface works fine. Generated password, set password, change street and other fields. Checking whether placing an order as a customer works. Found the following entries in /var/www/sandoz_rack.bbmb.ch/log/2017/05/29/app_log

D, [2017-05-29T14:38:51.227964 #11682] DEBUG -- : app.rb:115:in `call' starting session_id 4857f77ae5616d012e5cc379b3  session BBMB::Html::Util::Session /de/bbmb: cookies  are {"
D, [2017-05-29T14:38:51.231205 #11682] DEBUG -- : session.rb:279:in `import_cookies' cuki_str _session_id 4857f77ae5616d012e5cc379b3                                              
D, [2017-05-29T14:38:51.231624 #11682] DEBUG -- : session.rb:285:in `import_cookies' @cookie_input now {:language=>"de"}
I, [2017-05-29T14:38:51.497651 #11682]  INFO -- : current_order.rb:47:in `commit' committing 4100606390 4100606390-35 /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/bbmb/lib/bbmb/html/state/global.rb:58:in `trigger'                                                                                                              
/home/niklaus/git/sbsm/lib/sbsm/viralstate.rb:38:in `trigger'                                                                                                                     
/home/niklaus/git/sbsm/lib/sbsm/session.rb:218: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:116:in `call'                                                 
/var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call'                                                                              
/var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call'                                                                               
/var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call'                                                                    
I, [2017-05-29T14:38:51.497804 #11682]  INFO -- : send_order 4100606390-35 and customer 4100606390                                                                                

It appears in the archive, but no e-mail was received. Changing mail_suppress_sending: in etc/config.yml from true to false and sending another order.

Now I see in the output

172.25.1.75 - - [29/May/2017:14:49:38 +0200] "GET /resources/tierchen.jpg HTTP/1.1" 200 15542 0.0028
Mail.sendmail smtp.gmail.com 587 localhost.localdomain smtp_user: orders.sandoz@bbmb.ch  osz6812  plain
Mail.sendmail from orders.sandoz@bbmb.ch to ngiger@ywesee.com cc [] message: String
Mail.sendmail smtp.gmail.com 587 localhost.localdomain smtp_user: orders.sandoz@bbmb.ch  osz6812  plain
Mail.sendmail from ngiger@ywesee.com to ahpdl.bachmatte@sensemail.ch cc ngiger@ywesee.com message: String
172.25.1.75 - - [29/May/2017:14:49:43 +0200] "GET /de/bbmb/current_order/ HTTP/1.1" 200 9012 0.0117

Received an order with the lines

4100606390,7601002107945,29052017,36,4448938,7680553880125,44001133,5,1.71,Interne Bestellnummer 00555,Bemerkung
4100606390,7601002107945,29052017,36,5486585,7680629320012,44050498,5,163.85,Interne Bestellnummer 00555,Bemerkung

The confirmation email looked like this

Sandoz: Auftragsbestätigung 4100606390-36
orders.sandoz@bbmb.ch

an ahpdl.bachmatte; mich
29.05.2017

Ran the importer, too. Did see many lines like

/home/niklaus/git/bbmb/lib/bbmb/model/order.rb:48: warning: respond_to? is defined here
/var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/odba-1.1.2/lib/odba/marshal.rb:10: warning: #<BBMB::Model::Order::Position:0x007fe2e5501160>.respond_to?(:_dump) uses the deprecated method signature, which takes one parameter
/home/niklaus/git/bbmb/lib/bbmb/model/order.rb:48: warning: respond_to? is defined here

Pushed commits to silence some warnings when running tests in odba

After thinking again about my changes. I feel confident, that we do not need any changes in SBSM and/or BBMB, as removing the base_url method from lib/bbmb/html/util/lookandfeel.rb should be enough to make sandoz.bbmb.ch work.

Changing the e-mail address of the test user failed with

172.25.1.75 - - [29/May/2017:16:34:23 +0200] "GET /resources/tierchen.jpg HTTP/1.1" 200 15542 0.0029
NoMethodError: undefined method `get_preference' for #<SBSM::UnknownUser:0x00557e5c94f4a0>
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/bbmb-2.2.7/lib/bbmb/html/state/viral/admin.rb:26:in `home'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/sbsm-1.4.2/lib/sbsm/viralstate.rb:47:in `rescue in trigger'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/sbsm-1.4.2/lib/sbsm/viralstate.rb:38:in `trigger'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/sbsm-1.4.2/lib/sbsm/session.rb:218:in `block in process_rack'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/sbsm-1.4.2/lib/sbsm/session.rb:208:in `synchronize'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/sbsm-1.4.2/lib/sbsm/session.rb:208:in `process_rack'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/sbsm-1.4.2/lib/sbsm/app.rb:119:in `call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15:in `call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/static.rb:149:in `call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33:in `call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/tempfile_reaper.rb:15:in `call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33:in `call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/chunked.rb:54:in `call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15:in `call'
        /var/www/sandoz_rack.bbmb.ch/vendor/sandoz/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'

Pushed commits

view · edit · sidebar · attach · print · history
Page last modified on May 29, 2017, at 05:16 PM