@@ -662,32 +662,7 @@ def status():
662662 STATUS_UNKNOW : 'Could not determine status' ,
663663}
664664
665-
666- def diagnose ():
667- """
668- This command diagnoses an installation of KA Lite
669-
670- It has to be able to work with instances of KA Lite that users do not
671- actually own, however it's assumed that the path and the 'kalite' commands
672- are configured and work.
673-
674- The function is currently non-robust, meaning that not all aspects of
675- diagnose data collection is guaranteed to succeed, thus the command could
676- potentially fail :(
677-
678- Example: KALITE_HOME=/home/otheruser/.kalite kalite diagnose --port=7007
679- """
680-
681- print ("" )
682- print ("KA Lite diagnostics" )
683- print ("" )
684-
685- # Tell users we are calculating, because checking the size of the
686- # content directory is slow. Flush immediately after.
687- print ("Calculating diagnostics..." )
688- sys .stdout .flush ()
689- print ("" )
690-
665+ def get_diagnostics ():
691666 # Key, value store for diagnostics
692667 # Not using OrderedDict because of python 2.6
693668 diagnostics = []
@@ -733,6 +708,35 @@ def diagnose():
733708 except :
734709 diag ("Device failure" , traceback .format_exc ())
735710
711+ return diagnostics
712+
713+ def diagnose ():
714+ """
715+ This command diagnoses an installation of KA Lite
716+
717+ It has to be able to work with instances of KA Lite that users do not
718+ actually own, however it's assumed that the path and the 'kalite' commands
719+ are configured and work.
720+
721+ The function is currently non-robust, meaning that not all aspects of
722+ diagnose data collection is guaranteed to succeed, thus the command could
723+ potentially fail :(
724+
725+ Example: KALITE_HOME=/home/otheruser/.kalite kalite diagnose --port=7007
726+ """
727+
728+ print ("" )
729+ print ("KA Lite diagnostics" )
730+ print ("" )
731+
732+ # Tell users we are calculating, because checking the size of the
733+ # content directory is slow. Flush immediately after.
734+ print ("Calculating diagnostics..." )
735+ sys .stdout .flush ()
736+ print ("" )
737+
738+ diagnostics = get_diagnostics ()
739+
736740 for k , v in diagnostics :
737741
738742 # Pad all the values to match the key column
0 commit comments