xmlconv 1.1.5 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8fdfd91d268508538bfd8c63a8b30feab9ba86f2
4
- data.tar.gz: 1b7924f306ca65f665893d72b08c1c1931b71066
3
+ metadata.gz: b944e983c5846919a052589ef034b9f3213f87a7
4
+ data.tar.gz: 886ccc0284adc4c66a48efd6f0a5f9f59ce5866f
5
5
  SHA512:
6
- metadata.gz: 4ad2412d99bd3fa72cf25a88f77247f68f3dc1fa579085d1f5e49a0c75cdf98c312f520536f7082580f0443031681cbe4ed5294132eef2cb0a88c886ddc2694d
7
- data.tar.gz: 6e1035617e80f3557f8d51329ec29d7c1cf56794c6d7dcba6ad3b0923b027366d23bde21c4a294e2bd4047f0bc0c39138b5bb8110b0970786b8c7d1a8f294dff
6
+ metadata.gz: 34d6f9ca0710e0c360f36e4167626c6afea002881ee15eacc31b786300f5f41d8aee21a649e392e4c4f865457cbe7a10cec27f778d7b882ebf94b53e14d88979
7
+ data.tar.gz: b9a1eee2de8c25e0507da64e8621850126bae94b86a54a38c580b25703ac205b3c9859a50677fe7b9250335d7003f7224d9dc2411ec7b2f25ffe33e90338368c
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.1.6 / 20.06.2017
2
+
3
+ * Trace transaction handling via SBSM.debug
4
+
1
5
  === 1.1.5 / 14.06.2017
2
6
 
3
7
  * Prepend http:// to transaction origin
@@ -12,8 +12,9 @@ module XmlConv
12
12
  VIEW = View::Login
13
13
  def initialize(session, model)
14
14
  if session.request_method.eql?('POST')
15
- session.request_params
16
- xml_src = "#{session.request_params.keys.first} #{session.request_params.values.first}"
15
+ xml_src = session.post_content
16
+ SBSM.debug "XmlConv::State::Login POST params were #{session.request_params}"
17
+ SBSM.debug " xml_src now #{xml_src}"
17
18
  unless xml_src.length == 0
18
19
  transaction = XmlConv::Util::Transaction.new
19
20
  transaction.domain = session.server_name
@@ -38,18 +38,26 @@ module XmlConv
38
38
  rescue Exception => error
39
39
  ## survive notification failure
40
40
  end
41
- def _execute(transaction)
42
- transaction.transaction_id = next_transaction_id
43
- transaction.execute
44
- transaction.postprocess
45
- rescue Exception => error
46
- transaction.error = error
41
+ def _execute(transaction)
42
+ has_error = false
43
+ transaction.transaction_id = next_transaction_id
44
+ SBSM.info "Starting_transaction #{transaction.transaction_id}"
45
+ transaction.execute
46
+ res = transaction.postprocess
47
+ SBSM.info "Postprocessed_transaction #{transaction.transaction_id} res #{res.class}"
48
+ res
49
+ rescue Exception => error
50
+ has_error = true
51
+ SBSM.info "error_transaction #{transaction.transaction_id} error #{error} \n#{error.backtrace}"
52
+ transaction.error = error
47
53
  ensure
