def rollback(self): try: yield self.stopNetwork() except Exception: pass #Most important command: this allows us to reboot safely try: move(self.backup_file, self.config_file) finally: yield self.startNetwork() if EDENWALL: saveHaType(self.component.ufwi_conf_var_dir, self.prev_ha_status)
def apply(self): if exists(FIRST_APPLY_STAMP): #the first apply comes after a discovery of linux net parameters #there is a dhclient running move(FIRST_APPLY_STAMP, SECOND_APPLY_STAMP) elif exists(SECOND_APPLY_STAMP): #The second application is made by a human being, maybe a confirmation #of what dhclient gave us, or not yield(self.killdhclients()) remove(SECOND_APPLY_STAMP) yield self.stopNetwork() move(self.temp_file, self.config_file) yield self.startNetwork() self.setEthernetSpeeds() if EDENWALL: saveHaType(self.component.ufwi_conf_var_dir, self.ha_status)