def run(self): no_updates = True imp.internal_version = "Git Build #{short_sha}".format( short_sha=self.local_repo.commit().hexsha[:7]) print(imp.internal_version) while no_updates: for remote in self.local_repo.remotes: local_commit = self.local_repo.commit() info = remote.fetch() remote_commit = info[0].commit remote_name = info[0].name if remote_name != self.repo: # Pick repo from settings. continue if remote_commit == local_commit: # If an update. continue if self.fallbacks: self.local_repo.git.execute("git checkout -B fallback") self.local_repo.git.execute("git checkout master") data = self.local_repo.git.execute( "git pull {} {}".format(*self.repo.split('/'))) print(data) print("We have updated to #{}".format( self.local_repo.commit().hexsha[:7])) print("Will undergo a cold reload now.") init.restart(1) no_updates = False time.sleep(self.update_interval)
def run(self): """ Reload management utility, privileged users only. """ self.imp.send_message(self.message.channel, "{author}, I will now begin cold reboot, please wait 1 second.".format( author=self.message.author.mention() ), mentions=True) init.restart(1) p = mp.current_process() try: p.terminate() except: pass
def run(self): """ Reload management utility, privileged users only. """ self.imp.send_message( self.message.channel, "{author}, I will now begin cold reboot, please wait 1 second.". format(author=self.message.author.mention()), mentions=True) init.restart(1) p = mp.current_process() try: p.terminate() except: pass
def run(self): no_updates = True imp.internal_version = "Git Build #{short_sha}".format(short_sha=self.local_repo.commit().hexsha[:7]) print(imp.internal_version) while no_updates: for remote in self.local_repo.remotes: local_commit = self.local_repo.commit() info = remote.fetch() remote_commit = info[0].commit remote_name = info[0].name if remote_name != self.repo: # Pick repo from settings. continue if remote_commit == local_commit : # If an update. continue if self.fallbacks: self.local_repo.git.execute("git checkout -B fallback") self.local_repo.git.execute("git checkout master") data = self.local_repo.git.execute("git pull {} {}".format(*self.repo.split('/'))) print(data) print("We have updated to #{}".format(self.local_repo.commit().hexsha[:7])) print("Will undergo a cold reload now.") init.restart(1) no_updates = False time.sleep(self.update_interval)
def internal_on_disconnect(self): restart(1)