From ea8540a8ef7b8f568fecfe853f5b7b1c977b9c9e Mon Sep 17 00:00:00 2001 From: dhubbard Date: Wed, 2 May 2018 15:04:33 -0700 Subject: [PATCH 1/2] Update readme --- invirtualenv_plugins/docker.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/invirtualenv_plugins/docker.py b/invirtualenv_plugins/docker.py index 600b1b2..217dc42 100644 --- a/invirtualenv_plugins/docker.py +++ b/invirtualenv_plugins/docker.py @@ -15,6 +15,7 @@ DOCKERFILE_TEMPLATE = """FROM {{docker_container['base_image']|default('ubuntu:17.10')}} COPY docker_build.sh /tmp/docker_build.sh +COPY deploy.conf /var/lib/invirtualenv/deploy.conf {% if docker_container['setenv'] %}# Environment Settings {% for setting, value in docker_container['setenv'].items() %}ENV {{setting}} {{value}} {% endfor %}{% endif %}{% if docker_container['files'] %} @@ -92,8 +93,6 @@ def run_package_command(self, package_hashes, wheel_dir='wheels'): logger.debug('Dockerfile') logger.debug(self.render_template_with_config()) - logger.debug('Wheels') - logger.debug(os.listdir(wheel_dir)) with open('Dockerfile', 'w') as dockerfile_handle: dockerfile_handle.write(self.render_template_with_config()) container_tag = '{name}:{version}'.format(name=self.config['docker_container']['container_name'], version=self.config['global']['version']) From ccaeacc112814648c6f6f4bf79ed6097fc586108 Mon Sep 17 00:00:00 2001 From: dhubbard Date: Wed, 2 May 2018 17:12:08 -0700 Subject: [PATCH 2/2] Add a parsed_config_file package type --- invirtualenv_plugins/parsedconfig.py | 26 ++++++++++++++++++++++++++ setup.cfg | 5 +++-- setup.py | 1 + 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 invirtualenv_plugins/parsedconfig.py diff --git a/invirtualenv_plugins/parsedconfig.py b/invirtualenv_plugins/parsedconfig.py new file mode 100644 index 0000000..a9c5fc7 --- /dev/null +++ b/invirtualenv_plugins/parsedconfig.py @@ -0,0 +1,26 @@ +import logging +from invirtualenv.config import generate_parsed_config_file +from invirtualenv.plugin_base import InvirtualenvPlugin + + +logger = logging.getLogger(__name__) + + +class InvirtualenvParsedConfig(InvirtualenvPlugin): + package_formats = ['parsed_deploy_conf'] + default_config_filename = 'deploy.conf.parsed' + + def __init__(self, *args, **kwargs): + super(InvirtualenvParsedConfig, self).__init__(*args, **kwargs) + with open(self.config_file) as config_file_handle: + self.package_template = config_file_handle.read() + logger.debug('Read template %r', self.package_template) + + def run_package_command(self, package_hashes, wheel_dir='wheels'): + logger.debug('Config') + logger.debug(self.config) + logger.debug('Deploy.conf') + logger.debug(open('deploy.conf').read()) + generate_parsed_config_file('deploy.conf', self.default_config_filename) + return self.default_config_filename + diff --git a/setup.cfg b/setup.cfg index 803bdcd..3998559 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,5 +2,6 @@ console_scripts = invirtualenv=invirtualenv.cli:main invirtualenv.plugin = - docker = invirtualenv_plugins.docker:InvirtualenvDocker - rpm = invirtualenv_plugins.rpm:InvirtualenvRPM + docker = invirtualenv_plugins.docker:InvirtualenvDocker + parsedconfig = invirtualenv_plugins.parsedconfig:InvirtualenvParsedConfig + rpm = invirtualenv_plugins.rpm:InvirtualenvRPM diff --git a/setup.py b/setup.py index 17958e3..8d07191 100755 --- a/setup.py +++ b/setup.py @@ -98,6 +98,7 @@ def get_version(version_file): 'invirtualenv.plugin': [ 'docker=invirtualenv_plugins.docker:InvirtualenvDocker', 'rpm=invirtualenv_plugins.rpm:InvirtualenvRPM', + 'parsedconfig=invirtualenv_plugins.parsedconfig:InvirtualenvParsedConfig', ], }, install_requires=[