From 1b77dfa47a310a3c72f9e869e7cd6d84f5658304 Mon Sep 17 00:00:00 2001 From: Curtis Date: Wed, 22 Aug 2018 13:21:35 -0700 Subject: [PATCH] Revert "Precommit - Fix linty things" --- .bowerrc | 2 +- .jshintrc | 28 +++---- .pre-commit-config.yaml | 6 -- bower.json | 78 +++++++++--------- docs/administration.rst | 2 +- docs/conf.py | 16 ++-- docs/production/index.rst | 12 +-- gulp/build.js | 14 ++-- gulp/karma.conf.js | 4 +- gulp/server.js | 2 +- lemur/auth/ldap.py | 1 - lemur/auth/views.py | 10 +-- lemur/authorities/views.py | 1 - lemur/common/fields.py | 2 - lemur/defaults/views.py | 1 - lemur/destinations/views.py | 3 - lemur/domains/views.py | 2 - lemur/endpoints/views.py | 1 - lemur/logs/views.py | 1 - lemur/migrations/env.py | 2 +- lemur/migrations/versions/29d8c8455c86_.py | 38 ++++----- lemur/migrations/versions/33de094da890_.py | 7 +- lemur/migrations/versions/3adfdd6598df_.py | 1 - lemur/migrations/versions/412b22cb656a_.py | 12 +-- lemur/migrations/versions/4c50b903d1ae_.py | 1 - lemur/migrations/versions/556ceb3e3c3e_.py | 79 +++++++++---------- lemur/migrations/versions/5770674184de_.py | 2 +- lemur/migrations/versions/c05a8998b371_.py | 15 ++-- lemur/migrations/versions/ce547319f7be_.py | 1 - lemur/migrations/versions/e3691fc396e9_.py | 15 ++-- lemur/notifications/views.py | 2 - lemur/plugins/views.py | 2 - lemur/roles/views.py | 3 - lemur/sources/views.py | 2 - .../destination/destination.tpl.html | 2 +- .../dns_provider/dns_provider.tpl.html | 2 +- lemur/tests/js/.jshintrc | 33 ++++---- lemur/tests/test_ldap.py | 2 +- lemur/users/views.py | 1 - package.json | 28 +++---- requirements-dev.txt | 2 +- requirements-docs.txt | 2 +- requirements-tests.txt | 8 +- requirements.txt | 6 +- setup.py | 1 - 45 files changed, 208 insertions(+), 247 deletions(-) diff --git a/.bowerrc b/.bowerrc index 69fad358..44491d3d 100644 --- a/.bowerrc +++ b/.bowerrc @@ -1,3 +1,3 @@ { - "directory": "bower_components" + "directory": "bower_components" } diff --git a/.jshintrc b/.jshintrc index fbb95838..5962a012 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,29 +1,29 @@ { - "bitwise": true, + "node": true, "browser": true, + "esnext": true, + "bitwise": true, "camelcase": false, "curly": true, "eqeqeq": true, - "esnext": true, - "globals": { - "_": false, - "angular": false, - "d3": false, - "moment": false, - "self": false, - "toaster": false - }, "immed": true, "indent": 2, "latedef": false, "newcap": false, "noarg": true, - "node": true, "quotmark": "single", "regexp": true, - "smarttabs": true, + "undef": true, + "unused": true, "strict": true, "trailing": true, - "undef": true, - "unused": true + "smarttabs": true, + "globals": { + "angular": false, + "moment": false, + "toaster": false, + "d3": false, + "self": false, + "_": false + } } diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 904adc32..f3d19151 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,12 +4,6 @@ - id: trailing-whitespace - id: flake8 - id: check-merge-conflict - - id: pretty-format-json - - id: check-ast - - id: check-case-conflict - - id: check-yaml - - id: autopep8-wrapper - - repo: git://github.com/pre-commit/mirrors-jshint sha: v2.9.5 hooks: diff --git a/bower.json b/bower.json index 51090e6c..f7d5500d 100644 --- a/bower.json +++ b/bower.json @@ -1,39 +1,50 @@ { + "name": "lemur", + "repository": { + "type": "git", + "url": "git://github.com/netflix/lemur.git" + }, + "private": true, "dependencies": { + "jquery": "~2.2.0", + "angular-wizard": "~0.4.0", "angular": "1.4.9", - "angular-animate": "~1.4.9", + "json3": "~3.3", + "es5-shim": "~4.5.0", + "bootstrap": "~3.3.6", "angular-bootstrap": "~1.1.1", - "angular-chart.js": "~0.8.8", - "angular-clipboard": "~1.3.0", - "angular-file-saver": "~1.0.1", + "angular-animate": "~1.4.9", + "restangular": "~1.5.1", + "ng-table": "~0.8.3", + "moment": "~2.11.1", "angular-loading-bar": "~0.8.0", "angular-moment": "~0.10.3", - "angular-sanitize": "~1.5.0", + "moment-range": "~2.1.0", + "angular-clipboard": "~1.3.0", + "angularjs-toaster": "~1.0.0", + "angular-chart.js": "~0.8.8", + "ngletteravatar": "~4.0.0", + "bootswatch": "~3.3.6", + "fontawesome": "~4.5.0", + "satellizer": "~0.13.4", + "angular-ui-router": "~0.2.15", + "font-awesome": "~4.5.0", + "lodash": "~4.0.1", + "underscore": "~1.8.3", "angular-smart-table": "2.1.8", "angular-strap": ">= 2.2.2", - "angular-translate": "^2.9.0", - "angular-ui-router": "~0.2.15", - "angular-ui-select": "~0.17.1", - "angular-ui-switch": "~0.1.0", "angular-underscore": "^0.5.0", - "angular-wizard": "~0.4.0", - "angularjs-toaster": "~1.0.0", - "bootstrap": "~3.3.6", - "bootswatch": "~3.3.6", - "d3": "^3.5.17", - "es5-shim": "~4.5.0", - "font-awesome": "~4.5.0", - "fontawesome": "~4.5.0", - "jquery": "~2.2.0", - "json3": "~3.3", - "lodash": "~4.0.1", - "moment": "~2.11.1", - "moment-range": "~2.1.0", - "ng-table": "~0.8.3", - "ngletteravatar": "~4.0.0", - "restangular": "~1.5.1", - "satellizer": "~0.13.4", - "underscore": "~1.8.3" + "angular-translate": "^2.9.0", + "angular-ui-switch": "~0.1.0", + "angular-sanitize": "~1.5.0", + "angular-file-saver": "~1.0.1", + "angular-ui-select": "~0.17.1", + "d3": "^3.5.17" + }, + "resolutions": { + "moment": ">=2.8.0 <2.11.0", + "lodash": ">=1.3.0 <2.5.0", + "angular": "1.4.9" }, "ignore": [ "**/.*", @@ -41,16 +52,5 @@ "bower_components", "test", "tests" - ], - "name": "lemur", - "private": true, - "repository": { - "type": "git", - "url": "git://github.com/netflix/lemur.git" - }, - "resolutions": { - "angular": "1.4.9", - "lodash": ">=1.3.0 <2.5.0", - "moment": ">=2.8.0 <2.11.0" - } + ] } diff --git a/docs/administration.rst b/docs/administration.rst index 610acc56..eec01cc5 100644 --- a/docs/administration.rst +++ b/docs/administration.rst @@ -313,7 +313,7 @@ LDAP support requires the pyldap python library, which also depends on the follo To configure the use of an LDAP server, a number of settings need to be configured in `lemur.conf.py`. Here is an example LDAP configuration stanza you can add to your config. Adjust to suit your environment of course. - + .. code-block:: python LDAP_AUTH = True diff --git a/docs/conf.py b/docs/conf.py index a719f545..d5b1698c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -203,21 +203,21 @@ htmlhelp_basename = 'lemurdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # 'papersize': 'letterpaper', +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # 'pointsize': '10pt', +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # 'preamble': '', +# Additional stuff for the LaTeX preamble. +#'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'lemur.tex', u'Lemur Documentation', + ('index', 'lemur.tex', u'Lemur Documentation', u'Kevin Glisson', 'manual'), ] @@ -261,7 +261,7 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'Lemur', u'Lemur Documentation', + ('index', 'Lemur', u'Lemur Documentation', u'Kevin Glisson', 'Lemur', 'SSL Certificate Management', 'Miscellaneous'), ] diff --git a/docs/production/index.rst b/docs/production/index.rst index b7aa22c4..42f6648a 100644 --- a/docs/production/index.rst +++ b/docs/production/index.rst @@ -217,23 +217,23 @@ An example apache config:: # HSTS (mod_headers is required) (15768000 seconds = 6 months) Header always set Strict-Transport-Security "max-age=15768000" ... - + # Set the lemur DocumentRoot to static/dist DocumentRoot /www/lemur/lemur/static/dist - + # Uncomment to force http 1.0 connections to proxy # SetEnv force-proxy-request-1.0 1 - + #Don't keep proxy connections alive SetEnv proxy-nokeepalive 1 - + # Only need to do reverse proxy ProxyRequests Off - + # Proxy requests to the api to the lemur service (and sanitize redirects from it) ProxyPass "/api" "http://127.0.0.1:8000/api" ProxyPassReverse "/api" "http://127.0.0.1:8000/api" - + Also included in the configurations above are several best practices when it comes to deploying TLS. Things like enabling diff --git a/gulp/build.js b/gulp/build.js index 284eed6b..eed59503 100644 --- a/gulp/build.js +++ b/gulp/build.js @@ -240,8 +240,8 @@ gulp.task('addUrlContextPath',['addUrlContextPath:revreplace'], function(){ .pipe(gulpif(urlContextPathExists, replace('angular/', argv.urlContextPath + '/angular/'))) .pipe(gulp.dest(function(file){ return file.base; - })); - }); + })) + }) }); gulp.task('addUrlContextPath:revision', function(){ @@ -249,16 +249,16 @@ gulp.task('addUrlContextPath:revision', function(){ .pipe(rev()) .pipe(gulp.dest('lemur/static/dist')) .pipe(rev.manifest()) - .pipe(gulp.dest('lemur/static/dist')); -}); + .pipe(gulp.dest('lemur/static/dist')) +}) gulp.task('addUrlContextPath:revreplace', ['addUrlContextPath:revision'], function(){ - var manifest = gulp.src('lemur/static/dist/rev-manifest.json'); + var manifest = gulp.src("lemur/static/dist/rev-manifest.json"); var urlContextPathExists = argv.urlContextPath ? true : false; - return gulp.src('lemur/static/dist/index.html') + return gulp.src( "lemur/static/dist/index.html") .pipe(gulpif(urlContextPathExists, revReplace({prefix: argv.urlContextPath + '/', manifest: manifest}, revReplace({manifest: manifest})))) .pipe(gulp.dest('lemur/static/dist')); -}); +}) gulp.task('build', ['build:ngviews', 'build:inject', 'build:images', 'build:fonts', 'build:html', 'build:extras']); diff --git a/gulp/karma.conf.js b/gulp/karma.conf.js index 527f9cb9..b9777c7a 100644 --- a/gulp/karma.conf.js +++ b/gulp/karma.conf.js @@ -1,12 +1,10 @@ -'use strict'; // Contents of: config/karma.conf.js - module.exports = function (config) { config.set({ basePath : '../', // Fix for "JASMINE is not supported anymore" warning - frameworks : ['jasmine'], + frameworks : ["jasmine"], files : [ 'app/lib/angular/angular.js', diff --git a/gulp/server.js b/gulp/server.js index 87f526c8..777100f6 100644 --- a/gulp/server.js +++ b/gulp/server.js @@ -3,7 +3,7 @@ var gulp = require('gulp'); var browserSync = require('browser-sync'); -require('http-proxy'); +var httpProxy = require('http-proxy'); /* This configuration allow you to configure browser sync to proxy your backend */ /* diff --git a/lemur/auth/ldap.py b/lemur/auth/ldap.py index a4ac44ee..398a5830 100644 --- a/lemur/auth/ldap.py +++ b/lemur/auth/ldap.py @@ -18,7 +18,6 @@ class LdapPrincipal(): """ Provides methods for authenticating against an LDAP server. """ - def __init__(self, args): self._ldap_validate_conf() # setup ldap config diff --git a/lemur/auth/views.py b/lemur/auth/views.py index 13c26904..7a1bb34c 100644 --- a/lemur/auth/views.py +++ b/lemur/auth/views.py @@ -211,7 +211,6 @@ class Login(Resource): on your uses cases but. It is important to not that there is currently no build in method to revoke a users token \ and force re-authentication. """ - def __init__(self): self.reqparse = reqparse.RequestParser() super(Login, self).__init__() @@ -283,10 +282,10 @@ class Login(Resource): metrics.send('login', 'counter', 1, metric_tags={'status': SUCCESS_METRIC_STATUS}) return dict(token=create_token(user)) except Exception as e: - current_app.logger.error("ldap error: {0}".format(e)) - ldap_message = 'ldap error: %s' % e - metrics.send('login', 'counter', 1, metric_tags={'status': FAILURE_METRIC_STATUS}) - return dict(message=ldap_message), 403 + current_app.logger.error("ldap error: {0}".format(e)) + ldap_message = 'ldap error: %s' % e + metrics.send('login', 'counter', 1, metric_tags={'status': FAILURE_METRIC_STATUS}) + return dict(message=ldap_message), 403 # if not valid user - no certificates for you metrics.send('login', 'counter', 1, metric_tags={'status': FAILURE_METRIC_STATUS}) @@ -303,7 +302,6 @@ class Ping(Resource): provider uses for its callbacks. 2. Add or change the Lemur AngularJS Configuration to point to your new provider """ - def __init__(self): self.reqparse = reqparse.RequestParser() super(Ping, self).__init__() diff --git a/lemur/authorities/views.py b/lemur/authorities/views.py index 25fb9000..b85c9b70 100644 --- a/lemur/authorities/views.py +++ b/lemur/authorities/views.py @@ -25,7 +25,6 @@ api = Api(mod) class AuthoritiesList(AuthenticatedResource): """ Defines the 'authorities' endpoint """ - def __init__(self): self.reqparse = reqparse.RequestParser() super(AuthoritiesList, self).__init__() diff --git a/lemur/common/fields.py b/lemur/common/fields.py index aa40cdcb..9a0198e9 100644 --- a/lemur/common/fields.py +++ b/lemur/common/fields.py @@ -25,7 +25,6 @@ class Hex(Field): """ A hex formatted string. """ - def _serialize(self, value, attr, obj): if value: value = hex(int(value))[2:].upper() @@ -318,7 +317,6 @@ class SubjectAlternativeNameExtension(Field): :param kwargs: The same keyword arguments that :class:`Field` receives. """ - def _serialize(self, value, attr, obj): general_names = [] name_type = None diff --git a/lemur/defaults/views.py b/lemur/defaults/views.py index b4ead848..5a573829 100644 --- a/lemur/defaults/views.py +++ b/lemur/defaults/views.py @@ -19,7 +19,6 @@ api = Api(mod) class LemurDefaults(AuthenticatedResource): """ Defines the 'defaults' endpoint """ - def __init__(self): super(LemurDefaults) diff --git a/lemur/destinations/views.py b/lemur/destinations/views.py index 6e890f98..7084e8e9 100644 --- a/lemur/destinations/views.py +++ b/lemur/destinations/views.py @@ -24,7 +24,6 @@ api = Api(mod) class DestinationsList(AuthenticatedResource): """ Defines the 'destinations' endpoint """ - def __init__(self): self.reqparse = reqparse.RequestParser() super(DestinationsList, self).__init__() @@ -336,7 +335,6 @@ class Destinations(AuthenticatedResource): class CertificateDestinations(AuthenticatedResource): """ Defines the 'certificate/
- diff --git a/lemur/static/app/angular/dns_providers/dns_provider/dns_provider.tpl.html b/lemur/static/app/angular/dns_providers/dns_provider/dns_provider.tpl.html index 9ff6a1b8..85882de1 100644 --- a/lemur/static/app/angular/dns_providers/dns_provider/dns_provider.tpl.html +++ b/lemur/static/app/angular/dns_providers/dns_provider/dns_provider.tpl.html @@ -42,7 +42,7 @@ {{ item.name | titleCase }}
- diff --git a/lemur/tests/js/.jshintrc b/lemur/tests/js/.jshintrc index 7ce6fe1f..b1be025b 100644 --- a/lemur/tests/js/.jshintrc +++ b/lemur/tests/js/.jshintrc @@ -1,10 +1,23 @@ { - "bitwise": true, + "node": true, "browser": true, + "esnext": true, + "bitwise": true, "camelcase": true, "curly": true, "eqeqeq": true, - "esnext": true, + "immed": true, + "indent": 2, + "latedef": true, + "newcap": true, + "noarg": true, + "quotmark": "single", + "regexp": true, + "undef": true, + "unused": true, + "strict": true, + "trailing": true, + "smarttabs": true, "globals": { "after": false, "afterEach": false, @@ -18,18 +31,6 @@ "it": false, "jasmine": false, "spyOn": false - }, - "immed": true, - "indent": 2, - "latedef": true, - "newcap": true, - "noarg": true, - "node": true, - "quotmark": "single", - "regexp": true, - "smarttabs": true, - "strict": true, - "trailing": true, - "undef": true, - "unused": true + } } + diff --git a/lemur/tests/test_ldap.py b/lemur/tests/test_ldap.py index 6e0c0a54..a636afdc 100644 --- a/lemur/tests/test_ldap.py +++ b/lemur/tests/test_ldap.py @@ -1,5 +1,5 @@ import pytest -from lemur.auth.ldap import * # noqa +from lemur.auth.ldap import * # noqa from mock import patch, MagicMock diff --git a/lemur/users/views.py b/lemur/users/views.py index 01972c74..eb67f014 100644 --- a/lemur/users/views.py +++ b/lemur/users/views.py @@ -27,7 +27,6 @@ api = Api(mod) class UsersList(AuthenticatedResource): """ Defines the 'users' endpoint """ - def __init__(self): self.reqparse = reqparse.RequestParser() super(UsersList, self).__init__() diff --git a/package.json b/package.json index d18485da..f47978db 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,10 @@ { + "name": "Lemur", + "private": true, + "repository": { + "type": "git", + "url": "git://github.com/netflix/lemur.git" + }, "dependencies": { "bower": "^1.8.2", "browser-sync": "^2.3.1", @@ -45,22 +51,16 @@ "uglify-save-license": "^0.4.1", "yargs": "^7.0.2" }, + "scripts": { + "postinstall": "node_modules/.bin/bower install --allow-root --config.interactive=false", + "pretest": "npm install && npm run build_static", + "build_static": "gulp build", + "prelint": "npm install", + "lint": "jshint lemur/static/app/", + "test": "gulp test" + }, "devDependencies": { "jshint": "^2.8.0", "karma-chrome-launcher": "^2.0.0" - }, - "name": "Lemur", - "private": true, - "repository": { - "type": "git", - "url": "git://github.com/netflix/lemur.git" - }, - "scripts": { - "build_static": "gulp build", - "lint": "jshint lemur/static/app/", - "postinstall": "node_modules/.bin/bower install --allow-root --config.interactive=false", - "prelint": "npm install", - "pretest": "npm install && npm run build_static", - "test": "gulp test" } } diff --git a/requirements-dev.txt b/requirements-dev.txt index ec21eb70..cb9be135 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -24,7 +24,7 @@ requests-toolbelt==0.8.0 # via twine requests==2.19.1 # via requests-toolbelt, twine six==1.11.0 # via cfgv, pre-commit toml==0.9.4 # via pre-commit -tqdm==4.25.0 # via twine +tqdm==4.24.0 # via twine twine==1.11.0 urllib3==1.23 # via requests virtualenv==16.0.0 # via pre-commit diff --git a/requirements-docs.txt b/requirements-docs.txt index 91885da7..22621681 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -79,7 +79,7 @@ s3transfer==0.1.13 six==1.11.0 snowballstemmer==1.2.1 # via sphinx sphinx-rtd-theme==0.4.1 -sphinx==1.7.7 +sphinx==1.7.6 sphinxcontrib-httpdomain==1.7.0 sphinxcontrib-websupport==1.1.0 # via sphinx sqlalchemy-utils==0.33.3 diff --git a/requirements-tests.txt b/requirements-tests.txt index 966c0756..2575b631 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -8,9 +8,9 @@ asn1crypto==0.24.0 # via cryptography atomicwrites==1.1.5 # via pytest attrs==18.1.0 # via pytest aws-xray-sdk==0.95 # via moto -boto3==1.7.82 # via moto +boto3==1.7.79 # via moto boto==2.49.0 # via moto -botocore==1.10.82 # via boto3, moto, s3transfer +botocore==1.10.79 # via boto3, moto, s3transfer certifi==2018.8.13 # via requests cffi==1.11.5 # via cryptography chardet==3.0.4 # via requests @@ -47,7 +47,7 @@ pycryptodome==3.6.6 # via python-jose pyflakes==2.0.0 pytest-flask==0.10.0 pytest-mock==1.10.0 -pytest==3.7.2 +pytest==3.7.1 python-dateutil==2.7.3 # via botocore, faker, freezegun, moto python-jose==2.0.2 # via moto pytz==2018.5 # via moto @@ -59,7 +59,7 @@ s3transfer==0.1.13 # via boto3 six==1.11.0 # via cryptography, docker, docker-pycreds, faker, freezegun, mock, more-itertools, moto, pytest, python-dateutil, python-jose, requests-mock, responses, websocket-client text-unidecode==1.2 # via faker urllib3==1.23 # via requests -websocket-client==0.51.0 # via docker +websocket-client==0.49.0 # via docker werkzeug==0.14.1 # via flask, moto, pytest-flask wrapt==1.10.11 # via aws-xray-sdk xmltodict==0.11.0 # via moto diff --git a/requirements.txt b/requirements.txt index 3e8ee223..5503758b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,8 +13,8 @@ asn1crypto==0.24.0 # via cryptography asyncpool==1.0 bcrypt==3.1.4 # via flask-bcrypt, paramiko blinker==1.4 # via flask-mail, flask-principal, raven -boto3==1.7.82 -botocore==1.10.82 # via boto3, s3transfer +boto3==1.7.79 +botocore==1.10.79 # via boto3, s3transfer certifi==2018.8.13 cffi==1.11.5 # via bcrypt, cryptography, pynacl chardet==3.0.4 # via requests @@ -73,7 +73,7 @@ retrying==1.3.3 s3transfer==0.1.13 # via boto3 six==1.11.0 sqlalchemy-utils==0.33.3 -sqlalchemy==1.2.11 # via alembic, flask-sqlalchemy, marshmallow-sqlalchemy, sqlalchemy-utils +sqlalchemy==1.2.10 # via alembic, flask-sqlalchemy, marshmallow-sqlalchemy, sqlalchemy-utils tabulate==0.8.2 urllib3==1.23 # via requests werkzeug==0.14.1 # via flask diff --git a/setup.py b/setup.py index 6cecad32..1511b013 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,6 @@ class SmartInstall(install): If the package indicator is missing, this will also force a run of `build_static` which is required for JavaScript assets and other things. """ - def _needs_static(self): return not os.path.exists(os.path.join(ROOT, 'lemur/static/dist'))