Psyduck - 可達鴨 之 鴨力山大2


Server : LiteSpeed
System : Linux premium217.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User : alloknri ( 880)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /usr/lib/python3.6/site-packages/up2date_client/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/python3.6/site-packages/up2date_client/clientCaps.py
# a dict with "capability name" as the key, and the version
# as the value.

import glob
import os

from up2date_client.capabilities import parseCap

try: # python2
    import UserDict
except ImportError: # python3
    import collections as UserDict

class ClientCapabilities(UserDict.UserDict):
    def __init__(self):
        UserDict.UserDict.__init__(self)
        self.populate()

    def populate(self, capsToPopulate=None):
        # FIXME: at some point, this will be
        # intelligently populated...
        localcaps = {
            "caneatCheese":{'version':1, 'value': 1}
            }
        if capsToPopulate:
            localcaps = capsToPopulate
        self.data = localcaps

    def headerFormat(self):
        headerList = []
        for key in self.data.keys():
            headerName = "X-RHN-Client-Capability"
            value = "%s(%s)=%s" % (key,
                                   self.data[key]['version'],
                                   self.data[key]['value'])
            headerList.append((headerName, value))
        return headerList

caps = ClientCapabilities()

def loadLocalCaps(capsDir = "/etc/sysconfig/rhn/clientCaps.d"):

    capsFiles = glob.glob("%s/*" % capsDir)

    for capsFile in capsFiles:
        if os.path.isdir(capsFile):
            continue
        if not os.access(capsFile, os.R_OK):
            continue

        fd = open(capsFile, "r")
        for line in fd.readlines():
            line = line.strip()
            if not line or line[0] == "#":
                continue
            caplist = parseCap(line)

            for (cap,data) in caplist:
                caps.data[cap] = data

#    print(caps.data)

loadLocalCaps()

# register local caps we require.
def registerCap(cap, data):
    caps.data[cap] = data


# figure out something pretty here
registerCap("packages.runTransaction", {'version':'1', 'value':'1'})
registerCap("packages.rollBack", {'version':'1', 'value':'1'})
registerCap("packages.verify", {'version':'1', 'value':'1'})
registerCap("packages.extended_profile", {'version':'2', 'value':'1'})
registerCap("reboot.reboot", {'version':'1', 'value':'1'})
registerCap("packages.update", {'version':'2', 'value':'2'})
Name
Size
Permissions
Options
__pycache__
--
drwxr-xr-x
__init__.py
0 KB
-rw-r--r--
capabilities.py
7.277 KB
-rw-r--r--
clientCaps.py
2.156 KB
-rw-r--r--
clpwd.py
3.558 KB
-rw-r--r--
config.py
14.456 KB
-rw-r--r--
debUtils.py
2.764 KB
-rw-r--r--
getMethod.py
4.201 KB
-rw-r--r--
haltree.py
4.533 KB
-rw-r--r--
hardware.py
31.909 KB
-rw-r--r--
hardware_gudev.py
12.906 KB
-rw-r--r--
hardware_hal.py
11.332 KB
-rw-r--r--
hardware_udev.py
12.988 KB
-rw-r--r--
pkgUtils.py
0.288 KB
-rw-r--r--
pkgplatform.py
0.302 KB
-rw-r--r--
pmPlugin.py
2.792 KB
-rw-r--r--
rhnChannel.py
4.913 KB
-rw-r--r--
rhnHardware.py
0.32 KB
-rw-r--r--
rhnPackageInfo.py
2.34 KB
-rw-r--r--
rhncli.py
9.116 KB
-rw-r--r--
rhnreg.py
31.349 KB
-rw-r--r--
rhnreg_constants.py
18.134 KB
-rw-r--r--
rhnserver.py
9.308 KB
-rw-r--r--
rpcServer.py
11.718 KB
-rw-r--r--
rpmUtils.py
5.196 KB
-rw-r--r--
transaction.py
4.095 KB
-rw-r--r--
tui.py
43.7 KB
-rw-r--r--
up2dateAuth.py
10.688 KB
-rw-r--r--
up2dateErrors.py
10.256 KB
-rw-r--r--
up2dateLog.py
2.059 KB
-rw-r--r--
up2dateUtils.py
5.059 KB
-rw-r--r--