[csw-devel] [PATCH] Add support for reading password from a file by default
Ben Walton
bwalton at opencsw.org
Fri Apr 22 03:42:49 CEST 2011
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 any exception.
Signed-off-by: Ben Walton <bwalton at opencsw.org>
---
gar/v2/lib/python/csw_upload_pkg.py | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/gar/v2/lib/python/csw_upload_pkg.py b/gar/v2/lib/python/csw_upload_pkg.py
index 822d69f..79f4a00 100755
--- a/gar/v2/lib/python/csw_upload_pkg.py
+++ b/gar/v2/lib/python/csw_upload_pkg.py
@@ -570,8 +570,16 @@ if __name__ == '__main__':
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))
+ authfile = os.path.join('/etc/opt/csw/releases/auth', username)
+
+ try:
+ af = open(authfile, 'r')
+ password = af.readline().rstrip()
+ except:
+ password = getpass.getpass("{0}'s pkg release password> ".format(username))
+
uploader = Srv4Uploader(args,
options.rest_url,
os_release=os_release,
--
1.7.3.2
More information about the devel
mailing list