view · edit · sidebar · attach · print · history

Index>

20160614-testSandozXmlconvBbmbCh

Summary

  • Create Watir test for sandoz.xmlconv.bbmb.ch on oddb-ci2
  • Test injecting an invoice in ydim

Commits

Index

Keep in Mind for work to do
  • Fix dojo error http://www.sitepen.com/blog/2012/10/31/debugging-dojo-common-error-messages/#forgot-dom-ready
  • I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
  • The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
  • creat gem: task: input=file with ean-codes, standard output show ean-codes + atc-code. Source is Swissmedic Packungen.xlsx or XML.
  • Import via data/medreg_companies.yaml
  • Fix problem with radioactivatum 99m-technetio when parsing Wirkstoffe
  • Fix galenic_forms when parsing swissmedic.xlsx
  • Cleanup generic_type. Replace it everywhere by sl_generic_type and adapt code accordingly.
  • Get updated ATC-codes from EPha for oddb.org, too.
  • Use refdatabase for oddb.org, too.
  • Check whether we should revert the part which touche src/plugin/text_info.rb of commit 17af82ba4d76a5838683411b260de265531f9e74. We should improve test/stub/oddbapp.rb to work similar for update/pointer as the real oddbapp. In this case we would have a good Stub for plugins. May we need a different stub when working with plugins (which create/modify/destroy ODDB-Objects), when in most other cases a very simple stub is sufficient.
  • When a logged in admin user changes an atc_code of a product, the corresponding atc_class must update its sequences, too.
  • Order of entering search type and value should not matter. Both should show long URL with search
  • Remove parser for minifi (but keep the minifi)
  • BSV-Plugin does not send mail. Is it sending two mails at once?
  • remove obsolete pdf_patinfo in model, admin/views
  • Fix sbsm/htmlgrid when DEFAULT_FLAVOUR is nil

Create Watir test for sandoz.xmlconv.bbmb.ch on oddb-ci2

Must finish the watir tests for the injection, which

  • collects Umsatz for one article and the total for the client
  • Injects via http post
  • collects new Umsatz for one article and the newtotal for the client
  • verifies
    • that everything went okay
    • that the numbers increase correspondingly
    • a correct file was generated under var/output

Getting the total andturnover is okay, but posting via http fails. Why? Comparing the used invoice.xml with the post_test.data I used yesterday I see that the post_test.data contained a <orderHeader referenceNumber="16114" /> whereas the invoice.xml (for volksapotheke ?) contained a delivery address. Using the post_test.data instead.

Looking at the output part of http://sandoz.xmlconv.bbmb.ngiger.ch/de/sbsm/transaction/state_id/70353167535620/transaction_id/28262 I also find that it is formatted differently than sandoz.xmlconv.bbmb.ch. This must be fixed later. It should contain multiple lines. Currently looks like this [",4100612722,13062016,,2991130,,,1,,16114,\n, see attached screenshot.

Using the post_test.data the watir test works find. Added tests to ensure that the turnover and item price be within 0.01 francs of the expected value.

Now I must modularize the test to cope with several receiver (URL, invoice, customer_id, product_name, expected total/item). Done with commit Watir test for propharma is okay

Now attacking the problem with the display of the output. First verified that the format of the generated file is correct via

 cat /var/www/sandoz.xmlconv.bbmb.ch/var/output/4100612722_20160614091337015.txt
,4100612722,14062016,,2991130,,,1,,16114,
,4100612722,14062016,,4430714,,,2,,16114,
,4100612722,14062016,,3663623,,,5,,16114,
,4100612722,14062016,,2323983,,,7,,16114,
,4100612722,14062016,,4124733,,,3,,16114,
,4100612722,14062016,,2347937,,,3,,16114,
,4100612722,14062016,,1390061,,,2,,16114,
,4100612722,14062016,,2366053,,,4,,16114,
,4100612722,14062016,,2092466,,,2,,16114,

Analysing the HTML source code of view-source:http://sandoz.xmlconv.bbmb.ngiger.ch/de/sbsm/transaction/state_id/70353167535620/transaction_id/28262 shows that the wrongly formatted list has the CSS class "helfti preformatted", which is defined in xmlconv/lib/xmlconv/view/transaction.rb.

Looking at an older transaction http://sandoz.xmlconv.bbmb.ngiger.ch/de/sbsm/transaction/state_id/278947380/transaction_id/28250 I see that the output field is correct. See

It looks as if the output field is not correctly stored in the database. Why?

Trying bin/xmlconv_admin using sudo -u bbmb /usr/local/bin/ruby231 /usr/local/bin/xmlconv_admin config=/var/www/sandoz.xmlconv.bbmb.ch/etc/xmlconv.yml

But what are the commands I can use? Playing around

ch.bbmb.xmlconv.sandoz> transactions.size
-> 28243
ch.bbmb.xmlconv.sandoz> transactions.first
-> #<XmlConv::Util::Transaction:0x000000071f7780>
ch.bbmb.xmlconv.sandoz> transaction('28604').class
-> NilClass
ch.bbmb.xmlconv.sandoz> transaction(28604).class
-> NilClass
ch.bbmb.xmlconv.sandoz> transactions.last.status
-> bbmb_ok
ch.bbmb.xmlconv.sandoz> transactions.last.output[0..120]
-> [",4100612722,14062016,,2991130,,,1,,16114,\n,4100612722,14062016,,4430714,,,2,,16114,\n,4100612722,14062016,,3663623,,,5
ch.bbmb.xmlconv.sandoz> transactions[-30].output[0..120]
-> ,4100602758,17052016,,1421123,,,10,,113679,
,4100602758,17052016,,1959265,,,1,,113679,
,4100602758,17052016,,2324014,,,6,
ch.bbmb.xmlconv.sandoz> transactions[-30].uri
-> file:/var/www/sandoz.xmlconv.bbmb.ch/var/output/4100602758_20160517115847062.txt
ch.bbmb.xmlconv.sandoz> transactions[-30].commit_time
-> 2016-05-17 11:58:47 +0200
ch.bbmb.xmlconv.sandoz> transactions[-30].destination.uri
-> file:/var/www/sandoz.xmlconv.bbmb.ch/var/output/4100602758_20160517115847062.txt
ch.bbmb.xmlconv.sandoz> transactions[-30].arguments
-> []
ch.bbmb.xmlconv.sandoz> transactions[-30].transaction_id
-> 28238
ch.bbmb.xmlconv.sandoz> transactions[-30].update_status
-> 
ch.bbmb.xmlconv.sandoz> transactions[-30].response
-> REXML::Document
ch.bbmb.xmlconv.sandoz> transactions[-30].output_model
-> 
ch.bbmb.xmlconv.sandoz> transactions[-30].partner
-> 4100602758
ch.bbmb.xmlconv.sandoz> transactions[-30].reader
-> SunStoreBdd
ch.bbmb.xmlconv.sandoz> transactions[-30].writer
-> BddCsv

Okay. I have now a feeling on how I can use the xmlconv_admin utility. I suspect that the wrong output stems from the fact that a String in Ruby >= 2.0 is no longer an array. But where is it injected wrongly?

I do not understand why the invoice injected via the /propharma URL got the reader attribute SunStoreBdd. Using xmlconv_admin I see the following reader types.

ch.bbmb.xmlconv.sandoz> transactions.collect{ |x| x.writer}.compact.uniq
-> ["BddCsv"]
ch.bbmb.xmlconv.sandoz> transactions.collect{ |x| x.reader}.compact.uniq
-> ["ProPharmaBdd", "PharmaciePlusBdd", "SunStoreBdd", "XundartBdd"]
ch.bbmb.xmlconv.sandoz> transactions.find{ |x| x.reader == 'ProPharmaBdd'}.commit_time
-> 2008-02-13 14:06:07 +0100
ch.bbmb.xmlconv.sandoz> transactions.find_all{ |x| x.reader == 'ProPharmaBdd'}.size
-> 67
ch.bbmb.xmlconv.sandoz> transactions.find_all{ |x| x.reader == 'ProPharmaBdd'}.collect{|x| x.commit_time}.max
-> 2009-10-20 12:15:07 +0200
ch.bbmb.xmlconv.sandoz> transactions.find_all{ |x| x.reader == 'ProPharmaBdd'}.collect{|x| x.commit_time}.min
-> 2008-02-13 14:06:07 +0100

Therefore it looks for me as this format was only used for a short period between February 2008 and October 2009. Looking at the different doc/*.rbx files I find the following readers

grep reader doc/*rbx
doc/propharma.rbx:      transaction.reader = 'SunStoreBdd'
doc/soap.rbx:   transaction.reader = 'WbmbBdd'
doc/sunstore.rbx:       transaction.reader = 'SunStoreBdd'
doc/unilog.rbx: transaction.reader = 'SunStoreBdd'
doc/volksapotheke.rbx:  transaction.reader = 'SunStoreBdd'
doc/wbmb.rbx:   transaction.reader = 'WbmbBdd'

Therefore I think it would be a good idea to get rid of the no longer used conversions! They are found under sandoz.xmlconv.bbmb.ch/lib/conversion/ and are:

  • lib/conversion/bdd_i2.rb (defining BddI2)
  • lib/conversion/pharmacieplus_bdd.rb (defining PharmaciePlusBdd)
  • lib/conversion/propharma_bdd.rb (defining ProPharmaBdd)
  • lib/conversion/xundart_bdd.rb (defining XundartBdd)

Now trying to make test for the SunStoreBdd (which is used by the ProPharma URL) pass, as it should discover the error in the generated output.

After discussing with Zeno we decided to remove the old rockit based lib/conversion/propharma_bdd.rb. We will rename the used SunStoreBdd to XmlBdd. This is too much work. Therefore just removing obsolete, non-working propharma_bdd.rb. Fixed the test for the commonly used SunStoreBDD. Pushed the following commits

Test injecting an invoice in ydim

Must simulate an end of month. Looking at the script http://dev.ywesee.com/uploads/att/test.rb-20130625.txt. Downloaded the script. Removed all iconv calls, as the config, etc is already UTF-8. Now having a problem with the connect statement in line 78. When calling the script with sudo -u bbmb /usr/local/bin/ruby231 test.rb config=/var/www/sandoz.bbmb.ch/etc/config.yml I get

/usr/local/lib/ruby/2.3.0/drb/drb.rb:745:in `rescue in block in open': druby://172.25.1.75:12375 - #<Errno::ECONNREFUSED: Connection refused - connect(2) for "172.25.1.75" port 12375> (DRb::DRbConnError)
        from /usr/local/lib/ruby/2.3.0/drb/drb.rb:739:in `block in open'
        from /usr/local/lib/ruby/2.3.0/drb/drb.rb:738:in `each'
        from /usr/local/lib/ruby/2.3.0/drb/drb.rb:738:in `open'
        from /usr/local/lib/ruby/2.3.0/drb/drb.rb:1248:in `initialize'
        from /usr/local/lib/ruby/2.3.0/drb/drb.rb:1228:in `new'
        from /usr/local/lib/ruby/2.3.0/drb/drb.rb:1228:in `open'
        from /usr/local/lib/ruby/2.3.0/drb/drb.rb:1141:in `block in method_missing'
        from /usr/local/lib/ruby/2.3.0/drb/drb.rb:1160:in `with_friend'
        from /usr/local/lib/ruby/2.3.0/drb/drb.rb:1140:in `method_missing'
        from /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/ydim/client.rb:23:in `logout'
        from test.rb:82:in `ensure in connect'
        from test.rb:82:in `connect'
        from test.rb:27:in `invoice'
        from test.rb:94:in `<main>'

It uses the wrong port 12375. Why? I think I look better at http://dev.ywesee.com/Yasu/20130703-check-alloga-virbac-sandoz-bbmb-and-debug-invoicer-job-index-therapeutics-exporter#debug-invoice-statistics. Local renamed in git checkout of bbmb bin/admin -> bin/bbmb_admin. After removing the uncessary line require 'encoding/character/utf-8' in bin/bbmb_admin I am able to run

> sudo -u apache /usr/local/bin/ruby231 /usr/local/bin/bbmb_admin config=/var/www/sandoz.bbmb.ch/etc/ydim.yml
ch.bbmb> BBMB::Util::Invoicer.run(Time.local(2013, 6, 1)..(Time.local(2013, 6, 30)))
-> druby://172.25.1.75:12375 - #<Errno::ECONNREFUSED: Connection refused - connect(2) for "172.25.1.75" port 12375>

The connection is not accepted. Somehow my password is not recognized. Now trying with

sudo -u apache /usr/local/bin/ruby231 /usr/local/bin/bbmb_admin config=/var/www/sandoz.bbmb.ch/etc/config.yml
ch.bbmb.sandoz>  BBMB::Util::Invoicer.run(Time.local(2013, 6, 1)..(Time.local(2013, 6, 30)))
-> druby://172.25.1.75:12375 - #<Errno::ECONNREFUSED: Connection refused - connect(2) for "172.25.1.75" port 12375>
ch.bbmb.sandoz> -> druby://172.25.1.75:12375 - #<Errno::ECONNREFUSED: Connection refused - connect(2) for "172.25.1.75" port 12375>
-> (eval):1: unexpected fraction part after numeric literal
-> druby://172.25.1.75:12375 - #<Errno::ECONNR...
                 ^
(eval):1: syntax error, unexpected tFLOAT, expecting keyword_do_LAMBDA or tLAMBEG
-> druby://172.25.1.75:12375 - #<Errno::ECONNREFU...
                   ^
ch.bbmb.sandoz> 

After stopping /service/sandoz.bbmb.ch* I get another connection error

ch.bbmb.sandoz> BBMB::Util::Invoicer.run(Time.local(2013, 6, 1)..(Time.local(2013, 6, 30)))
-> druby://localhost:12004 - #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 12004>

The port 12004 is the server_url specified in /var/www/sandoz.bbmb.ch/config.yml. Starting it again. It cannot connect to 12375 again. But only after I see in /service/sandoz.xmlconv.bbmb.ch/log/main/current

@40000000576001c335b9596c E, [2016-06-14T15:08:09.901295 #6369] ERROR -- XmlConv2: NoMethodError
@40000000576001c335b95d54 undefined method `error_recipients' for nil:NilClass
@40000000576001c335b9613c /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/polling_manager.rb:192:in `rescue in block in poll_sources'
@40000000576001c335b9613c /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/polling_manager.rb:185:in `block in poll_sources'
@40000000576001c335b9613c /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/polling_manager.rb:178:in `block in load_sources'
@40000000576001c335b9b72c /usr/local/lib/ruby/2.3.0/psych/deprecated.rb:32:in `each'
@40000000576001c335b9b72c /usr/local/lib/ruby/2.3.0/psych/deprecated.rb:32:in `load_documents'
@40000000576001c335b9b72c /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/polling_manager.rb:177:in `load_sources'
@40000000576001c335b9bb14 /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/polling_manager.rb:184:in `poll_sources'
@40000000576001c335b9c6cc /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/application.rb:147:in `block (2 levels) in start_polling'
@40000000576001c335b9c6cc /usr/local/lib/ruby/2.3.0/delegate.rb:85:in `loop'
@40000000576001c335b9c6cc /usr/local/lib/ruby/2.3.0/delegate.rb:85:in `call'
@40000000576001c335ba248c /usr/local/lib/ruby/2.3.0/delegate.rb:85:in `method_missing'
@40000000576001c335ba248c /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/application.rb:145:in `block in start_polling'

Copy etc/polling.yml from fastpower and remove uncommented lines. Now starting sudo -u bbmb /usr/local/bin/ruby231 /usr/local/bin/xmlconvd config=/var/www/sandoz.xmlconv.bbmb.ch/etc/xmlconv.yml fails like this

<..>
FEHLER:  Relation »target_id_xmlconv_util_transaction_invoice_ids« existiert bereits
I, [2016-06-14T15:16:37.028920 #11833]  INFO -- XmlConv2: drb-service listening on druby://localhost:12006
E, [2016-06-14T15:16:37.101203 #11833] ERROR -- XmlConv2: Errno::ECONNREFUSED
Connection refused - connect(2) for "localhost" port 25
/usr/local/lib/ruby/2.3.0/net/smtp.rb:542:in `initialize'
/usr/local/lib/ruby/2.3.0/net/smtp.rb:542:in `open'
/usr/local/lib/ruby/2.3.0/net/smtp.rb:542:in `tcp_socket'
/usr/local/lib/ruby/2.3.0/net/smtp.rb:552:in `block in do_start'
/usr/local/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
/usr/local/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
/usr/local/lib/ruby/2.3.0/net/smtp.rb:551:in `do_start'
/usr/local/lib/ruby/2.3.0/net/smtp.rb:521:in `start'
/usr/local/lib/ruby/gems/2.3.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/smtp.rb:113:in `deliver!'
/usr/local/lib/ruby/gems/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:2149:in `do_delivery'
/usr/local/lib/ruby/gems/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:239:in `deliver'
/usr/local/lib/ruby/gems/2.3.0/gems/mail-2.6.4/lib/mail/mail.rb:141:in `deliver'
/usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/mail.rb:17:in `notify'
/usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/polling_manager.rb:192:in `rescue in block in poll_sources'
/usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/polling_manager.rb:185:in `block in poll_sources'
/usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/polling_manager.rb:178:in `block in load_sources'
/usr/local/lib/ruby/2.3.0/psych/deprecated.rb:32:in `each'
/usr/local/lib/ruby/2.3.0/psych/deprecated.rb:32:in `load_documents'
/usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/polling_manager.rb:177:in `load_sources'
/usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/polling_manager.rb:184:in `poll_sources'
/usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/application.rb:147:in `block (2 levels) in start_polling'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `loop'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `call'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `method_missing'
/usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/application.rb:145:in `block in start_polling'

As described under http://dev.ywesee.com/Yasu/20130618-debug-dir-glob-method-error-on-xmlconv Yasu used stunnel with Ruby 1.8.6 to connect to google pop server. This should no longer be necessary, as mail handles access to a pop3 server with ssl. See https://github.com/mikel/mail#getting-emails-from-a-pop-server. But I think we should use a test account or we will inadvertently fetch incomming mail which should go to the real services!

Anyway. There are two errors:

  • On line 192 of lib/xmlconv/util/polling_manager.rb we are unable to send an e-mail with the subject XmlConv2 - Polling-Error
  • On line 172 of lib/xmlconv/util/polling_manager.rb executing a polling operation had failed (no stunell here)

Modified lib/bbmb/util/server.rb to run after 5 seconds the updater. Running it using sudo -u bbmb /usr/local/bin/ruby231 /usr/local/bin/bbmbd config=/var/www/sandoz.bbmb.ch/etc/config.yml produces

<..>
D, [2016-06-14T16:13:48.187249 #31610] DEBUG -- updater: sleeping 24371.81 seconds
D, [2016-06-14T16:13:48.187286 #31610] DEBUG -- : run_invoicer starting
D, [2016-06-14T16:13:48.187485 #31610] DEBUG -- invoicer: sleeping 1410371.81 seconds
I, [2016-06-14T16:13:48.187834 #31610]  INFO -- start: starting bbmb-server on druby://localhost:12004
D, [2016-06-14T16:13:53.187677 #31610] DEBUG -- : run_invoicer starting after sleep
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/smtp_tls.rb:15:in `do_start': Object#timeout is deprecated, use Timeout.timeout instead.
E, [2016-06-14T16:14:46.481203 #31610] ERROR -- fatal: execution expired (Timeout::Error)
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/smtp_tls.rb:15:in `initialize'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/smtp_tls.rb:15:in `open'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/smtp_tls.rb:15:in `block in do_start'
/usr/local/lib/ruby/2.3.0/timeout.rb:106:in `timeout'
/usr/local/lib/ruby/2.3.0/timeout.rb:120:in `timeout'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/smtp_tls.rb:15:in `do_start'
/usr/local/lib/ruby/2.3.0/net/smtp.rb:521:in `start'
/usr/local/lib/ruby/2.3.0/net/smtp.rb:458:in `start'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/mail.rb:68:in `sendmail'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/mail.rb:44:in `notify_error'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:69:in `rescue in invoice'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:67:in `invoice'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:106:in `block (2 levels) in run_invoicer'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `loop'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `call'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `method_missing'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:93:in `block in run_invoicer'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/smtp_tls.rb:15:in `initialize': execution expired (Timeout::Error)
        from /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/smtp_tls.rb:15:in `open'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/smtp_tls.rb:15:in `block in do_start'
        from /usr/local/lib/ruby/2.3.0/timeout.rb:106:in `timeout'
        from /usr/local/lib/ruby/2.3.0/timeout.rb:120:in `timeout'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/smtp_tls.rb:15:in `do_start'
        from /usr/local/lib/ruby/2.3.0/net/smtp.rb:521:in `start'
        from /usr/local/lib/ruby/2.3.0/net/smtp.rb:458:in `start'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/mail.rb:68:in `sendmail'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/mail.rb:44:in `notify_error'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:69:in `rescue in invoice'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:67:in `invoice'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:106:in `block (2 levels) in run_invoicer'
        from /usr/local/lib/ruby/2.3.0/delegate.rb:85:in `loop'
        from /usr/local/lib/ruby/2.3.0/delegate.rb:85:in `call'
        from /usr/local/lib/ruby/2.3.0/delegate.rb:85:in `method_missing'
        from /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:93:in `block in run_invoicer'

Patched lib/bbmb/util/server.rb not exit in case a run_invoice fails (instead of sending a mail). Now I am getting the following

/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/bin/bbmbd:36: warning: already initialized constant BBMB::VERSION
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/version.rb:5: warning: previous definition of VERSION was here
D, [2016-06-14T16:47:12.405388 #10326] DEBUG -- updater: sleeping 22367.59 seconds
D, [2016-06-14T16:47:12.405424 #10326] DEBUG -- : run_invoicer starting
D, [2016-06-14T16:47:12.405593 #10326] DEBUG -- invoicer: sleeping 1408367.59 seconds
I, [2016-06-14T16:47:12.405855 #10326]  INFO -- start: starting bbmb-server on druby://localhost:12004
D, [2016-06-14T16:47:17.405848 #10326] DEBUG -- : run_invoicer starting after sleep
druby://172.25.1.75:12375 - #<Errno::ECONNREFUSED: Connection refused - connect(2) for "172.25.1.75" port 12375>
E, [2016-06-14T16:47:38.834212 #10326] ERROR -- fatal: exit (SystemExit)
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `exit'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `call'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `method_missing'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:70:in `rescue in invoice'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:67:in `invoice'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:108:in `block (2 levels) in run_invoicer'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `loop'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `call'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `method_missing'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:95:in `block in run_invoicer'

After changing server_utl from ip -> localhost in /var/www/sandoz.bbmb.ch/etc/ydim.yml I get

D, [2016-06-14T16:55:30.242776 #13317] DEBUG -- : run_invoicer starting after sleep
undefined method `whoami' for nil:NilClass
E, [2016-06-14T16:55:53.194715 #13317] ERROR -- fatal: exit (SystemExit)
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `exit'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `call'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `method_missing'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:70:in `rescue in invoice'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:67:in `invoice'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:108:in `block (2 levels) in run_invoicer'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `loop'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `call'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `method_missing'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:95:in `block in run_invoicer'

Adding some puts allowed me to see, that the ydim_connect fails. On the ydim console output I see

D, [2016-06-14T17:30:42.007646 #23318] DEBUG -- druby://localhost:33275: attempting login
E, [2016-06-14T17:30:42.008468 #23318] ERROR -- unknown user: RRBA::AuthenticationError - Authentication failed

The id_dsa keys of the ydim client and ydimd must be identical. There cp /etc/ydim/id_dsa /home/bbmb/.ssh/; chown -R bbmb /home/bbmb/.ssh/. To fix it. Now I get in the console output of bbmb

undefined class/module BBMB::
E, [2016-06-14T17:39:06.504057 #29113] ERROR -- fatal: exit (SystemExit)
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `exit'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `call'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `method_missing'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:70:in `rescue in invoice'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:67:in `invoice'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:108:in `block (2 levels) in run_invoicer'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `loop'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `call'
/usr/local/lib/ruby/2.3.0/delegate.rb:85:in `method_missing'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:95:in `block in run_invoicer'
and in the console of ydim
D, [2016-06-14T17:39:06.453025 #28560] DEBUG -- druby://localhost:37858: attempting login
I, [2016-06-14T17:39:06.454110 #28560]  INFO -- root: login
D, [2016-06-14T17:39:06.454442 #28560] DEBUG -- root: create_invoice(51)
D, [2016-06-14T17:39:06.454504 #28560] DEBUG -- root: debitor 51
I, [2016-06-14T17:39:06.503815 #28560]  INFO -- root: logout

I can avoid this error if I break into pry in the create_invoice method, do a require 'bbmb/model/order'; require 'bbmb/model/customer' and continue. But then it fails on the bbmb (?) side with undefined method `unique_id' for nil:NilClass. Did DRB visibility rules change between ruby 1.8.6 and 2.3.0? Or do we need DRb::DRbUndumped ??

view · edit · sidebar · attach · print · history
Page last modified on June 14, 2016, at 06:21 PM