view · edit · sidebar · attach · print · history

< Niklaus.20170522-vetoquinol-rack | Index | Niklaus.20170516-virbac >>

20170516-virbac

Summary

  • Fix importer problem
  • Renaming an email address must check correctly whether it is a duplicate
  • Keep in Mind

Commits

Index

importer problem

The update started at 23 hours (default update_hour) and 4 NameError for each of the used Importer.

NameError
uninitialized constant BBMB::Util::CustomerImporter
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/updater.rb:19:in `import'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/updater.rb:14:in `block in run'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/polling_manager.rb:34:in `block in poll_path'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/polling_manager.rb:33:in `open'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/polling_manager.rb:33:in `poll_path'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/polling_manager.rb:29:in `block in poll'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/polling_manager.rb:28:in `each'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/polling_manager.rb:28:in `poll'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/polling_manager.rb:144:in `block in poll_sources'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/polling_manager.rb:137: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/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/polling_manager.rb:136:in `load_sources'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/polling_manager.rb:143:in `poll_sources'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/updater.rb:11:in `run'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/server.rb:39:in `update'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/server.rb:88:in `block (2 levels) in run_updater'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/server.rb:77:in `loop'
/var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.7/lib/bbmb/util/server.rb:77:in `block in run_updater'

The other error is uninitialized constant BBMB::Util::ProductImporter.

Looking at log/2017/05/16/app_log for the log entries at 23 hours. Here I see

D, [2017-05-16T23:00:00.000408 #6622] DEBUG -- : server.rb:87:in `block (2 levels) in run_updater' update starting
D, [2017-05-16T23:00:06.055515 #6622] DEBUG -- : server.rb:89:in `block (2 levels) in run_updater' update finished
D, [2017-05-16T23:00:06.055639 #6622] DEBUG -- : server.rb:85:in `block (2 levels) in run_updater' updater sleeping 86393.94 seconds. run_only_once_at_startup false

It looks like ./lib/bbmb/util/csv_importer.rb from virbac was never required as it should be. To debug the Update I did set in my checkout the variable run_only_once_at_startup to true in lib/bbmb/util/server.rb. Now I was able to reproduce the error here.

Waiting for importer to finish before pushing the commit, which just adds a require 'bbmb/util/rack_interface' in the lib/bbmb/virbac/app.rb

Pushed commit To be able to run the Updaters csv_importer must be included

But to avoid the old error of the undefined to_i for False error, I must fix bbmb, too.

Installing the new version on fast-power and running the importer

  • cd /var/www/virbac.bbmb.ch
  • sudo -u bbmb git pull https://github.com/ngiger/virbac.bbmb.ch.git
  • sudo -u bbmb /usr/local/bin/bundle-240 install
  • sudo svc -h /service/virbac.bbmb.ch
  • sudo tail /service/virbac.bbmb.ch/log/main/current # to verify that it started correctly
  • sudo -u bbmb /usr/local/bin/bundle-240 exec bin/update_abschluss_artikel_artikel_fr_kunden

Running bin/update_abschluss_artikel_artikel_fr_kunden fails, because of my changes of yesterday. Must find the used server differently.

Pushed commit Fixed update_abschluss_artikel_artikel_fr_kunden to use DRbServer via config.server_url

In /service/virbac.bbmb.ch/log/main/current we find

ond_to?(:_dump) uses the deprecated method signature, which takes one parameter
@40000000591bfd6e225a5d6c /var/www/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.8/lib/bbmb/model/order.rb:48: warning: respond_to? is defined here
@40000000591bfd6e261682dc csv_importer.rb: finished. /var/www/virbac.bbmb.ch/var/ftp/ARTIKEL.CSV. count is 332
@40000000591bfd6e2854eda4 csv_importer.rb: UTF-8 importing /var/www/virbac.bbmb.ch/var/ftp/ARTIKEL_FR.CSV 332 lines
@40000000591bfd70006a02ac ...ProductImporter postprocess
@40000000591bfd7321f66794 csv_importer.rb: finished. /var/www/virbac.bbmb.ch/var/ftp/ARTIKEL_FR.CSV. count is 332
@40000000591bfd732495d264 csv_importer.rb: UTF-8 importing /var/www/virbac.bbmb.ch/var/ftp/KUNDEN.CSV 1234 lines
@40000000591bfd7524ad88b4 .Skipping customer 3219
@40000000591bfd770a067d7c ......... 1000
@40000000591bfd7d0bd88dfc ..CustomerImporter postprocess
@40000000591bfd7d336595cc CsvImporter postprocess
@40000000591bfd7d3365a954 csv_importer.rb: finished. /var/www/virbac.bbmb.ch/var/ftp/KUNDEN.CSV. count is 1234

But the files are still found under var/ftp, because the service is still running. My first idea to stop the service did not work. Adding a stop_service method to bbmb. This idea did not work neither. Therefore abandoning this problem.

Renaming an email address must check correctly whether it is a duplicate

When renaming the email, we visit the following procedures

The update_user in state/customer.rb raises an error :e_duplicate_email, it it cannot successfull call session.auth_session.grant. We note the following differences between the pre-rack and our version

Therefore I conculde that the BBMB.auth object is not the correct. Why? I found that BBMB.auth was initialized in bin/bbmbd, which is no longer used. Change the code in https://github.com/ngiger/bbmb/blob/master/lib/bbmb/util/app.rb#L38 app.rb to BBMB.auth instead of @auth. Changing various occurrences of the the same variable. Dropped virbac_bbmd and virbac_bbmb_yus database.

When I start the app I get now #<Errno::ECONNREFUSED: Connection refused - connect(2) for "127.0.01" port 12003>. Comparing again agains bin/bbmbd. Yes. start_service now also sets BBMB.server and BBMB.persistance and I start up as usual.

But the login of an admin or normal user fails now with #<Errno::ECONNREFUSED: Connection refused - connect(2) for "127.0.01" port 12003>

Pushed commits

Adding a possibility to easily run invoicer at startup like for the updater, to check whether this still works.

When trying to set an empty address it generates the error:

RuntimeError at /de/bbmb
Invalid email address: nil
Ruby	/home/niklaus/git/virbac.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.9/lib/bbmb/model/customer.rb: in email=, line 69
Web	POST virbac_rack.ngiger.ch/de/bbmb

When looking when this line was created by using git blame lib/bbmb/model/customer.rb I get ^1f296dd (Hannes Wyss 2007-04-17 16:16:04 +0200 69) raise "Invalid email address: nil" unless email. Therefore Hannes decided that this was the correct way to do.

Now the question is whether it must be possible to set an empty e-mail or whether we would like to have a nicer error message.

Pushed commits

Reactivated the AdminServer in my sbsm. With a few changes, I get the following error form bin/virbac_admin

ch.bbmb.virbac> ODBA.cache.extent(BBMB::Model::Order).size
-> 0x002b0e5efa70fc is not id value

This looks like we have some problems speaking correctly to the DRbServers. Removed a suspicous line and now I have the first success

ch.bbmb.virbac> ODBA.cache.extent(BBMB::Model::Order).size
-> 10747
ch.bbmb.virbac> ODBA.cache.extent(BBMB::Model::Order).first.order_id
-> 17525-
ch.bbmb.virbac> ODBA.cache.extent(BBMB::Model::Customer).first.customer_id
-> 16810
ch.bbmb.virbac> ODBA.cache.extent(BBMB::Model::Customer).first.email
-> 

Testing whether the other stuff still work. All the tests given by manual_test.md completed here. Preparing the commits.

Pushed the following commits:

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