|
|
|
|
|
|
|
|
if __salt__['ufw.is_enabled'](): |
|
|
if __salt__['ufw.is_enabled'](): |
|
|
return _unchanged(name, "UFW is already enabled") |
|
|
return _unchanged(name, "UFW is already enabled") |
|
|
|
|
|
|
|
|
if __opts__['test']: |
|
|
|
|
|
return _test(name, "UFW will be enabled") |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
try: |
|
|
__salt__['ufw.set_enabled'](True) |
|
|
__salt__['ufw.set_enabled'](True) |
|
|
except (CommandExecutionError, CommandNotFoundError) as e: |
|
|
except (CommandExecutionError, CommandNotFoundError) as e: |
|
|
return _error(name, e.message) |
|
|
return _error(name, e.message) |
|
|
|
|
|
|
|
|
return _changed(name, "UFW is enabled", enabled=True) |
|
|
|
|
|
|
|
|
if __opts__['test']: |
|
|
|
|
|
return _test(name, "UFW would have been enabled") |
|
|
|
|
|
else: |
|
|
|
|
|
return _changed(name, "UFW is enabled", enabled=True) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def default_incoming(name, default): |
|
|
def default_incoming(name, default): |