shiftzilla 0.2.11 → 0.2.12

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
  SHA256:
3
- metadata.gz: ea980b30c6b791aaad697655423a68a7402b6aac013be2e62c51b4f774b57cfc
4
- data.tar.gz: f4940596031fdbe16505795dc684a79be7fb3797eff0fcd860faf1dc3717bc46
3
+ metadata.gz: ecca05f2efb7dc60cd977affe6bfc7e48edb0e515787caabd1b27d911c293193
4
+ data.tar.gz: 59c344e58a8e310063df6655cd377bb1a690ac0bd0cd29d61fe55f47dbf8eddb
5
5
  SHA512:
6
- metadata.gz: 0ffb536b556064cc141dfdb1f3c706ee83ff15fa454c41eafd2cb263edb66601afc9c24b77aa5e082d8871912168a1121fcd91145db787feabf01eff68a29874
7
- data.tar.gz: 07eb7b345e3e72bc2b2c7e252d3fdf61668ef7bba2b0cf06cb19b1df799bd1c7005926f763801c5cfc385e6de6fb253595a986fa86d1707afe1bbd0c1e8a0f31
6
+ metadata.gz: 139a102ddff266faf520ebecc7439e4c6c2a77884d5b83514cd3269aa837146f08bf1538c23b1845f93a541111861b1ce0d38141dac7e80a827208d3e2acb984
7
+ data.tar.gz: 8840df886a38558543d2b76a2e179ae6c2cb26d1bdcecc0efaf4e46dba1b1adb5d7d9e11b38037d2157fc897bbe012e51e714b52dd62e9845f5c0bd7b5efcf7f
data/bin/shiftzilla CHANGED
@@ -45,6 +45,7 @@ Description:
45
45
 
46
46
  Options:
47
47
  EOF
48
+ opt :purge, "After querying for bug data - if we already have data ffor today, clear it out before loading new data", :default => false
48
49
  end
49
50
  when 'build'
50
51
  Trollop::options do
@@ -98,7 +99,7 @@ check_config
98
99
 
99
100
  case cmd
100
101
  when 'load'
101
- load_records
102
+ load_records(cmd_opts)
102
103
  when 'build'
103
104
  build_reports(cmd_opts)
104
105
  when 'purge'
@@ -1,33 +1,35 @@
1
1
  module Shiftzilla
2
2
  class Bug
3
- attr_reader :id, :first_seen, :last_seen, :test_blocker, :ops_blocker, :owner, :component, :pm_score, :cust_cases, :tgt_release, :summary, :status
3
+ attr_reader :id, :first_seen, :last_seen, :test_blocker, :ops_blocker, :online_blocker, :owner, :component, :pm_score, :cust_cases, :tgt_release, :summary, :status
4
4
 
5
5
  def initialize(bzid,binfo)
6
- @id = bzid
7
- @first_seen = binfo[:snapdate]
8
- @last_seen = binfo[:snapdate]
9
- @test_blocker = binfo[:test_blocker]
10
- @ops_blocker = binfo[:ops_blocker]
11
- @owner = binfo[:owner]
12
- @summary = binfo[:summary]
13
- @status = binfo[:status]
14
- @component = binfo[:component]
15
- @pm_score = binfo[:pm_score]
16
- @cust_cases = binfo[:cust_cases]
17
- @tgt_release = binfo[:tgt_release]
6
+ @id = bzid
7
+ @first_seen = binfo[:snapdate]
8
+ @last_seen = binfo[:snapdate]
9
+ @test_blocker = binfo[:test_blocker]
10
+ @ops_blocker = binfo[:ops_blocker]
11
+ @online_blocker = binfo[:online_blocker]
12
+ @owner = binfo[:owner]
13
+ @summary = binfo[:summary]
14
+ @status = binfo[:status]
15
+ @component = binfo[:component]
16
+ @pm_score = binfo[:pm_score]
17
+ @cust_cases = binfo[:cust_cases]
18
+ @tgt_release = binfo[:tgt_release]
18
19
  end
19
20
 
20
21
  def update(binfo)
21
- @last_seen = binfo[:snapdate]
22
- @test_blocker = binfo[:test_blocker]
23
- @ops_blocker = binfo[:ops_blocker]
24
- @owner = binfo[:owner]
25
- @summary = binfo[:summary]
26
- @status = binfo[:status]
27
- @component = binfo[:component]
28
- @pm_score = binfo[:pm_score]
29
- @cust_cases = binfo[:cust_cases]
30
- @tgt_release = binfo[:tgt_release]
22
+ @last_seen = binfo[:snapdate]
23
+ @test_blocker = binfo[:test_blocker]
24
+ @ops_blocker = binfo[:ops_blocker]
25
+ @online_blocker = binfo[:online_blocker]
26
+ @owner = binfo[:owner]
27
+ @summary = binfo[:summary]
28
+ @status = binfo[:status]
29
+ @component = binfo[:component]
30
+ @pm_score = binfo[:pm_score]
31
+ @cust_cases = binfo[:cust_cases]
32
+ @tgt_release = binfo[:tgt_release]
31
33
  end
32
34
 
33
35
  def age
@@ -64,14 +64,15 @@ module Shiftzilla
64
64
  end
65
65
  end
66
66
 
67
- def load_records
67
+ def load_records(options)
68
68
  sources.each do |s|
69
- if s.has_records_for_today?
69
+ proceed = true
70
+ if s.has_records_for_today? and not options[:purge]
70
71
  puts "Skipping query for #{s.id}; it already has records for today."
