nickstenning / honcho

Honcho: a python clone of Foreman. For managing Procfile-based applications.
http://pypi.python.org/pypi/honcho
MIT License
1.59k stars 145 forks source link

Add support for -t/--template option to export #140

Closed msabramo closed 9 years ago

msabramo commented 9 years ago

This is a honcho analogue of the corresponding options to foreman export -- See:

This lets you specify a custom Jinja template to be used when exporting to a supervisord config file.

Fixes: GH-88

See: https://github.com/nickstenning/honcho/issues/88

OK, I just updated this so that --template is a directory. I'm not quite sure how to test this in an automated way, but I did do manual testing.

[marca@marca-mac2 export_test]$ ls -l upstart_template.d
total 24
-rw-r--r--+ 1 marca  staff  353 Feb 23 06:01 master.conf
-rw-r--r--+ 1 marca  staff  380 Feb 23 06:02 process.conf
-rw-r--r--+ 1 marca  staff  119 Feb 23 06:02 process_master.conf

[marca@marca-mac2 export_test]$ honcho export upstart upstart-export --template upstart_template.d
2015-02-23 07:59:43 [20837] [INFO] Writing 'upstart-export/export_test.conf'
2015-02-23 07:59:43 [20837] [INFO] Writing 'upstart-export/export_test-ansvc.conf'
2015-02-23 07:59:43 [20837] [INFO] Writing 'upstart-export/export_test-ansvc-1.conf'

[marca@marca-mac2 export_test]$ honcho export upstart upstart-export
2015-02-23 08:00:16 [20841] [INFO] Writing 'upstart-export/export_test.conf'
2015-02-23 08:00:16 [20841] [INFO] Writing 'upstart-export/export_test-ansvc.conf'
2015-02-23 08:00:16 [20841] [INFO] Writing 'upstart-export/export_test-ansvc-1.conf'

[marca@marca-mac2 export_test]$ ls -l supervisor-template.d
total 8
-rw-r--r--+ 1 marca  staff  776 Dec 23 08:09 supervisord.conf

[marca@marca-mac2 export_test]$ honcho export supervisord out --template=supervisor-template.d
2015-02-23 08:00:39 [20847] [INFO] Writing 'out/export_test.conf'

[marca@marca-mac2 export_test]$ honcho export supervisord out
2015-02-23 08:01:05 [20855] [INFO] Writing 'out/export_test.conf'
msabramo commented 9 years ago

OK, I added a couple of simple unit tests in 6a5a97f.

msabramo commented 9 years ago

@nickstenning, @slafs: Please review when you get a chance.

msabramo commented 9 years ago

Hey, sorry to bother, I wonder if I can do anything to move this along, as we are planning a project at work where we want to eliminate dozens of manually-curated supervisor config files and replace them with Procfiles and a process that automatically generates the supervisor configs.

I will probably need this for that task.

slafs commented 9 years ago

Hi @msabramo! I'm little busy right now. Will take a look at this on weekend if I have some time.

msabramo commented 9 years ago

@nickstenning: Do you have time to look at this? If not, that's fine -- though I may need to devise a solution for generating supervisor configs that doesn't use honcho and I'd rather use honcho if possible, as it works nicely and looks like foreman so it's more familiar to some people, etc.

Cc: @sudarkoff

msabramo commented 9 years ago

@nickstenning: Thanks for the review! Addressed your comments and I do think it's easier to understand now. Let me know what you think.

nickstenning commented 9 years ago

Great! I've cleaned up a couple of bits and pieces and merged this as 5886e1849cd6690883b3a08b2143d2e4e52cb497. Thanks Marc!

msabramo commented 9 years ago

Thanks you too for the great feedback and for open sourcing honcho in the first place!

msabramo commented 9 years ago

Feature available in Honcho 0.6.5: https://pypi.python.org/pypi/honcho/0.6.5