def __update_status(self, status): """ Update the runnng kernel and the last boot values for this server from the status dictionary passed on queue checkin. Record last running kernel and uptime. Only update last_boot if it has changed by more than five seconds. We don't know the timezone the server is in. or even if its clock is right, but we do know it can properly track seconds since it rebooted, and use our own clocks to keep proper track of the actual time. """ rhnSQL.set_log_auth_login('CLIENT') if 'uname' in status: kernelver = status['uname'][2] if kernelver != self.server.server["running_kernel"]: self.server.server["running_kernel"] = kernelver # XXX:We should be using Oracle's sysdate() for this management # In the case of multiple app servers in mutiple time zones all the # results are skewed. if 'uptime' in status: uptime = status['uptime'] if isinstance(uptime, type([])) and len(uptime): # Toss the other values. For now uptime = uptime[0] try: uptime = float(uptime) except ValueError: # Wrong value passed by the client pass else: last_boot = time.time() - uptime if abs(last_boot - self.server.server["last_boot"]) > 5: self.server.server["last_boot"] = last_boot self.__set_reboot_action_to_succcess() # this is smart enough to do a NOOP if nothing changed. self.server.server.save()
def __update_status(self, status): """ Update the runnng kernel and the last boot values for this server from the status dictionary passed on queue checkin. Record last running kernel and uptime. Only update last_boot if it has changed by more than five seconds. We don't know the timezone the server is in. or even if its clock is right, but we do know it can properly track seconds since it rebooted, and use our own clocks to keep proper track of the actual time. """ rhnSQL.set_log_auth_login('CLIENT') if status.has_key('uname'): kernelver = status['uname'][2] if kernelver != self.server.server["running_kernel"]: self.server.server["running_kernel"] = kernelver # XXX:We should be using Oracle's sysdate() for this management # In the case of multiple app servers in mutiple time zones all the # results are skewed. if status.has_key('uptime'): uptime = status['uptime'] if isinstance(uptime, type([])) and len(uptime): # Toss the other values. For now uptime = uptime[0] try: uptime = float(uptime) except ValueError: # Wrong value passed by the client pass else: last_boot = time.time() - uptime if abs(last_boot - self.server.server["last_boot"]) > 5: self.server.server["last_boot"] = last_boot self.__set_reboot_action_to_succcess() # this is smart enough to do a NOOP if nothing changed. self.server.server.save()
if not options.ignore_expiration: date = expiredYN(options.rhn_cert) if date: just_date = date.split(' ')[0] writeError('RHN Certificate appears to have expired: %s' % just_date) return 11 if not options.sanity_only: prepRhnCert(options) # local activation try: rhnSQL.initDB() rhnSQL.clear_log_id() rhnSQL.set_log_auth_login('SETUP') if options.verbose: print("Database connectioned initialized: refer to %s" % CFG.filename) activateSatellite_local(options) except RHNCertLocalActivationException, e: writeError(e) return 30 # remote activation if not options.disconnected: try: activateSatellite_remote(options) except RHNCertRemoteActivationException, e: writeError(e) return 20
if not options.ignore_expiration: date = expiredYN(options.rhn_cert) if date: just_date = date.split(' ')[0] writeError( 'RHN Certificate appears to have expired: %s' % just_date) return 11 if not options.sanity_only: prepRhnCert(options) # local activation try: rhnSQL.initDB() rhnSQL.clear_log_id() rhnSQL.set_log_auth_login('SETUP') if options.verbose: print ("Database connectioned initialized: refer to %s" % CFG.filename) activateSatellite_local(options) except RHNCertLocalActivationException, e: writeError(e) return 30 # remote activation if not options.disconnected: try: activateSatellite_remote(options) except RHNCertRemoteActivationException, e: writeError(e) return 20