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

View File

@ -52,12 +52,22 @@ class SSHConfiger:
self.complain(s) self.complain(s)
raise Exception(s) raise Exception(s)
def quit(self, s):
#
self.log("Quitting because: " + s)
sys.exit(0)
# #
def run(self): def run(self):
# #
self.log("Running for interface \""+ self._action_interface +"\": " + self._action_command) 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 # Parse the config
self.parse_config() self.parse_config()
@ -105,10 +115,6 @@ class SSHConfiger:
# #
def determine_ssh_config_name(self): 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") self.log("Attempting to determine SSH config name")