48
- ODBA.transaction {
54
+ res = ODBA.transaction {
49
55
  transaction.odba_store
50
56
  @transactions.push(transaction)
51
57
  @transactions.odba_isolated_store
52
58
  }
59
+ SBSM.info "has_error_transaction is #{has_error} #{transaction.transaction_id} res is #{res.class}" if has_error
60
+ res
53
61
  end
54
62
  def next_transaction_id
55
63
  @id_mutex.synchronize {
@@ -122,7 +130,7 @@ class XmlConvApp < SBSM::AdminServer
122
130
  POLLING_INTERVAL = 60 #* 15
123
131
  def initialize(app: XmlConv::Util::RackInterface.new)
124
132
  @rack_app = app
125
- super(app: app)
133
+ super(app: app) # TODO?? , multi_threaded: true)
126
134
  @persistence_layer = ODBA.cache.fetch_named('XmlConv', self) do XmlConv::Util::Application.new end
127
135
  @persistence_layer.init
128
136
  @dispatch_queue = Queue.new
@@ -12,7 +12,6 @@ module Mail
12
12
  recipients.compact!
13
13
  recipients.uniq!
14
14
  return if(recipients.empty?)
15
- puts "XmlConv::Util::Mail.notify #{ XmlConv::CONFIG.mail_from} -> #{recipients} subject: #{my_subject}"
16
15
  options = { :address => XmlConv::CONFIG.smtp_server,
17
16
  :port => XmlConv::CONFIG.smtp_port,
18
17
  :domain => XmlConv::CONFIG.smtp_domain,
@@ -24,6 +23,8 @@ module Mail
24
23
  ::Mail.defaults do
25
24
  delivery_method :smtp, options
26
25
  end unless ::Mail.delivery_method.is_a?(::Mail::TestMailer)
26
+ msg = "XmlConv::Util::Mail.notify #{ XmlConv::CONFIG.mail_from} -> #{recipients} subject: #{my_subject}\n #{options}"
27
+ puts msg; SBSM.info(msg)
27
28
  mail = ::Mail.deliver do
28
29
  from XmlConv::CONFIG.mail_from
29
30
  to recipients
@@ -173,7 +173,11 @@ module XmlConv
173
173
  def initialize(system)
174
174
  @system = system
175
175
  end
176
- def load_sources(&block)
176
+ def load_sources(&block)
177
+ unless File.exist?(CONFIG.polling_file)
178
+ SBSM.warn("Could not find #{CONFIG.polling_file}. Skip polling")
179
+ return
180
+ end
177
181
  file = File.open(CONFIG.polling_file)
178
182
  YAML.load_documents(file) { |mission|
179
183
  block.call(mission)
@@ -182,8 +186,10 @@ module XmlConv
182
186
  file.close if(file)
183
187
  end
184
188
  def poll_sources
189
+ @@showed_content ||= false
185
190
  load_sources do |source|
186
191
  begin
192
+ SBSM.info "PollingManage has source #{source.inspect}" unless @@showed_content
187
193
  source.poll { |transaction|
188
194
  @system.execute(transaction)
189
195
  }
@@ -197,6 +203,7 @@ module XmlConv
197
203
  Util::Mail.notify source.error_recipients, subject, body
198
204
  end
199
205
  end
206
+ @@showed_content = true
200
207
  end
201
208
  end
202
209
  end
@@ -23,7 +23,7 @@ module XmlConv
23
23
  @app = app
24
24
  super(app: app,
25
25
  session_class: XmlConv::Util::Session,
26
- unknown_user: XmlConv::Util::KnownUser,
26
+ unknown_user: XmlConv::Util::KnownUser.new,
27
27
  validator: validator,
28
28
  cookie_name: 'virbac.bbmb'
29
29
  )
@@ -37,6 +37,7 @@ module XmlConv
37
37
  @model = reader_instance.convert(input_model, *@arguments)
38
38
  output_model = writer_instance.convert(@model, *@arguments)
39
39
  @output = output_model.is_a?(Array) ? output_model.join("\n").to_s : output_model.to_s
40
+ SBSM.info("_execute #{input_model.class} => #{@output} #{@destination.inspect}")
40
41
  @destination.deliver(output_model)
41
42
  @commit_time = Time.now
42
43
  @output
@@ -103,11 +104,13 @@ Output:
103
104
  end
104
105
  def postprocess
105
106
  if(@postprocs.respond_to?(:each))
106
- @postprocs.each { |klass, *args|
107
+ @postprocs.each do |klass, *args|
107
108
  next if args.empty?
109
+ SBSM.info(msg = "Postprocess calling for klass #{klass} #{args.inspect}")
108
110
  args.push(self)
109
- PostProcess.const_get(klass).send(*args)
110
- }
111
+ res = PostProcess.const_get(klass).send(*args)
112
+ SBSM.info(msg = "Postprocess returned #{res} for klass #{klass}")
113
+ end
111
114
  end
112
115
  end
113
116
  def respond delivery, response
@@ -1,3 +1,3 @@
1
1
  module XmlConv
2
- VERSION = '1.1.5'
2
+ VERSION = '1.1.6'
3
3
  end
@@ -38,6 +38,7 @@ module XmlConv
38
38
  cache.should_receive(:store).with(@app.transactions)
39
39
  ODBA.cache = cache
40
40
  transaction.should_receive(:transaction_id=).with(1)
41
+ transaction.should_receive(:transaction_id)
41
42
  transaction.should_receive(:execute).once.and_return(transaction)
42
43
  transaction.should_receive(:postprocess).once
43
44
  transaction.should_receive(:error=).never
@@ -57,6 +58,7 @@ module XmlConv
57
58
  cache.should_receive(:store).with(@app.transactions)
58
59
  ODBA.cache = cache
59
60
  transaction.should_receive(:transaction_id=).with(1)
61
+ transaction.should_receive(:transaction_id)
60
62
  transaction.should_receive(:execute).once.and_raise(Net::SMTPFatalError, 'could not send email')
61
63
  transaction.should_receive(:postprocess).never
62
64
  transaction.should_receive(:error=).never
@@ -75,6 +77,7 @@ module XmlConv
75
77
  cache.should_receive(:store).with(@app.transactions)
76
78
  ODBA.cache = cache
77
79
  transaction.should_receive(:transaction_id=).with(1)
80
+ transaction.should_receive(:transaction_id)
78
81
  transaction.should_receive(:execute).and_raise 'oops, something went wrong'
79
82
  transaction.should_receive(:postprocess).never
80
83
  transaction.should_receive(:error=).once
data/xmlconv.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "ydbd-pg", '>= 0.5.1'
22
22
  spec.add_dependency "ydbi", '>= 0.5.1'
23
23
  spec.add_dependency "json"
24
- spec.add_dependency "sbsm", '>= 1.4.4'
24
+ spec.add_dependency "sbsm", '>= 1.4.5'
25
25
  spec.add_dependency "htmlgrid"
26
26
  spec.add_dependency "ydim"
27
27
  spec.add_dependency "syck"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xmlconv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz, Niklaus Giger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-14 00:00:00.000000000 Z
11
+ date: 2017-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: odba
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.4.4
75
+ version: 1.4.5
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 1.4.4
82
+ version: 1.4.5
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: htmlgrid
85
85
  requirement: !ruby/object:Gem::Requirement