diff --git a/modules/docker.py b/modules/docker.py index 269fa59..10ff6c2 100644 --- a/modules/docker.py +++ b/modules/docker.py @@ -84,6 +84,7 @@ def generate(): context['docker_database_port_internal'] = \ configuration.docker.database.port + context['projectbranch'] = configuration.project.branch context['database_user'] = configuration.server.database.admin.user context['database_pass'] = configuration.server.database.admin.password context['database_name'] = configuration.server.database.name @@ -117,6 +118,7 @@ def generate(): else: config_src = configuration.templates.docker.database.src + upload_template( filename=config_src, destination=build_path, @@ -220,3 +222,74 @@ def stop(remove=False): if remove: docker_run(docker_rm) + + +@task +def edit(param='help'): + """ + calls up mvim on the docker conf and build files + """ + + from .maintenance import edit as maintenance_edit + + configuration = env.config + print('keys: %s' % configuration.templates.docker.keys()) + print('path: %s' % configuration.templates.docker.path.keys()) + print('path.remote: %s' % configuration.templates.docker.path.remote) + print('path.local: %s' % configuration.templates.docker.path.local) + print('database: %s' % configuration.templates.docker.database.keys()) + print('database.src: %s' % configuration.templates.docker.database.src) + print('database.dst: %s' % configuration.templates.docker.database.dst) + + import os + + database_build_path = os.path.join( + configuration.templates.docker.path.remote, + 'build', + configuration.templates.docker.database.dst + ) + + database_template_path = os.path.join( + configuration.templates.docker.path.remote, + 'files', + configuration.templates.docker.database.src + ) + + print('database build path: %s' % database_build_path) + print('database template path: %s' % database_template_path) + + project_branch = configuration.project.branch + + locations = { + 'database': { + 'path': database_build_path, + 'desc': 'docker database file in scripts/conf/docker/build', + }, + + 'template': { + 'path': database_template_path, + 'desc': 'docker template file for database is' + 'scripts/conf/docker/files', + } + } + + if param in locations.keys(): + remote_path = locations[param]['path'] + maintenance_edit(remote_path=remote_path) + else: + # if param == 'help': + + print(""" + "fab docker.edit" automates editing template configuration files + for docker database + + to use this you must pass one of the editable locations in as a + parameter + + currently editable locations are: + """) + + for k_loc in locations.keys(): + print("\t{0: <20} - {1}".format(k_loc, locations[k_loc]['desc'])) + + return