Giuseppe Lavagetto has submitted this change and it was merged.

Change subject: pass flake8 and add entry point
......................................................................


pass flake8 and add entry point

Removed a few unused import (_log) and an unused variable in
test_hostworker.py.

Change-Id: I9cec30eabaaebf2d6a414f94d0b0a88ce8e2f998
---
M puppet_compiler/controller.py
M puppet_compiler/nodegen.py
M puppet_compiler/prepare.py
M puppet_compiler/puppet.py
M puppet_compiler/tests/test_controller.py
M puppet_compiler/tests/test_hostworker.py
M puppet_compiler/threads.py
M setup.py
M tox.ini
9 files changed, 24 insertions(+), 19 deletions(-)

Approvals:
  Giuseppe Lavagetto: Verified; Looks good to me, approved



diff --git a/puppet_compiler/controller.py b/puppet_compiler/controller.py
index c695944..bc532e2 100644
--- a/puppet_compiler/controller.py
+++ b/puppet_compiler/controller.py
@@ -36,7 +36,7 @@
             'puppet_private': 'https://gerrit.wikimedia.org/r/labs/private',
             # Directory hosting all of puppet's runtime files usually
             # under /var/lib/puppet on debian-derivatives
-            'puppet_var':  '/var/lib/catalog-differ/puppet'
+            'puppet_var': '/var/lib/catalog-differ/puppet'
         }
         try:
             if configfile is not None:
@@ -115,7 +115,7 @@
             # We still didn't run
             return True
         f = len(self.state['fail'])
-        return (2*f < self.count)
+        return (2 * f < self.count)
 
     def on_node_compiled(self, payload):
         """
@@ -158,12 +158,12 @@
                                         hostname + '.pson'),
                 'errors': os.path.join(self.m.prod_dir, 'catalogs',
                                        hostname + '.err')
-                },
+            },
             'change': {
                 'catalog': os.path.join(self.m.change_dir, 'catalogs',
                                         hostname + '.pson'),
-                'errors':  os.path.join(self.m.change_dir, 'catalogs',
-                                        hostname + '.err')
+                'errors': os.path.join(self.m.change_dir, 'catalogs',
+                                       hostname + '.err')
             }
         }
         self.hostname = hostname
@@ -222,7 +222,7 @@
         """
         if errors == self.E_OK:
             # Both nodes compiled correctly
-            _log.info("Calculating diffs for %s",self.hostname)
+            _log.info("Calculating diffs for %s", self.hostname)
             try:
                 puppet.diff(self.m.base_dir, self.hostname)
             except subprocess.CalledProcessError as e:
diff --git a/puppet_compiler/nodegen.py b/puppet_compiler/nodegen.py
index 7e0c2f8..5be43ed 100644
--- a/puppet_compiler/nodegen.py
+++ b/puppet_compiler/nodegen.py
@@ -22,7 +22,6 @@
             yield node.replace('.yaml', '')
 
 
-
 class NodeFinder(object):
     regexp_node = re.compile('^node\s+/([^/]+)/')
     exact_node = re.compile("node\s*\'([^\']+)\'")
@@ -57,7 +56,7 @@
                     _log.debug('Found match for node %s: %s', node,
                                regex.pattern)
                     nodes.append(node)
-                    discarded=regex
+                    discarded = regex
                     continue
 
             if discarded is not None:
diff --git a/puppet_compiler/prepare.py b/puppet_compiler/prepare.py
index 9d8f414..66a1e77 100644
--- a/puppet_compiler/prepare.py
+++ b/puppet_compiler/prepare.py
@@ -136,7 +136,7 @@
             'Downloading patch for change %d, revision %d',
             self.change_id, revision)
         git.fetch('-q', 'https://gerrit.wikimedia.org/r/operations/puppet',
-                 ref)
+                  ref)
         git.cherry_pick('FETCH_HEAD')
 
     def _sh(command):
diff --git a/puppet_compiler/puppet.py b/puppet_compiler/puppet.py
index 54ecd15..0783d26 100644
--- a/puppet_compiler/puppet.py
+++ b/puppet_compiler/puppet.py
@@ -2,7 +2,6 @@
 import re
 import subprocess
 from tempfile import SpooledTemporaryFile as spoolfile
