Compare commits

..

No commits in common. "04d1f1ca7f97e876836cd5d0616555e862437330" and "cb2f3402772212f2b1de980b72a8765ee5c78d45" have entirely different histories.

2 changed files with 14 additions and 12 deletions

View File

@ -237,7 +237,7 @@ gulp.task('addUrlContextPath',['addUrlContextPath:revreplace'], function(){
.forEach(function(file){ .forEach(function(file){
return gulp.src(file) return gulp.src(file)
.pipe(gulpif(urlContextPathExists, replace('api/', argv.urlContextPath + '/api/'))) .pipe(gulpif(urlContextPathExists, replace('api/', argv.urlContextPath + '/api/')))
.pipe(gulpif(urlContextPathExists, replace('/angular/', '/' + argv.urlContextPath + '/angular/'))) .pipe(gulpif(urlContextPathExists, replace('angular/', argv.urlContextPath + '/angular/')))
.pipe(gulp.dest(function(file){ .pipe(gulp.dest(function(file){
return file.base; return file.base;
})) }))
@ -256,9 +256,10 @@ gulp.task('addUrlContextPath:revreplace', ['addUrlContextPath:revision'], functi
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; 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')); .pipe(gulp.dest('lemur/static/dist'));
}) })
gulp.task('build', ['build:ngviews', 'build:inject', 'build:images', 'build:fonts', 'build:html', 'build:extras']); gulp.task('build', ['build:ngviews', 'build:inject', 'build:images', 'build:fonts', 'build:html', 'build:extras']);
gulp.task('package', ['addUrlContextPath', 'package:strip']); gulp.task('package', ['addUrlContextPath', 'package:strip']);

View File

@ -35,11 +35,11 @@ from lemur.common import utils
import time import time
import datetime import datetime
import logging log_file = open('db_upgrade.log', 'a')
log = logging.getLogger(__name__)
def upgrade(): def upgrade():
log.info("\n*** Starting new run(%s) ***\n" % datetime.datetime.now()) log_file.write("\n*** Starting new run(%s) ***\n" % datetime.datetime.now())
start_time = time.time() start_time = time.time()
# Update RSA keys using the key length information # Update RSA keys using the key length information
@ -50,7 +50,8 @@ def upgrade():
# Process remaining certificates. Though below method does not make any assumptions, most of the remaining ones should be ECC certs. # Process remaining certificates. Though below method does not make any assumptions, most of the remaining ones should be ECC certs.
update_key_type() update_key_type()
log.info("--- Total %s seconds ---\n" % (time.time() - start_time)) log_file.write("--- Total %s seconds ---\n" % (time.time() - start_time))
log_file.close()
def downgrade(): def downgrade():
@ -68,18 +69,18 @@ def downgrade():
def update_key_type_rsa(bits): def update_key_type_rsa(bits):
log.info("Processing certificate with key type RSA %s\n" % bits) log_file.write("Processing certificate with key type RSA %s\n" % bits)
stmt = text( stmt = text(
f"update certificates set key_type='RSA{bits}' where bits={bits} and not_after > CURRENT_DATE - 31 and key_type is null" f"update certificates set key_type='RSA{bits}' where bits={bits} and not_after > CURRENT_DATE - 31 and key_type is null"
) )
log.info("Query: %s\n" % stmt) log_file.write("Query: %s\n" % stmt)
start_time = time.time() start_time = time.time()
op.execute(stmt) op.execute(stmt)
commit() commit()
log.info("--- %s seconds ---\n" % (time.time() - start_time)) log_file.write("--- %s seconds ---\n" % (time.time() - start_time))
def update_key_type(): def update_key_type():
@ -94,9 +95,9 @@ def update_key_type():
try: try:
cert_key_type = utils.get_key_type_from_certificate(body) cert_key_type = utils.get_key_type_from_certificate(body)
except ValueError as e: except ValueError as e:
log.info("Error in processing certificate - ID: %s Error: %s \n" % (cert_id, str(e))) log_file.write("Error in processing certificate - ID: %s Error: %s \n" % (cert_id, str(e)))
else: else:
log.info("Processing certificate - ID: %s key_type: %s\n" % (cert_id, cert_key_type)) log_file.write("Processing certificate - ID: %s key_type: %s\n" % (cert_id, cert_key_type))
stmt = text( stmt = text(
"update certificates set key_type=:key_type where id=:id" "update certificates set key_type=:key_type where id=:id"
) )
@ -105,7 +106,7 @@ def update_key_type():
commit() commit()
log.info("--- %s seconds ---\n" % (time.time() - start_time)) log_file.write("--- %s seconds ---\n" % (time.time() - start_time))
def commit(): def commit():