Fixed issues with relative directories

This commit is contained in:
Joachim Lusiardi 2016-04-12 07:29:39 +02:00
parent 6d93f9094b
commit b3e75e564e

View File

@ -113,10 +113,11 @@ def create_haproxy_cert():
youngest_directory = '' youngest_directory = ''
for root, directories, files in os.walk('/data/config/live'): for root, directories, files in os.walk('/data/config/live'):
for directory in directories: for directory in directories:
modify_time = os.stat(directory).st_mtime modify_time = os.stat('/data/config/live/' + directory).st_mtime
if modify_time > youngest_modify_time: if modify_time > youngest_modify_time:
youngest_modify_time = modify_time youngest_modify_time = modify_time
youngest_directory = directory youngest_directory = directory
youngest_directory = '/data/config/live/' + youngest_directory
logging.info('using %s as base dir', youngest_directory) logging.info('using %s as base dir', youngest_directory)
@ -124,7 +125,7 @@ def create_haproxy_cert():
fullchain = read_file(youngest_directory + '/fullchain.pem') fullchain = read_file(youngest_directory + '/fullchain.pem')
privkey = read_file(youngest_directory + '/privkey.pem') privkey = read_file(youngest_directory + '/privkey.pem')
write_file(cert_file, fullchain + privkey) write_file(cert_file, fullchain + privkey)
logging.info('file written')
def create_cert_data_standalone(domains): def create_cert_data_standalone(domains):
domains = " -d ".join(domains) domains = " -d ".join(domains)