71
72
  else
72
73
  backup_db
73
74
  puts "Querying bugzilla for #{s.id}"
74
- added_count = s.load_records
75
+ added_count = s.load_records(options)
75
76
  puts "Added #{added_count} records to #{s.table}"
76
77
  end
77
78
  end
@@ -43,16 +43,17 @@ module Shiftzilla
43
43
 
44
44
  # Package up bug data
45
45
  binfo = {
46
- :snapdate => snapdate,
47
- :test_blocker => keyw.include?('TestBlocker'),
48
- :ops_blocker => keyw.include?('OpsBlocker'),
49
- :owner => owns,
50
- :summary => summ,
51
- :status => stat,
52
- :component => comp,
53
- :pm_score => pmsc,
54
- :cust_cases => (cust == 1),
55
- :tgt_release => tgtr,
46
+ :snapdate => snapdate,
47
+ :test_blocker => keyw.include?('TestBlocker'),
48
+ :ops_blocker => keyw.include?('OpsBlocker'),
49
+ :online_blocker => keyw.include?('OnlineStarter'),
50
+ :owner => owns,
51
+ :summary => summ,
52
+ :status => stat,
53
+ :component => comp,
54
+ :pm_score => pmsc,
55
+ :cust_cases => (cust == 1),
56
+ :tgt_release => tgtr,
56
57
  }
57
58
 
58
59
  tgt_release = @config.release_by_target(tgtr)
@@ -85,7 +86,7 @@ module Shiftzilla
85
86
 
86
87
  # Add info to the snapshot
87
88
  snapdata.bug_ids << bzid
88
- if bug.test_blocker or bug.ops_blocker
89
+ if bug.test_blocker or bug.ops_blocker or bug.online_blocker
89
90
  snapdata.tb_ids << bzid
90
91
  end
91
92
  if bug.cust_cases
@@ -21,13 +21,14 @@ module Shiftzilla
21
21
  return count > 0
22
22
  end
23
23
 
24
- def load_records
24
+ def load_records(options)
25
25
  output_format = @fields.map{ |fld| "%{#{fld.to_s}}" }.join("\x1F")
26
26
  table_fields = @fields.map{ |fld| "\"#{field_map[fld]}\"" }.join(',')
27
27
  insert_frame = @fields.map{ |fld| '?' }.join(', ')
28
28
  bz_command = "bugzilla query --savedsearch #{@search} --savedsearch-sharer-id=#{@sharer} --outputformat='#{output_format}'"
29
29
  bz_csv = `#{bz_command}`
30
30
  row_count = 0
31
+ retrieved = []
31
32
  bz_csv.split("\n").each do |row|
32
33
  values = row.split("\x1F")
33
34
  if not @external_bugs_idx.nil?
@@ -36,10 +37,20 @@ module Shiftzilla
36
37
  else
37
38
  values[@external_bugs_idx] = 0
38
39
  end
39
- end
40
- dbh.execute("INSERT INTO #{@table} (#{table_fields}) VALUES (#{insert_frame})", values)
40
+ end
41
+ retrieved << values
41
42
  row_count += 1
42
43
  end
44
+ puts "Retrieved #{retrieved.length} rows"
45
+ if options[:purge] and retrieved.length > 0
46
+ # We know we have new data, so it is okay to nuke the old data
47
+ puts "Purging old records"
48
+ purge_records
49
+ end
50
+ puts "Loading new records"
51
+ retrieved.each do |values|
52
+ dbh.execute("INSERT INTO #{@table} (#{table_fields}) VALUES (#{insert_frame})", values)
53
+ end
43
54
  dbh.execute("UPDATE #{@table} SET Snapshot = date('now') WHERE Snapshot ISNULL")
44
55
  return row_count
45
56
  end
@@ -1,3 +1,3 @@
1
1
  module Shiftzilla
2
- VERSION = "0.2.11"
2
+ VERSION = "0.2.12"
3
3
  end
data/template.haml CHANGED
@@ -126,7 +126,7 @@
126
126
  %thead
127
127
  %tr
128
128
  %th
129
- %abbr{ :title => 'Test Blocker or Ops Blocker?' } Blocker
129
+ %abbr{ :title => 'Test Blocker, Ops Blocker, or Online Blocker?' } Blocker
130
130
  %th
131
131
  %abbr{ :title => 'See https://mojo.redhat.com/docs/DOC-1159309' } PM
132
132
  %th
@@ -142,8 +142,9 @@
142
142
  - all_bugs.each do |b|
143
143
  %tr
144
144
  %td
145
- = b.test_blocker ? "<span class='badge badge-danger'>TB</span>" : ''
146
- = b.ops_blocker ? "<span class='badge badge-dark'>OB</span>" : ''
145
+ = b.test_blocker ? "<span class='badge badge-danger'>Test</span>" : ''
146
+ = b.ops_blocker ? "<span class='badge badge-dark'>Ops</span>" : ''
147
+ = b.online_blocker ? "<span class='badge badge-warning'>Online</span>" : ''
147
148
  %td= b.pm_score
148
149
  %td= b.cust_cases ? "<span class='badge badge-warning'>CC</span>" : ''
149
150
  %td(data-order="#{b.semver}")= b.tgt_release
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shiftzilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - N. Harrison Ripps
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-10 00:00:00.000000000 Z
11
+ date: 2018-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler