[Pkg-debile-commits] [debile-slave] 92/100: Modified Config() interface

Sylvestre Ledru sylvestre at alioth.debian.org
Mon Aug 19 14:53:16 UTC 2013


This is an automated email from the git hooks/post-receive script.

sylvestre pushed a commit to branch master
in repository debile-slave.

commit 0d50ca98304ecc6ab1eb9aba20690f6a5ae511db
Author: Léo Cavaillé <leo at cavaille.net>
Date:   Mon Jul 29 11:37:49 2013 +0200

    Modified Config() interface
---
 ethel/daemon.py |    8 ++++----
 ethel/utils.py  |   19 +++++++------------
 2 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/ethel/daemon.py b/ethel/daemon.py
index b2bfb9c..e007bd0 100644
--- a/ethel/daemon.py
+++ b/ethel/daemon.py
@@ -76,8 +76,8 @@ def create_firehose(package, version_getter):
 
 
 def iterate():
-    suites = listize(config['host']['suites'])
-    arches = listize(config['host']['arches'])
+    suites = listize(config.get('capabilities', 'suites'))
+    arches = listize(config.get('capabilities', 'arches'))
 
     # job is a serialized dictionary from Lucy ORM
     # {'package': {'user_id': 2, 'name': 'cimg', 'created_at': None, 'updated_at': None, 'version': '1.5.6-1', 'source_id': 2, 'type': 'source', 'dsc': 'cimg_1.5.6-1.dsc'}, 'finished_at': None, 'machine': {'last_ping': <DateTime '20130729T09:10:47' at 1906050>, 'password': 'password', 'id': 1, 'gpg_fingerprint': 'D0FEF8101640900183B8C37A42FE51628224AAA3', 'name': 'debian-builder1'}, 'package_id': 2, 'assigned_at': <DateTime '20130729T09:10:48' at 1906098>, 'type': 'perlcritic', 'suite':  [...]
@@ -105,14 +105,14 @@ def iterate():
                     logging.info("Sending the XML firehose report to the pool")
                     open('firehose.xml', 'w').write(firehose.to_xml_bytes())
                     remote_firehose_path = proxy.get_firehose_write_location(job['id'])
-                    cmd = config['host']['copy'].format(src='firehose.xml',
+                    cmd = config.get('lucy', 'copy').format(src='firehose.xml',
                                                 dest=remote_firehose_path)
                     out, err, ret = run_command(cmd)
 
                     logging.info("Sending the logs to the pool")
                     remote_path = proxy.get_log_write_location(job['id'])
                     open('ethel-log', 'wb').write(log.encode('utf-8'))
-                    cmd = config['host']['copy'].format(src='ethel-log',
+                    cmd = config('lucy', 'copy').format(src='ethel-log',
                                                 dest=remote_path)
                     out, err, ret = run_command(cmd)
                     if ret != 0:
diff --git a/ethel/utils.py b/ethel/utils.py
index 301c2aa..cd4174d 100644
--- a/ethel/utils.py
+++ b/ethel/utils.py
@@ -1,4 +1,5 @@
 from ethel.error import EthelError
+from ethel.config import Config
 
 from contextlib import contextmanager
 from schroot import schroot
@@ -10,10 +11,6 @@ import shlex
 import sys
 import os
 
-try:
-    import configparser
-except ImportError:
-    import ConfigParser as configparser
 
 
 def upgrade(chroot):
@@ -114,9 +111,10 @@ def jobize(path, job):
     return obj
 
 
-def prepare_binary_for_upload(changes, job, obj):
+def prepare_binary_for_upload(changes, job):
+    config = Config()
     jobize(changes, job)
-    gpg = obj['gpg']
+    gpg = config.get('gpg', 'fingerprint')
     out, err, ret = run_command(['debsign', '-k%s' % (gpg), changes])
     if ret != 0:
         print(out)
@@ -125,14 +123,11 @@ def prepare_binary_for_upload(changes, job, obj):
 
 
 def upload(changes, job):
-    cfg = configparser.ConfigParser()
-    if cfg.read("/etc/ethel.ini") == []:
-        raise Exception("WTF no ethel")
-    obj = cfg['host']
+    config = Config()
 
-    prepare_binary_for_upload(changes, job, obj)
+    prepare_binary_for_upload(changes, job)
 
-    out, err, ret = run_command(['dput', obj['dput-host'], changes])
+    out, err, ret = run_command(['dput', config.get('lucy', 'dput-host'), changes])
     if ret != 0:
         print(out)
         print(err)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-slave.git



More information about the Pkg-debile-commits mailing list