Merge pull request #72 from kevgliss/docker

[WIP] Docker
This commit is contained in:
kevgliss 2015-09-11 15:36:25 -07:00
commit d3cf273a45
2 changed files with 17 additions and 11 deletions

View File

@ -263,16 +263,21 @@ class InitializeApp(Command):
Additionally a Lemur user will be created as a default user Additionally a Lemur user will be created as a default user
and be used when certificates are discovered by Lemur. and be used when certificates are discovered by Lemur.
""" """
def run(self): option_list = (
Option('-p', '--password', dest='password'),
)
def run(self, password):
create() create()
user = user_service.get_by_username("lemur") user = user_service.get_by_username("lemur")
if not user: if not user:
if not password:
sys.stdout.write("We need to set Lemur's password to continue!\n") sys.stdout.write("We need to set Lemur's password to continue!\n")
password1 = prompt_pass("Password") password = prompt_pass("Password")
password2 = prompt_pass("Confirm Password") password1 = prompt_pass("Confirm Password")
if password1 != password2: if password != password1:
sys.stderr.write("[!] Passwords do not match!\n") sys.stderr.write("[!] Passwords do not match!\n")
sys.exit(1) sys.exit(1)
@ -285,16 +290,16 @@ class InitializeApp(Command):
role = role_service.create('admin', description='this is the lemur administrator role') role = role_service.create('admin', description='this is the lemur administrator role')
sys.stdout.write("[+] Created 'admin' role\n") sys.stdout.write("[+] Created 'admin' role\n")
user_service.create("lemur", password1, 'lemur@nobody', True, None, [role]) user_service.create("lemur", password, 'lemur@nobody', True, None, [role])
sys.stdout.write("[+] Added a 'lemur' user and added it to the 'admin' role!\n") sys.stdout.write("[+] Added a 'lemur' user and added it to the 'admin' role!\n")
else: else:
sys.stdout.write("[-] Default user has already been created, skipping...!\n") sys.stdout.write("[-] Default user has already been created, skipping...!\n")
sys.stdout.write("[+] Creating expiration email notifications!\n") sys.stdout.write("[+] Creating expiration email notifications!\n")
sys.stdout.write("[!] Using {recipients} as specified by LEMUR_SECURITY_TEAM_EMAIL for notifications\n") sys.stdout.write("[!] Using {0} as specified by LEMUR_SECURITY_TEAM_EMAIL for notifications\n".format("LEMUR_SECURITY_TEAM_EMAIL"))
intervals = current_app.config.get("LEMUR_DEFAULT_EXPIRATION_NOTIFICATION_INTERVALS") intervals = current_app.config.get("LEMUR_DEFAULT_EXPIRATION_NOTIFICATION_INTERVALS", [])
sys.stdout.write( sys.stdout.write(
"[!] Creating {num} notifications for {intervals} days as specified by LEMUR_DEFAULT_EXPIRATION_NOTIFICATION_INTERVALS\n".format( "[!] Creating {num} notifications for {intervals} days as specified by LEMUR_DEFAULT_EXPIRATION_NOTIFICATION_INTERVALS\n".format(
num=len(intervals), num=len(intervals),

View File

@ -100,7 +100,8 @@ class BuildStatic(Command):
pass pass
def run(self): def run(self):
log.info("running [npm install --quiet]") log.info("running [npm install --quiet] in {0}".format(ROOT))
check_output(['npm', 'install', '--quiet'], cwd=ROOT) check_output(['npm', 'install', '--quiet'], cwd=ROOT)
log.info("running [gulp build]") log.info("running [gulp build]")