From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QYMSl-0002Wk-LV for garchives@archives.gentoo.org; Sun, 19 Jun 2011 18:11:14 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CC8331C029; Sun, 19 Jun 2011 18:11:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 98A001C029 for ; Sun, 19 Jun 2011 18:11:03 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 13B881CC00E for ; Sun, 19 Jun 2011 18:11:03 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 27A0E8003C for ; Sun, 19 Jun 2011 18:11:02 +0000 (UTC) From: "Vikraman Choudhury" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Vikraman Choudhury" Message-ID: <76dc7f6db42c5cd8ff4862308fafa2e7a0b7a8df.vikraman@gentoo> Subject: [gentoo-commits] proj/gentoostats:master commit in: client/ X-VCS-Repository: proj/gentoostats X-VCS-Files: client/gentoostats-send X-VCS-Directories: client/ X-VCS-Committer: vikraman X-VCS-Committer-Name: Vikraman Choudhury X-VCS-Revision: 76dc7f6db42c5cd8ff4862308fafa2e7a0b7a8df Date: Sun, 19 Jun 2011 18:11:02 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 02da0490281526cf704aa6d522a4dd56 commit: 76dc7f6db42c5cd8ff4862308fafa2e7a0b7a8df Author: Vikraman Choudhury gmail com> AuthorDate: Sun Jun 19 18:10:21 2011 +0000 Commit: Vikraman Choudhury gmail com> CommitDate: Sun Jun 19 18:10:21 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoostats.g= it;a=3Dcommit;h=3D76dc7f6d update client to handle uuid and passwd --- client/gentoostats-send | 29 +++++++++++++++++++---------- 1 files changed, 19 insertions(+), 10 deletions(-) diff --git a/client/gentoostats-send b/client/gentoostats-send index d749c2a..9a9cd39 100755 --- a/client/gentoostats-send +++ b/client/gentoostats-send @@ -1,24 +1,33 @@ #!/usr/bin/env python =20 from gentoostats.payload import Payload +import ConfigParser +import sys import json import urllib, httplib =20 def getAuthInfo(): - #TODO: Return public uuid and md5sum of password - auth_info =3D { - "UUID": "254e308c-d6a0-405c-aa1f-f21d9c1ea6e1", - "PASSWD": "5f4dcc3b5aa765d61d8327deb882cf99" - } - return auth_info + config =3D ConfigParser.ConfigParser() + if len(config.read('/etc/gentoostats/auth.cfg')) =3D=3D 0: + sys.stderr.write('Cannot read auth.cfg') + sys.exit(1) + + try: + uuid =3D config.get('AUTH', 'UUID') + passwd =3D config.get('AUTH', 'PASSWD') + auth_info =3D {'UUID' : uuid, 'PASSWD' : passwd} + return auth_info + except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): + sys.stderr.write('Malformed auth.cfg') + sys.exit(1) =20 def serialize(object, human=3DFalse): if human: - indent =3D 2 - sort_keys =3D True + indent =3D 2 + sort_keys =3D True else: - indent =3D None - sort_keys =3D False + indent =3D None + sort_keys =3D False return json.JSONEncoder(indent=3Dindent, sort_keys=3Dsort_keys).encode= (object) =20 def main():