-from puppet_compiler import _log
 
 
 def compile(hostname, basedir, vardir):
@@ -24,7 +23,7 @@
            '--templatedir=%s' % tpldir,
            '--compile=%s' % hostname,
            '--color=false'
-    ]
+           ]
     hostfile = os.path.join(catalogdir, hostname)
 
     with open(hostfile + ".err", 'w') as err:
@@ -52,8 +51,8 @@
                                   'catalogs',
                                   hostname + '.pson')
     output = os.path.join(basedir, 'diffs', hostname + '.diff')
-    cmd = [ 'puppet', 'catalog', 'diff', '--show_resource_diff',
-            '--content_diff', prod_catalog, change_catalog]
+    cmd = ['puppet', 'catalog', 'diff', '--show_resource_diff',
+           '--content_diff', prod_catalog, change_catalog]
     temp = spoolfile()
     subprocess.check_call(cmd, stdout=temp)
     with open(output, 'w') as out:
diff --git a/puppet_compiler/tests/test_controller.py 
b/puppet_compiler/tests/test_controller.py
index e9765e1..e5ec10f 100644
--- a/puppet_compiler/tests/test_controller.py
+++ b/puppet_compiler/tests/test_controller.py
@@ -20,7 +20,7 @@
     def test_parse_config(self):
         filename = os.path.join(self.fixtures, 'test_config.yaml')
         c = controller.Controller(filename, 19, 224570, ['test.eqiad.wmnet'])
-        self.assertEquals(len(c.config['test_non_existent']),2)
+        self.assertEquals(len(c.config['test_non_existent']), 2)
         self.assertEquals(c.config['http_url'],
                           'http://www.example.com/garbagehere')
 
diff --git a/puppet_compiler/tests/test_hostworker.py 
b/puppet_compiler/tests/test_hostworker.py
index b8056a0..a253ce6 100644
--- a/puppet_compiler/tests/test_hostworker.py
+++ b/puppet_compiler/tests/test_hostworker.py
@@ -11,8 +11,8 @@
         self.fixtures = os.path.join(os.path.dirname(__file__), 'fixtures')
         self.c = controller.Controller(None, 19, 224570, ['test.eqiad.wmnet'])
         self.m = self.c.m
-        self.hw = hw = controller.HostWorker(self.m,
-                                             'test.codfw.wmnet', 
'/what/you/want')
+        self.hw = controller.HostWorker(self.m,
+                                        'test.codfw.wmnet', '/what/you/want')
 
     def test_initialize(self):
 
diff --git a/puppet_compiler/threads.py b/puppet_compiler/threads.py
index c2a0e75..c5f632b 100644
--- a/puppet_compiler/threads.py
+++ b/puppet_compiler/threads.py
@@ -1,5 +1,4 @@
 import threading
-import logging
 import time
 from collections import namedtuple
 from puppet_compiler import _log
diff --git a/setup.py b/setup.py
index a153dd3..77de45d 100755
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@
 
 def all_files(cwd, path):
     return reduce(lambda x, y: x + y,
-                  [[('%s/%s' % (x[0], y))[len(cwd)+1:]
+                  [[('%s/%s' % (x[0], y))[len(cwd) + 1:]
                     for y in x[2]] for x in os.walk(cwd + '/' + path)])
 
 
diff --git a/tox.ini b/tox.ini
index d7d1c7f..ba97ef9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,13 @@
 [tox]
-envlist = py27
+envlist = py27, flake8
 
 [testenv]
 commands = python setup.py test
+
+[testenv:flake8]
+commands = flake8
+deps = flake8
+
+[flake8]
+# E501 line too long
+ignore= E501

-- 
To view, visit https://gerrit.wikimedia.org/r/233361
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9cec30eabaaebf2d6a414f94d0b0a88ce8e2f998
Gerrit-PatchSet: 1
Gerrit-Project: operations/software/puppet-compiler
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to