Exit more gracefully when the action command isn't "up"

This commit is contained in:
Mike 2018-10-02 02:26:42 -07:00
parent c7ab0bcb5d
commit e86f96d16d
1 changed files with 10 additions and 4 deletions

View File

@ -52,12 +52,22 @@ class SSHConfiger:
self.complain(s)
raise Exception(s)
def quit(self, s):
#
self.log("Quitting because: " + s)
sys.exit(0)
#
def run(self):
#
self.log("Running for interface \""+ self._action_interface +"\": " + self._action_command)
# Only run if an interface is coming up
if ( self._action_command != "up" ):
self.quit("We don't need to run for action command: " + str(self._action_command))
# Parse the config
self.parse_config()
@ -105,10 +115,6 @@ class SSHConfiger:
#
def determine_ssh_config_name(self):
# Only run if an interface is coming up
if ( self._action_command != "up" ):
return None
#
self.log("Attempting to determine SSH config name")