Skip to content

Commit b88fba8

Browse files
committed
compare-puppet-catalogs: fix small bugs
- Fixed the bug that swapped new and old resources missing. - Fixed the line numbering in diffs. - Now we output a reminder of the index url when it gets updated. - Will do a minor version bump Change-Id: Ie238b78444a4e20751093e2d693d5f534679175d Signed-off-by: Giuseppe Lavagetto <glavagetto@wikimedia.org>
1 parent 89018f2 commit b88fba8

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

compare-puppet-catalogs/puppet_compare/diff2html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,12 @@ def add_line(s1, s2):
312312
res['line2'] = ''
313313
s2 = ""
314314

315-
return ('diffline', res)
316315
if s1 != "":
317316
line1 += 1
318317
if s2 != "":
319318
line2 += 1
320319

320+
return ('diffline', res)
321321

322322
def empty_buffer(output):
323323
global buf

compare-puppet-catalogs/puppet_compare/generator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,14 @@ def on_node_compiled(self, msg):
165165
node = msg['data'][0][0]
166166
self.count += 1
167167
if not self.count % 5:
168-
log.info('Updating index.html')
169168
self.update_index()
170-
log.info("Nodes: %s OK %s DIFF %s FAIL" % (
169+
log.info('Index updated, you can see detailed progress for your work at %s/%s', self.host, self.html_path)
170+
log.info(
171+
"Nodes: %s OK %s DIFF %s FAIL",
171172
len(self.nodelist['OK']),
172173
len(self.nodelist['DIFF']),
173174
len(self.nodelist['ERROR'])
174-
))
175+
)
175176

176177
def node_output(self, node):
177178
if node in self.nodelist['ERROR']:

compare-puppet-catalogs/puppet_compare/parser.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77

88
log = logging.getLogger('puppet_compare')
99

10-
11-
def contains(haystack, needle):
12-
return (haystack.find(needle) >= 0)
13-
14-
1510
class DiffParser(object):
1611

1712
def __init__(self, filename, nodename):
@@ -31,9 +26,9 @@ def run(self):
3126
new_content)
3227

3328
if self._diffs['only_in_old']:
34-
self._get_diffs('old_missing', [], self._diffs['only_in_old'])
29+
self._get_diffs('missing_in_new', self._diffs['only_in_old'], [])
3530
if self._diffs['only_in_new']:
36-
self._get_diffs('new_missing', self._diffs['only_in_new'], [])
31+
self._get_diffs('missing_in_old', [], self._diffs['only_in_new'])
3732

3833
return self.results
3934

0 commit comments

Comments
 (0)