本文整理汇总了Python中up2date_client.up2dateAuth.getSystemId函数的典型用法代码示例。如果您正苦于以下问题:Python getSystemId函数的具体用法?Python getSystemId怎么用?Python getSystemId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSystemId函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: getChannels
def getChannels(force=None, label_whitelist=None, timeout=None):
""" return rhnChannelList containing list of channel we are subscribed to """
cfg = config.initUp2dateConfig()
global selected_channels
if not selected_channels and not force:
selected_channels = rhnChannelList()
s = rhnserver.RhnServer(timeout=timeout)
if not up2dateAuth.getSystemId():
raise up2dateErrors.NoSystemIdError(_("Unable to Locate SystemId"))
up2dateChannels = s.up2date.listChannels(up2dateAuth.getSystemId())
for chan in up2dateChannels:
if label_whitelist and not chan['label'] in label_whitelist:
continue
channel = rhnChannel(type = 'up2date', url = config.getServerlURL())
for key in chan.keys():
if key == "last_modified":
channel['version'] = chan['last_modified']
else:
channel[key] = chan[key]
selected_channels.addChannel(channel)
if len(selected_channels.list) == 0:
raise up2dateErrors.NoChannelsError(_("This system may not be updated until it is associated with a channel."))
return selected_channels
开发者ID:Bearlock,项目名称:spacewalk,代码行数:29,代码来源:rhnChannel.py
示例2: main
def main(self):
if not up2dateAuth.getSystemId():
sys.exit(1)
if not self._testRhnLogin():
sys.exit(1)
s = rhnserver.RhnServer()
if s.capabilities.hasCapability('queue.update_status'):
status_report = StatusCli.__build_status_report()
s.queue.update_status(up2dateAuth.getSystemId(), status_report)
开发者ID:m47ik,项目名称:uyuni,代码行数:11,代码来源:spacewalk-update-status.py
示例3: submit_response
def submit_response(self, action_id, status, message, data):
""" Submit a response for an action_id. """
# get a new server object with fresh headers
self.server = CheckCli.__get_server()
try:
ret = self.server.queue.submit(up2dateAuth.getSystemId(),
action_id, status, message, data)
except xmlrpclib.Fault:
f = sys.exc_info()[1]
print("Could not submit results to server %s" % self.server)
print("Error code: %d%s" % (f.faultCode, f.faultString))
sys.exit(-1)
# XXX: what if no SSL in socket?
except SSL.socket_error:
print("ERROR: SSL handshake to %s failed" % self.server)
print("""
This could signal that you are *NOT* talking to a server
whose certificate was signed by a Certificate Authority
listed in the %s file or that the
RHNS-CA-CERT file is invalid.""" % self.rhns_ca_cert)
sys.exit(-1)
except socket.error:
print("Could not submit to %s.\n"\
"Possible networking problem?" % str(self.server))
sys.exit(-1)
return ret
开发者ID:m47ik,项目名称:uyuni,代码行数:28,代码来源:rhn_check.py
示例4: updateHardware
def updateHardware():
s = rpcServer.getServer()
hardwareList = hardware.Hardware()
s.registration.refresh_hw_profile(up2dateAuth.getSystemId(),
hardwareList)
开发者ID:Bearlock,项目名称:spacewalk,代码行数:7,代码来源:rhnHardware.py
示例5: get_available_channels
def get_available_channels(user, password):
""" return list of available child channels """
modified_servers = []
servers = config.getServerlURL()
for server in servers:
scheme, netloc, path, query, fragment = urlparse.urlsplit(server)
modified_servers.append(urlparse.urlunsplit((scheme, netloc, '/rpc/api', query, fragment)))
client = rhnserver.RhnServer(serverOverride=modified_servers)
try:
key = client.auth.login(user, password)
except xmlrpclib.Fault:
exc = sys.exc_info()[1]
systemExit(1, "Error during client authentication: %s" % exc.faultString)
system_id = re.sub('^ID-', '', rpclib.xmlrpclib.loads(up2dateAuth.getSystemId())[0][0]['system_id'])
result = []
try:
channels = client.system.listChildChannels(key, int(system_id))
except xmlrpclib.Fault:
exc = sys.exc_info()[1]
systemExit(1, "Error when listing child channels: %s" % exc.faultString)
for channel in channels:
if 'LABEL' in channel:
result.extend([channel['LABEL']])
else:
result.extend([channel['label']])
return result
开发者ID:aronparsons,项目名称:spacewalk,代码行数:28,代码来源:spacewalk-channel.py
示例6: __init__
def __init__(self, screen, tui):
if not rhnreg.registered() or tui.test:
raise WindowSkipException()
self.screen = screen
self.tui = tui
size = snack._snack.size()
systemIdXml = rpclib.xmlrpclib.loads(up2dateAuth.getSystemId())
oldUsername = systemIdXml[0][0]['username']
oldsystemId = systemIdXml[0][0]['system_id']
toplevel = snack.GridForm(self.screen, sstr(SYSTEM_ALREADY_SETUP), 1, 2)
self.bb = snack.ButtonBar(self.screen,
[(sstr(YES_CONT), "next"),
(sstr(NO_CANCEL), "exit")])
toplevel.add(self.bb, 0, 1, growx = 1)
tb = snack.Textbox(size[0]-30, size[1]-20,
sstr(SYSTEM_ALREADY_REGISTERED + "\n\n"
+ _("Spacewalk Location:") + " " + convert_url_from_puny(self.tui.serverURL) + "\n"
+ _("Login:") + " " + oldUsername + "\n"
+ _("System ID:") + " " + oldsystemId + "\n\n"
+ SYSTEM_ALREADY_REGISTERED_CONT + "\n"),
1, 1)
toplevel.add(tb, 0, 0, padding = (0, 0, 0, 1))
self.g = toplevel
开发者ID:jdobes,项目名称:spacewalk,代码行数:29,代码来源:tui.py
示例7: __get_action
def __get_action(self, status_report):
try:
action = self.server.queue.get(up2dateAuth.getSystemId(),
ACTION_VERSION, status_report)
return action
except xmlrpclib.Fault:
f = sys.exc_info()[1]
if f.faultCode == -31:
raise up2dateErrors.InsuffMgmntEntsError(f.faultString), None, sys.exc_info()[2]
else:
print "Could not retrieve action item from server %s" % self.server
print "Error code: %d%s" % (f.faultCode, f.faultString)
sys.exit(-1)
# XXX: what if no SSL in socket?
except socket.sslerror:
print "ERROR: SSL handshake to %s failed" % self.server
print """
This could signal that you are *NOT* talking to a server
whose certificate was signed by a Certificate Authority
listed in the %s file or that the
RHNS-CA-CERT file is invalid.""" % self.rhns_ca_cert
sys.exit(-1)
except socket.error:
print "Could not retrieve action from %s.\n"\
"Possible networking problem?" % str(self.server)
sys.exit(-1)
except up2dateErrors.ServerCapabilityError:
print sys.exc_info()[1]
sys.exit(1)
except SSL.Error:
print "ERROR: SSL errors detected"
print "%s" % sys.exc_info()[1]
sys.exit(-1)
开发者ID:bsmeets86,项目名称:spacewalk,代码行数:34,代码来源:rhn_check.py
示例8: __query_future_actions
def __query_future_actions(self, time_window):
try:
actions = self.server.queue.get_future_actions(up2dateAuth.getSystemId(),
time_window)
return actions
except xmlrpclib.Fault:
f = sys.exc_info()[1]
if f.faultCode == -31:
raise_with_tb(up2dateErrors.InsuffMgmntEntsError(f.faultString))
else:
print("Could not retrieve action item from server %s" % self.server)
print("Error code: %d%s" % (f.faultCode, f.faultString))
sys.exit(-1)
# XXX: what if no SSL in socket?
except SSL.socket_error:
print("ERROR: SSL handshake to %s failed" % self.server)
print("""
This could signal that you are *NOT* talking to a server
whose certificate was signed by a Certificate Authority
listed in the %s file or that the
RHNS-CA-CERT file is invalid.""" % self.rhns_ca_cert)
sys.exit(-1)
except socket.error:
print("Could not retrieve action from %s.\n"\
"Possible networking problem?" % str(self.server))
sys.exit(-1)
except up2dateErrors.ServerCapabilityError:
print(sys.exc_info()[1])
sys.exit(1)
except SSL.Error:
print("ERROR: SSL errors detected")
print("%s" % sys.exc_info()[1])
sys.exit(-1)
开发者ID:m47ik,项目名称:uyuni,代码行数:33,代码来源:rhn_check.py
示例9: is_registered_with_classic
def is_registered_with_classic(self):
try:
sys.path.append('/usr/share/rhn')
from up2date_client import up2dateAuth
except ImportError:
return False
return up2dateAuth.getSystemId() is not None
开发者ID:MichaelMraka,项目名称:subscription-manager,代码行数:8,代码来源:hwprobe.py
示例10: rhn_username
def rhn_username(self):
try:
cfg = config.initUp2dateConfig()
return rpclib.xmlrpclib.loads(up2dateAuth.getSystemId())[0][0]['username']
except:
# ignore any exception and return an empty username
return ""
开发者ID:Nick-Harvey,项目名称:sosreport,代码行数:8,代码来源:redhat.py
示例11: rhn_username
def rhn_username(self):
try:
# cfg = config.initUp2dateConfig()
rhn_username = rpclib.xmlrpclib.loads(
up2dateAuth.getSystemId())[0][0]['username']
return rhn_username.encode('utf-8', 'ignore')
except:
# ignore any exception and return an empty username
return ""
开发者ID:freyes,项目名称:sos,代码行数:9,代码来源:redhat.py
示例12: updatePackageProfile
def updatePackageProfile(timeout=None):
""" get a list of installed packages and send it to rhnServer """
log = up2dateLog.initLog()
log.log_me("Updating package profile")
packages = pkgUtils.getInstalledPackageList(getArch=1)
s = rhnserver.RhnServer(timeout=timeout)
if not s.capabilities.hasCapability('xmlrpc.packages.extended_profile', 2):
# for older satellites and hosted - convert to old format
packages = convertPackagesFromHashToList(packages)
s.registration.update_packages(up2dateAuth.getSystemId(), packages)
开发者ID:Bearlock,项目名称:spacewalk,代码行数:10,代码来源:rhnPackageInfo.py
示例13: getSolutions
def getSolutions(self, unknowns, progressCallback = None, msgCallback = None):
s = rpcServer.getServer(refreshCallback=self.refreshCallback)
try:
tmpRetList = rpcServer.doCall(s.up2date.solveDependencies,
up2dateAuth.getSystemId(),
unknowns)
except rpclib.Fault, f:
if f.faultCode == -26:
#raise RpmError(f.faultString + _(", depended on by %s") % unknowns)
raise up2dateErrors.RpmError(f.faultString)
else:
raise up2dateErrors.CommunicationError(f.faultString)
开发者ID:ChrisPortman,项目名称:mrepo,代码行数:12,代码来源:up2dateRepo.py
示例14: get_sys_id
def get_sys_id():
sysid_xml = up2dateAuth.getSystemId()
if not sysid_xml:
system_exit(1, "Could not get RHN systemid")
m = search('ID-(?P<sysid>[0-9]+)', sysid_xml)
if m:
return m.group('sysid')
else:
return
开发者ID:dewayneHat,项目名称:spacewalk,代码行数:12,代码来源:rhn-custom-info.py
示例15: __query_future_actions
def __query_future_actions(self, time_window):
try:
actions = self.server.queue.get_future_actions(up2dateAuth.getSystemId(),
time_window)
return actions
except xmlrpclib.Fault, f:
if f.faultCode == -31:
raise up2dateErrors.InsuffMgmntEntsError(f.faultString), None, sys.exc_info()[2]
else:
print "Could not retrieve action item from server %s" % self.server
print "Error code: %d%s" % (f.faultCode, f.faultString)
sys.exit(-1)
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:12,代码来源:rhn_check.py
示例16: __get_action
def __get_action(self, status_report):
try:
action = self.server.queue.get(up2dateAuth.getSystemId(),
ACTION_VERSION, status_report)
return action
except xmlrpclib.Fault, f:
if f.faultCode == -31:
raise up2dateErrors.InsuffMgmntEntsError(f.faultString), None, sys.exc_info()[2]
else:
print "Could not retrieve action item from server %s" % self.server
print "Error code: %d%s" % (f.faultCode, f.faultString)
sys.exit(-1)
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:13,代码来源:rhn_check.py
示例17: submit_response
def submit_response(self, action_id, status, message, data):
""" Submit a response for an action_id. """
# get a new server object with fresh headers
self.server = CheckCli.__get_server()
try:
ret = self.server.queue.submit(up2dateAuth.getSystemId(),
action_id, status, message, data)
except xmlrpclib.Fault, f:
print "Could not submit results to server %s" % self.server
print "Error code: %d%s" % (f.faultCode, f.faultString)
sys.exit(-1)
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:13,代码来源:rhn_check.py
示例18: execute
def execute(self):
"""
Sends all items in the plan to the satellite.
"""
systemid = up2dateAuth.getSystemId()
if systemid is None:
raise NotRegistered("System ID not found.")
server = rhnserver.RhnServer()
try:
server.registration.virt_notify(systemid, self.__items)
except up2dateErrors.CommunicationError, e:
log.trace_me()
log.log_me(e)
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:16,代码来源:notification.py
示例19: update
def update(errataidlist, cache_only=None):
if type(errataidlist) not in [type([]), type(())]:
errataidlist = [ errataidlist ]
s = rhnserver.RhnServer()
if s.capabilities.hasCapability('xmlrpc.errata.patch_names'):
system_id = up2dateAuth.getSystemId()
erratas = s.errata.getErrataNamesById(system_id, errataidlist)
errata_names = [tup[1] for tup in erratas]
return packages.patch_install(errata_names, cache_only)
else:
# see XXX comment in old_update's method definition
old_update(errataidlist, cache_only)
开发者ID:openSUSE,项目名称:zypp-plugin-spacewalk,代码行数:16,代码来源:errata.py
示例20: _upload_results
def _upload_results(xccdf_result, results_dir, args):
errors = ''
if results_dir:
server = rhnserver.RhnServer()
# No need to check capabilities. The server supports detailed results
# If rhe 'file_size' and 'id' was in supplied in the argument list.
systemid = up2dateAuth.getSystemId()
for filename in os.listdir(results_dir):
path = os.path.join(results_dir, filename)
if path == xccdf_result.name:
f = xccdf_result.file
filename = "xccdf-results.xml"
else:
f = open(path, 'rb')
errors += _upload_file(server, systemid, args, path, filename, f)
if path != xccdf_result.name:
f.close()
return errors
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:18,代码来源:scap.py
注:本文中的up2date_client.up2dateAuth.getSystemId函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论