Skip to content

Instantly share code, notes, and snippets.

@pbanaszkiewicz
Created October 31, 2013 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbanaszkiewicz/7256421 to your computer and use it in GitHub Desktop.
Save pbanaszkiewicz/7256421 to your computer and use it in GitHub Desktop.
Configuration template proposal for GWM

Configuration template for GWM

Problem

As one of its latest steps, setup.sh git-clones ganeti_webmgr-config repository in order to:

  • get this nice configuration file from that repo,
  • copy gwm-manage.py executable script to virtual env's bin directory.

The main drawbacks of this approach are:

  • the need to keep two repositories altogether,
  • the git dependency.

Research

I've looked for any way to include configuration and management files within main GWM distribution. As it turns out, there are two ways to include a file into venv's bin directory using setuptools, but none to create anything outside the virtual env.

Solutions for management file gwm-manage.py

In setuptools.setup we can provide scripts and entry_points arguments. The former explicitly says which script to copy to venv's bin directory, the latter says which module/function to build into an OS-specific executable (either shebang'd .py script or .exe file).

Since we're not supporting Windows, I don't think we need to bother with entry_points. On the other hand, our management script requires sed-ing hardcoded paths, it may be easier to do entry_points way.

Solutions for configuration file gwm_config.py

This file will need to be moved from inside GWM package by setup.sh script. I don't see any other clever solution.

Templates

We could implement a template system similar to Django's default project layout or cookiecutter templates. But so far above solutions seem easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment