This commit is contained in:
Jason Ertel
2021-07-12 09:38:01 -04:00
parent c6bb32b862
commit 78c58e61ea
+5 -3
View File
@@ -35,6 +35,7 @@ def showUsage(options, args):
print('') print('')
print(' General commands:') print(' General commands:')
print(' help - Prints this usage information.') print(' help - Prints this usage information.')
print(' apply - Apply the firewall state.')
print('') print('')
print(' Host commands:') print(' Host commands:')
print(' listhostgroups - Lists the known host groups.') print(' listhostgroups - Lists the known host groups.')
@@ -66,7 +67,7 @@ def checkDefaultPortsOption(options):
def checkApplyOption(options): def checkApplyOption(options):
if "--apply" in options: if "--apply" in options:
return apply() return apply(None, None)
def loadYaml(filename): def loadYaml(filename):
file = open(filename, "r") file = open(filename, "r")
@@ -328,7 +329,7 @@ def removehost(options, args):
code = checkApplyOption(options) code = checkApplyOption(options)
return code return code
def apply(): def apply(options, args):
proc = subprocess.run(['salt-call', 'state.apply', 'firewall', 'queue=True']) proc = subprocess.run(['salt-call', 'state.apply', 'firewall', 'queue=True'])
return proc.returncode return proc.returncode
@@ -356,7 +357,8 @@ def main():
"addport": addport, "addport": addport,
"removeport": removeport, "removeport": removeport,
"addhostgroup": addhostgroup, "addhostgroup": addhostgroup,
"addportgroup": addportgroup "addportgroup": addportgroup,
"apply": apply
} }
code=1 code=1