rel-eng/packages/spacecmd | 2 +-
spacecmd/spacecmd.spec | 6 +++++-
spacecmd/src/lib/misc.py | 24 +++++++++++++++++++-----
3 files changed, 25 insertions(+), 7 deletions(-)
New commits:
commit 0cafb161e2c1aa9a6a2f28b9f6ef07db15be7f8d
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Nov 30 08:04:58 2010 -0500
Automatic commit of package [spacecmd] release [1.3.2-1].
diff --git a/rel-eng/packages/spacecmd b/rel-eng/packages/spacecmd
index 2aacda1..2c67658 100644
--- a/rel-eng/packages/spacecmd
+++ b/rel-eng/packages/spacecmd
@@ -1 +1 @@
-1.3.1-1 spacecmd/
+1.3.2-1 spacecmd/
diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index fbf4692..8c001fd 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -4,7 +4,7 @@
%endif
Name: spacecmd
-Version: 1.3.1
+Version: 1.3.2
Release: 1%{?dist}
Summary: Command-line interface to Spacewalk and Satellite servers
@@ -57,6 +57,10 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%doc %{_mandir}/man1/spacecmd.1.gz
%changelog
+* Tue Nov 30 2010 Aron Parsons <aparsons(a)redhat.com> 1.3.2-1
+- don't use a cached session if username and password are passed as arguments
+- added get_session function
+
* Mon Nov 22 2010 Aron Parsons <aparsons(a)redhat.com> 1.3.1-1
- fix uninitialized variable in snippet_create
- 655055 - honor the quiet flag when generating caches in spacecmd
commit ceecbf871898e3580cd10e11a4b2bea49f4d831e
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Nov 30 08:01:30 2010 -0500
spacecmd: added get_session function
diff --git a/spacecmd/src/lib/misc.py b/spacecmd/src/lib/misc.py
index 6dd05a8..31fa9c7 100644
--- a/spacecmd/src/lib/misc.py
+++ b/spacecmd/src/lib/misc.py
@@ -109,7 +109,6 @@ def help_get_apiversion(self):
print 'get_apiversion: Display the API version of the server'
print 'usage: get_apiversion'
-
def do_get_apiversion(self, args):
print self.client.api.getVersion()
@@ -135,6 +134,18 @@ def do_get_certificateexpiration(self, args):
####################
+def help_get_session(self):
+ print 'get_session: Show the current session string'
+ print 'usage: get_session'
+
+def do_get_session(self, args):
+ if self.session:
+ print self.session
+ else:
+ logging.error('No session found')
+
+####################
+
def help_help(self):
print 'help: Show help for the given command'
print 'usage: help COMMAND'
commit 76f84d43911e63393a58caff6f4aec75f64643a8
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Nov 30 07:55:38 2010 -0500
spacecmd: don't use a cached session if username and password are passed as
arguments
diff --git a/spacecmd/src/lib/misc.py b/spacecmd/src/lib/misc.py
index 8ed89d2..6dd05a8 100644
--- a/spacecmd/src/lib/misc.py
+++ b/spacecmd/src/lib/misc.py
@@ -227,11 +227,14 @@ def do_login(self, args):
session_file = os.path.join(self.conf_dir, server, 'session')
# retrieve a cached session
- if os.path.isfile(session_file):
+ # (skip this if username and password are provided)
+ if os.path.isfile(session_file) \
+ and not self.options.username \
+ and not self.options.password:
try:
sessionfile = open(session_file, 'r')
- # read the session (format = server:username:session)
+ # read the session (format = username:session)
for line in sessionfile:
parts = line.split(':')
@@ -263,7 +266,7 @@ def do_login(self, args):
# attempt to login if we don't have a valid session yet
if not len(self.session):
if len(username):
- print 'Spacewalk Username: %s' % username
+ logging.info('Spacewalk Username: %s' % username)
else:
if self.options.username:
username = self.options.username
@@ -305,7 +308,7 @@ def do_login(self, args):
sessionfile.write(line)
sessionfile.close()
except IOError:
- logging.error('Could not write cache file')
+ logging.error('Could not write session file')
# load the system/package/errata caches
self.load_caches(server)
Show replies by date