Making the creation of AWS accounts optional.
This commit is contained in:
parent
5c9bcc5c23
commit
fc18e0f2bf
|
@ -333,6 +333,7 @@ class InitializeApp(Command):
|
||||||
else:
|
else:
|
||||||
sys.stdout.write("[-] Default user has already been created, skipping...!\n")
|
sys.stdout.write("[-] Default user has already been created, skipping...!\n")
|
||||||
|
|
||||||
|
if current_app.app.config.get('AWS_ACCOUNT_MAPPINGS'):
|
||||||
for account_name, account_number in current_app.config.get('AWS_ACCOUNT_MAPPINGS').items():
|
for account_name, account_number in current_app.config.get('AWS_ACCOUNT_MAPPINGS').items():
|
||||||
account = account_service.get_by_account_number(account_number)
|
account = account_service.get_by_account_number(account_number)
|
||||||
|
|
||||||
|
@ -439,26 +440,6 @@ class CreateRole(Command):
|
||||||
sys.stdout.write("[+] Created new role: {0}".format(name))
|
sys.stdout.write("[+] Created new role: {0}".format(name))
|
||||||
|
|
||||||
|
|
||||||
@manager.command
|
|
||||||
def create_config(config_path=None):
|
|
||||||
"""
|
|
||||||
Creates a new configuration file if one does not already exist
|
|
||||||
"""
|
|
||||||
if not config_path:
|
|
||||||
config_path = DEFAULT_CONFIG_PATH
|
|
||||||
|
|
||||||
config_path = os.path.expanduser(config_path)
|
|
||||||
dir = os.path.dirname(config_path)
|
|
||||||
if not os.path.exists(dir):
|
|
||||||
os.makedirs(dir)
|
|
||||||
|
|
||||||
config = generate_settings()
|
|
||||||
with open(config_path, 'w') as f:
|
|
||||||
f.write(config)
|
|
||||||
|
|
||||||
sys.stdout.write("Created a new configuration file {0}\n".format(config_path))
|
|
||||||
|
|
||||||
|
|
||||||
class LemurServer(Command):
|
class LemurServer(Command):
|
||||||
"""
|
"""
|
||||||
This is the main Lemur server, it runs the flask app with gunicorn and
|
This is the main Lemur server, it runs the flask app with gunicorn and
|
||||||
|
@ -494,6 +475,26 @@ class LemurServer(Command):
|
||||||
return app.run()
|
return app.run()
|
||||||
|
|
||||||
|
|
||||||
|
@manager.command
|
||||||
|
def create_config(config_path=None):
|
||||||
|
"""
|
||||||
|
Creates a new configuration file if one does not already exist
|
||||||
|
"""
|
||||||
|
if not config_path:
|
||||||
|
config_path = DEFAULT_CONFIG_PATH
|
||||||
|
|
||||||
|
config_path = os.path.expanduser(config_path)
|
||||||
|
dir = os.path.dirname(config_path)
|
||||||
|
if not os.path.exists(dir):
|
||||||
|
os.makedirs(dir)
|
||||||
|
|
||||||
|
config = generate_settings()
|
||||||
|
with open(config_path, 'w') as f:
|
||||||
|
f.write(config)
|
||||||
|
|
||||||
|
sys.stdout.write("Created a new configuration file {0}\n".format(config_path))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
manager.add_command("start", LemurServer())
|
manager.add_command("start", LemurServer())
|
||||||
manager.add_command("runserver", Server(host='127.0.0.1'))
|
manager.add_command("runserver", Server(host='127.0.0.1'))
|
||||||
|
|
Loading…
Reference in New Issue