From 9e3af8b0450a452bc91c67a22f215d325b85def1 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Fri, 2 Oct 2015 13:19:33 +0000
Subject: LinHES-system: balance_storage.py: move check for files to find most
 full group

---
 abs/core/LinHES-system/PKGBUILD           |  4 ++--
 abs/core/LinHES-system/balance_storage.py | 22 ++++++++++++++++------
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 67f0c19..014f235 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=8.3
-pkgrel=14
+pkgrel=15
 arch=('i686' 'x86_64')
 install=system.install
 pkgdesc="Everything that makes LinHES an automated system"
@@ -98,7 +98,7 @@ md5sums=('76842f8cff548d2c1289e0992a8b84dd'
          '74e17d6f7453c52d56fecaed5c3f6ad5'
          '47e093e8cfe4b5b96602358e1f540832'
          '63bbc62240f46a9997eaae4a84b09b76'
-         '2aa1a285161c8bf3e2ab16ca9e511b00'
+         'd67a034fa1d8f253f42982f27a8d88ff'
          '2c005d95312018bef80092136f80f254'
          'c8db6a83ecc089ea37ab7fcb0f7a01cf'
          'ca63946920ba33de1f15abda83e74e40'
diff --git a/abs/core/LinHES-system/balance_storage.py b/abs/core/LinHES-system/balance_storage.py
index a6995ca..5556fd0 100755
--- a/abs/core/LinHES-system/balance_storage.py
+++ b/abs/core/LinHES-system/balance_storage.py
@@ -73,19 +73,29 @@ if __name__ == '__main__':
                 continue
             freePcent = getFreePercentForDir(directory)
             freeSize = getFreeSpaceForDir(directory)
-            # Check if SG has any mpg or nuv files and if so add to SGDIRSdata
-            if len(glob.glob1(directory,"*.mpg")) or len(glob.glob1(directory,"*.nuv")):
-                SGDIRSdata.append([directory, freePcent, freeSize])
-                print "  " + directory + " - " + str(freePcent * 100) + "%"
+            SGDIRSdata.append([directory, freePcent, freeSize])
+            print "  " + directory + " - " + str(freePcent * 100) + "%"
 
         # Sort data on percent free
         SGDIRSdata = sorted(SGDIRSdata, reverse=True, key=operator.itemgetter(1))
         #print SGDIRSdata
-        mostFull = SGDIRSdata[0]
+
+        # Check if SG has any mpg or nuv files
+        i=0
+        for dir in SGDIRSdata:
+            mostFull = SGDIRSdata[i]
+            i=i+1
+            if len(glob.glob1(mostFull[0],"*.mpg")) or len(glob.glob1(mostFull[0],"*.nuv")):
+                break
+            else:
+                if i == 1:
+                    print "------------------------------------------------"
+                print "  " + mostFull[0] + " - NO files to move"
+
         leastFull = SGDIRSdata[-1]
 
         print "------------------------------------------------"
-        print "Most Used Storage Group Directory: "
+        print "Most Used Storage Group Directory with files to move: "
         print "  " + str(mostFull[0]) + " - " + str(mostFull[1] * 100) + "%"
         print "Least Used Storage Group Directory: "
         print "  " + str(leastFull[0]) + " - " + str(leastFull[1] * 100) + "%"
-- 
cgit v0.12

