| Server IP : 152.69.216.235 / Your IP : 80.80.80.28 Web Server : Apache/2.4.37 (Oracle Linux Server) System : Linux ust-wp4-prod 5.15.0-310.184.5.2.el8uek.x86_64 #2 SMP Wed Jul 9 16:08:33 PDT 2025 x86_64 User : apache ( 48) PHP Version : 8.4.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /lib/python3.6/site-packages/ |
Upload File : |
# See included LICENSE file for additional license and copyright information.
import datetime
import pycurl
from io import BytesIO
import logging
import posixpath
import os
import traceback
import Uptrack
class UptrackDepSolver(object):
def __init__(self,
local,
installed_update_ids, locked_update_ids):
self.local_status = local
self.config = local.client_config
self.server_url = posixpath.join(self.config.remote, 'actions')
self.installed_update_ids = installed_update_ids
self.locked_update_ids = locked_update_ids
def _sendRequest(self, request):
contents = Uptrack.yaml_dump(request, version=(1, 1),
explicit_start=True, explicit_end=True)
stream = BytesIO()
c = Uptrack.getCurl()
c.setopt(pycurl.URL, self.server_url.encode('ISO-8859-1'))
c.setopt(pycurl.HTTPPOST, [('request', contents)])
c.setopt(pycurl.WRITEFUNCTION, stream.write)
try:
c.perform()
except Exception:
# We can be somewhat sloppier in error reporting here,
# because we already checked for network and key validity
# when fetching packages.yml.
logging.debug("Request to the dependency solver failed", exc_info=1)
raise Uptrack.ResultException(Uptrack.ERROR_NO_NETWORK,
"An error occurred requesting upgrade plans from "
"the server. Check your\nnetwork connection and try again.")
rcode = c.getinfo(pycurl.RESPONSE_CODE)
if rcode != 200:
logging.debug("Received HTTP %03d from the server" % rcode)
if 500 <= rcode <= 599:
raise Uptrack.server_error_exception
else:
raise Uptrack.ResultException(Uptrack.ERROR_INTERNAL_SERVER_ERROR,
"The Ksplice Uptrack server reported the error:\n" +
stream.getvalue().decode('utf-8'))
response = Uptrack.yaml_load(stream.getvalue().decode('utf-8'))
if 'Backoff' in response:
self.config.updateBackoff(response['Backoff'])
if ('RegenerateUUID' in response
and response['RegenerateUUID']
and not self.config.use_hw_uuid):
self.config.newuuid = self.config.newUUID()
if 'RemovableModules' in response:
self.config.removableModules = response['RemovableModules']
return response
def getPlans(self, actions):
req = {}
Uptrack.Status.addIdentity(self.config, req, local_status=self.local_status)
req['Time'] = datetime.datetime.now(datetime.timezone.utc)
req['Command'] = {}
req['Command']['Action'] = 'getPlansEx'
req['Command']['Cron'] = self.config.cron
req['Command']['Autoinstall'] = self.config.cron_autoinstall
req['Command']['Actions'] = actions
req['Command']['Already Installed'] = self.installed_update_ids
req['Command']['Locked'] = self.locked_update_ids
req['Command']['Modules Loaded'] = self.config.modules
return self._sendRequest(req)