Hashar has uploaded a new change for review. https://gerrit.wikimedia.org/r/80963
Change subject: pass pep8 v1.4.6 ...................................................................... pass pep8 v1.4.6 Minor tweaks to have the repo fully compliant with pep8 v1.4.6 Change-Id: I452c95a3caea8c991a447fb597695c7c1949e687 --- M labsnagiosbuilder/build.py M labsnagiosbuilder/tests/TestLdap.py 2 files changed, 20 insertions(+), 17 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/labs/nagios-builder refs/changes/63/80963/1 diff --git a/labsnagiosbuilder/build.py b/labsnagiosbuilder/build.py index 9eac86d..a0d6b07 100755 --- a/labsnagiosbuilder/build.py +++ b/labsnagiosbuilder/build.py @@ -112,7 +112,7 @@ try: ldap_connection.simple_bind_s(ldap_config['binddn'], - ldap_config['bindpw']) + ldap_config['bindpw']) except ldap.LDAPError: logger.error('Could not bind to LDAP') else: @@ -156,11 +156,11 @@ if 'puppetClass' in instance.keys(): for group in groups.keys(): for puppet_class in instance['puppetClass']: - if 'puppet' in groups[group] and \ - puppet_class in groups[group]['puppet']: + if ('puppet' in groups[group] and puppet_class in + groups[group]['puppet']): - logger.debug('Added group %s for %s' % - (puppet_class, instance['dc'][0])) + logger.debug('Added group %s for %s' % ( + puppet_class, instance['dc'][0])) host_groups.append(group) return host_groups @@ -176,7 +176,7 @@ for var in instance['puppetVar']: (k, v) = var.split('=', 1) logger.debug('Found puppet var %s for %s' % - (k, instance['dc'][0])) + (k, instance['dc'][0])) vars[k] = v return vars @@ -210,7 +210,7 @@ logger.debug('Searching ldap for hosts') results = ldap_connection.search_s(ldap_base_dn, ldap.SCOPE_SUBTREE, - ldap_filter, ldap_attrs) + ldap_filter, ldap_attrs) if not results: logger.error('Could not get the list of hosts from ldap') @@ -261,7 +261,8 @@ for pclass in hosts[dc]['puppet_classes']: pclass = '/'.join(pclass.split('::')) mclass_file = "%s.cfg" % os.path.join('classes', pclass) - fmclass_file = os.path.abspath(os.path.join(base_path, 'templates', mclass_file)) + fmclass_file = os.path.abspath(os.path.join( + base_path, 'templates', mclass_file)) if not fmclass_file.startswith(base_path): logging.debug('Skipping %s as it looks dodgy' % mclass_file) @@ -275,7 +276,7 @@ def write_nagios_configs(hosts): jinja2_env = Environment(loader=PackageLoader('labsnagiosbuilder', - 'templates')) + 'templates')) template = jinja2_env.get_template('group.cfg') for group in groups.keys(): @@ -287,7 +288,8 @@ template = jinja2_env.get_template('host.cfg') for host in hosts.keys(): - file_path = os.path.join(nagios_config_dir, '%s.cfg' % hosts[host]['fqdn']) + file_path = os.path.join(nagios_config_dir, '%s.cfg' % + hosts[host]['fqdn']) with open(file_path, 'w') as fh: logger.debug('Writing out host %s to %s' % (host, file_path)) fh.write(template.render(host=hosts[host])) @@ -312,13 +314,11 @@ cfg = file_path[:-4] # Old instances - if not cfg.startswith('group-') and \ - cfg not in ok_hosts: + if not cfg.startswith('group-') and cfg not in ok_hosts: remove_files.append(file_path) # Old groups - if cfg.startswith('group-') and \ - cfg[6:] not in groups.keys(): + if cfg.startswith('group-') and cfg[6:] not in groups.keys(): remove_files.append(file_path) for cfg in remove_files: @@ -369,8 +369,8 @@ if options.config_dir: nagios_config_dir = options.config_dir - if not os.path.isdir(nagios_config_dir) and \ - not os.makedirs(nagios_config_dir): + if (not os.path.isdir(nagios_config_dir) + and not os.makedirs(nagios_config_dir)): logger.error('Could not create config dir') sys.exit(2) diff --git a/labsnagiosbuilder/tests/TestLdap.py b/labsnagiosbuilder/tests/TestLdap.py index a298af1..5e7775b 100644 --- a/labsnagiosbuilder/tests/TestLdap.py +++ b/labsnagiosbuilder/tests/TestLdap.py @@ -23,7 +23,10 @@ 'lucene-frontend': { 'description': 'Lucene frontend servers', 'hosts': [], - 'puppet': ['role::lucene::front-end', 'role::lucene::front_end::poolbeta'] + 'puppet': [ + 'role::lucene::front-end', + 'role::lucene::front_end::poolbeta', + ], }, } -- To view, visit https://gerrit.wikimedia.org/r/80963 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I452c95a3caea8c991a447fb597695c7c1949e687 Gerrit-PatchSet: 1 Gerrit-Project: labs/nagios-builder Gerrit-Branch: master Gerrit-Owner: Hashar <has...@free.fr> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits