'''
Module for configuring Windows Firewall
'''

# Import python libs
import re

# Import salt libs
import salt.utils


def __virtual__():
    '''
    Only works on Windows systems
    '''
    
    if salt.utils.is_windows():
        return 'firewall'
    return False


def get_fw_config():
    '''
    Get the status of all the firewall profiles
    '''
    
    profiles = {}
    curr = None
    
    for line in __salt__['cmd.run']( 'netsh advfirewall show allprofiles' ).splitlines():
        if not curr:
            tmp = re.search('(.*) Profile Settings:', line)
            if tmp:
                curr = tmp.group(1)
        elif line.startswith('State'):
            profiles[curr] = line.split()[1] == 'ON'
            curr = None
    
    return profiles


def disable_fw():
    '''
    Disable all the firewall profiles
    '''
    
    return __salt__['cmd.run']( 'netsh advfirewall set allprofiles state off' ) == 'Ok.'



@@ -276,11 +276,8 @@
 get_
-fw_
 conf
@@ -329,32 +329,89 @@
 irewall profiles
+%0A%0A    CLI Example::%0A%0A        salt '*' firewall.get_config
 %0A    '''%0A    %0A  
@@ -399,29 +399,24 @@
 fig%0A    '''%0A
-    %0A
     profiles
@@ -441,49 +441,18 @@
 one%0A
-    
 %0A    
-for line in __salt__%5B'cmd.run'%5D(
+cmd =
  'ne
@@ -484,17 +484,56 @@
 rofiles'
- 
+%0A    for line in __salt__%5B'cmd.run'%5D(cmd
 ).splitl
@@ -835,11 +835,8 @@
 able
-_fw
 ():%0A
@@ -881,28 +881,77 @@
 rofiles%0A
+%0A
     
-'''
+CLI Example::%0A%0A        salt '*' firewall.disable
 %0A    
+'''
 %0A    ret
@@ -974,16 +974,28 @@
 d.run'%5D(
+%0A           
  'netsh 
@@ -1032,16 +1032,28 @@
 ate off'
+%0A           
  ) == 'O

remove redundant fw refs and add CLI Exmaples