[debexpo-devel] [debexpo/master] Make path to gpg binary a configurable parameter.
Christoph Haas
email at christoph-haas.de
Tue Feb 3 16:26:47 CET 2009
On Dienstag, 3. Februar 2009, Serafeim Zanikolas wrote:
> diff --git a/debexpo/lib/utils.py b/debexpo/lib/utils.py
> index 92fe878..6bec930 100644
> --- a/debexpo/lib/utils.py
> +++ b/debexpo/lib/utils.py
> @@ -36,8 +36,13 @@ __copyright__ = 'Copyright © 2008 Jonny Lamb'
> __license__ = 'MIT'
>
> import commands
> -import os
> +import logging
> import md5
> +import os
> +
> +from pylons import config
> +
> +log = logging.getLogger(__name__)
>
> def allowed_upload(filename):
> """
> @@ -114,7 +119,11 @@ def parse_key_id(key):
> ``key``
> ASCII armored GPG public key.
> """
> - cmd = 'echo "%s" | gpg2' % key
> + gpg_path = config['debexpo.gpg_path']
> + if not gpg_path:
> + log.error('debexpo.gpg_path is not set in configuration file.')
> + return None
> + cmd = 'echo "%s" | %s' % (key, gpg_path)
> status, output = commands.getstatusoutput(cmd)
> if status != 0:
> return None
> diff --git a/development.ini b/development.ini
> index 041ad54..7e722e8 100644
> --- a/development.ini
> +++ b/development.ini
> @@ -87,6 +87,9 @@ debexpo.changes_list = jonny at server
> # Server debexpo is being run on including http:// and excluding
> trailing slash debexpo.server = http://localhost:5000
>
> +# Path to the gpg binary
> +debexpo.gpg_path = /usr/bin/gpg
> +
> # DEBEXPO
> # The folling configuration settings allow you to customize the looks
> # of your web site. You can either comment it out or specify a path
In case of newly invented INI file configuration settings please don't
forget to add that to the deployment template
debexpo.egg-info/paste_deploy_config.ini_tmpl
Otherwise a freshly generated INI file from "paster make-config ..." would
not contain this setting and fail at config['debexpo.gpg_path'].
Perhaps we should document all the INI file settings (or is it documented
already?) and somewhere during the initialization of the application check
that all mandatory settings are done and sane (e.g. is /usr/bin/gpg
existing and executable?).
</ my 2¢>
Christoph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://workaround.org/pipermail/debexpo-devel/attachments/20090203/bd64bb2a/attachment.pgp>
More information about the debexpo-devel
mailing list