'''
Module for gathering disk information on Windows

:depends:   - win32api Python module
'''

# Import python libs
import ctypes
import string

# Import salt libs
try:
    import win32api
    IS_WINDOWS = True
except ImportError:
    IS_WINDOWS = False


def __virtual__():
    '''
    Only works on Windows systems
    '''
    if not IS_WINDOWS:
        return False
    return 'disk'


def usage():
    '''
    Return usage information for volumes mounted on this minion

    CLI Example::

        salt '*' disk.usage
    '''
    if __grains__['kernel'] == 'Windows':
        drives = []
        ret = {}
        drive_bitmask = ctypes.windll.kernel32.GetLogicalDrives()
        for letter in string.uppercase:
            if drive_bitmask & 1:
                drives.append(letter)
            drive_bitmask >>= 1
        for drive in drives:
            try:
                (sectorspercluster,
                 bytespersector,
                 freeclusters,
                 totalclusters) = win32api.GetDiskFreeSpace(
                     '{0}:\\'.format(drive)
                 )
                totalsize = sectorspercluster * bytespersector * totalclusters
                available_space = (
                    sectorspercluster * bytespersector * freeclusters
                )
                used = totalsize - available_space
                capacity = int(used / float(totalsize) * 100)
                ret['{0}:\\'.format(drive)] = {
                    'filesystem': '{0}:\\'.format(drive),
                    '1K-blocks': totalsize,
                    'used': used,
                    'available': available_space,
                    'capacity': '{0}%'.format(capacity),
                }
            except Exception:
                ret['{0}:\\'.format(drive)] = {
                    'filesystem': '{0}:\\'.format(drive),
                    '1K-blocks': None,
                    'used': None,
                    'available': None,
                    'capacity': None,
                }
        return ret

@@ -528,54 +528,8 @@
 '''%0A
-    if __grains__%5B'kernel'%5D == 'Windows':%0A    
     
@@ -544,20 +544,16 @@
  %5B%5D%0A    
-  
-  
 ret = %7B%7D
@@ -553,20 +553,16 @@
 et = %7B%7D%0A
-    
     driv
@@ -615,20 +615,16 @@
 rives()%0A
-    
     for 
@@ -659,20 +659,16 @@
         
-  
-  
 if drive
@@ -681,20 +681,16 @@
 sk & 1:%0A
-    
         
@@ -719,28 +719,24 @@
 er)%0A        
-    
 drive_bitmas
@@ -747,20 +747,16 @@
 = 1%0A    
-  
-  
 for driv
@@ -768,20 +768,16 @@
 drives:%0A
-    
         
@@ -793,20 +793,16 @@
         
-    
 (sectors
@@ -826,20 +826,16 @@
         
-  
-  
 bytesper
@@ -855,20 +855,16 @@
         
-    
 freeclus
@@ -869,20 +869,16 @@
 usters,%0A
-    
         
@@ -943,20 +943,16 @@
         
- 
-   
 '%7B0%7D:%5C%5C'
@@ -975,34 +975,26 @@
             
-    )%0A    
+)%0A
             
@@ -1068,20 +1068,16 @@
         
- 
-   
 availabl
@@ -1088,20 +1088,16 @@
 ace = (%0A
-    
         
@@ -1158,36 +1158,32 @@
 ers%0A            
-    
 )%0A              
@@ -1180,20 +1180,16 @@
         
- 
-   
 used = t
@@ -1227,20 +1227,16 @@
         
-   
- 
 capacity
@@ -1277,36 +1277,32 @@
 00)%0A            
-    
 ret%5B'%7B0%7D:%5C%5C'.for
@@ -1325,36 +1325,32 @@
                 
- 
-   
 'filesystem': '%7B
@@ -1379,36 +1379,32 @@
                 
-   
- 
 '1K-blocks': tot
@@ -1419,36 +1419,32 @@
                 
-    
 'used': used,%0A  
@@ -1449,36 +1449,32 @@
                 
- 
-   
 'available': ava
@@ -1487,20 +1487,16 @@
 _space,%0A
-    
         
@@ -1544,36 +1544,32 @@
 y),%0A            
-    
 %7D%0A            ex
@@ -1562,20 +1562,16 @@
         
- 
-   
 except E
@@ -1584,36 +1584,32 @@
 on:%0A            
-   
- 
 ret%5B'%7B0%7D:%5C%5C'.for
@@ -1616,36 +1616,32 @@
 mat(drive)%5D = %7B%0A
-    
                 
@@ -1686,36 +1686,32 @@
                 
- 
-   
 '1K-blocks': Non
@@ -1721,36 +1721,32 @@
                 
-   
- 
 'used': None,%0A  
@@ -1735,36 +1735,32 @@
   'used': None,%0A
-    
                 
@@ -1786,36 +1786,32 @@
                 
- 
-   
 'capacity': None
@@ -1820,34 +1820,26 @@
             
-    %7D%0A    
+%7D%0A
     return r

Remove redundant os check