[csw-devel] SF.net SVN: gar:[14388] csw/mgar/gar/v2/lib/python/csw_upload_pkg.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Apr 24 10:23:47 CEST 2011


Revision: 14388
          http://gar.svn.sourceforge.net/gar/?rev=14388&view=rev
Author:   wahwah
Date:     2011-04-24 08:23:47 +0000 (Sun, 24 Apr 2011)

Log Message:
-----------
Add support for reading password from a file by default

Before asking the user for a password to submit their package, look
for it in /etc/opt/csw/releases/auth/$username.  Fall back to getpass
on if there is any IOError while reading from the file.

Signed-off-by: Ben Walton <bwalton at opencsw.org>
Signed-off-by: Maciej Blizinski <maciej at opencsw.org>

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/csw_upload_pkg.py

Modified: csw/mgar/gar/v2/lib/python/csw_upload_pkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/csw_upload_pkg.py	2011-04-24 08:21:59 UTC (rev 14387)
+++ csw/mgar/gar/v2/lib/python/csw_upload_pkg.py	2011-04-24 08:23:47 UTC (rev 14388)
@@ -570,10 +570,17 @@
     for error_tag in error_tags:
       print "*", error_tag
     sys.exit(1)
+
   username = os.environ["LOGNAME"]
-  # password = getpass.getpass("{0}'s pkg release password> ".format(username))
-  # Disabling for the time being.
-  password = False
+  authfile = os.path.join('/etc/opt/csw/releases/auth', username)
+
+  try:
+    with open(authfile, 'r') as af:
+      password = af.read().strip()
+  except IOError, e:
+    logging.warning("Error reading %s: %s", authfile, e)
+    password = getpass.getpass("{0}'s pkg release password> ".format(username))
+
   uploader = Srv4Uploader(args,
                           options.rest_url,
                           os_release=os_release,


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list