"SpacewalkShell instance has no attribute 'system_cache_file'"
error is generated and clear_caches fails if no login performed.
---
 spacecmd/src/lib/shell.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/spacecmd/src/lib/shell.py b/spacecmd/src/lib/shell.py
index 1025048..c8829bc 100644
--- a/spacecmd/src/lib/shell.py
+++ b/spacecmd/src/lib/shell.py
@@ -106,7 +106,10 @@ class SpacewalkShell(Cmd):
 
         # don't attempt to login for some commands
         if re.match('help|login|logout|whoami|history|clear', line, re.I):
-            return line
+            # login required for clear_caches or it fails with:
+            # "SpacewalkShell instance has no attribute 'system_cache_file'"
+            if not re.match('clear_caches', line, re.I):
+                return line
 
         # login before attempting to run a command
         if not self.session:
-- 
1.7.1

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to