def run(self): method = self.getMethod() fce = getattr(self, method) system_id = self.argv[1] if self.argv[1] == "whoami": system_id = read_system_id() return fce(system_id, *self.argv[2:])
def gen_react_key(self, system_id): if not isinstance(system_id, int): system_id = read_system_id() # Add provisioning entitlement if 'provisioning_entitled' not in self.call("system.getEntitlements", system_id): self.call("system.addEntitlements", system_id, ('provisioning_entitled', )) # Print system with newest 'last_checkin' print self.call("system.obtainReactivationKey", system_id) return True
def gen_react_key(self, system_id): if not isinstance(system_id, int): system_id = read_system_id() # Add provisioning entitlement if 'provisioning_entitled' not in self.call("system.getEntitlements", system_id): self.call("system.addEntitlements", system_id, ('provisioning_entitled',)) # Print system with newest 'last_checkin' print self.call("system.obtainReactivationKey", system_id) return True
def list_syst_channels(self): try: # taking into {try: exept} in order to return 0 when all # the operations below are successful. [gkhachik] # edit: we want to see potential API tracebacks, so API calls were # moved to else: block [pnovotny] system_id = read_system_id() except: return False else: for c in self.call("system.listSubscribableBaseChannels", system_id): if c['current_base'] == 1: print c['label'] for c in self.call("system.listSubscribedChildChannels", system_id): print c['label'] return True
def interpret_param(self, bunch, param=None): # result = {'channel_id': '161'} # result = {'list':'true'} # result = {'cobbler':'sync'} # Interpret second param in a way based on a first one # (see examples above for different bunches) result = {} if bunch in ('repo-sync-bunch', 'channel-repodata-bunch'): result = {'channel_id': str(param)} if bunch in ('errata-cache-bunch'): if param is not None and re.match(r'^[0-9]{10}$', str(param), re.M): result = {'system_id': str(param)} if param == 'whoami': result = {'system_id': str(read_system_id())} elif param is not None and re.match(r'^[0-9]{1,}$', str(param), re.M): result = {'channel_id': str(param)} print "bunch:", bunch # DEBUG print "result:", result # DEBUG return result
def get_system_id(self): print read_system_id() return True
def subscribe_syst(self, channel): if not self.check_channel_exists(channel): return False return self.call("channel.software.subscribeSystem", read_system_id(), channel)
def get_server_id(self, server_id): if server_id == 'whoami': server_id = read_system_id() else: server_id = int(server_id) return server_id