__pycache__/errata.cpython-39.opt-1.pyc000064400000003114151103301520013610 0ustar00a ߾g @sfddlmZddlmZddlmZddlmZdgZdZddZdd dZ d d Z e d krbe d S)) rhnserver) up2dateAuth)pkgUtils)packagesupdatecCst}|jt|S)N)rZ RhnServerZerrataZ getErrataInforZ getSystemId)Z errata_idsr 6/usr/lib/python3.9/site-packages/rhn/actions/errata.py__getErrataInfosr Nc Cs~g}t|tgtdfvr"|g}|D]}t|}||}q&i}i}tjddD]$}|||d|d<|||d<qPi}t|ddkr|D]|}d|d|df|vr|||d|d<qd |d|vr|||d|d<q|dd kr|d|vr|||d<qn&|D] }|d|vr|||d<qt|}|gkrri} d | d <d | d<|| d<dd| fSt||S)Nr )ZgetArchnameZarchrz%s%sz%snoarchZnoarch0versionzerrata.update.no_packagesZerratas'z*No packages from that errata are available) typer rZgetInstalledPackageListlenlistvaluesrr) Z errataidlistZ cache_onlyZ packagelistZerrataidZtmpListZcurrent_packages_with_archZcurrent_packagespudatar r r rsD   cCsttdgdS)Niie)printrr r r r mainPsr__main__)N) Zup2date_clientrrrZ rhn.actionsrZ __rhnexport__ZACTION_VERSIONr rr__name__r r r r  s     7__pycache__/errata.cpython-39.pyc000064400000003114151103301520012651 0ustar00a ߾g @sfddlmZddlmZddlmZddlmZdgZdZddZdd dZ d d Z e d krbe d S)) rhnserver) up2dateAuth)pkgUtils)packagesupdatecCst}|jt|S)N)rZ RhnServerZerrataZ getErrataInforZ getSystemId)Z errata_idsr 6/usr/lib/python3.9/site-packages/rhn/actions/errata.py__getErrataInfosr Nc Cs~g}t|tgtdfvr"|g}|D]}t|}||}q&i}i}tjddD]$}|||d|d<|||d<qPi}t|ddkr|D]|}d|d|df|vr|||d|d<qd |d|vr|||d|d<q|dd kr|d|vr|||d<qn&|D] }|d|vr|||d<qt|}|gkrri} d | d <d | d<|| d<dd| fSt||S)Nr )ZgetArchnameZarchrz%s%sz%snoarchZnoarch0versionzerrata.update.no_packagesZerratas'z*No packages from that errata are available) typer rZgetInstalledPackageListlenlistvaluesrr) Z errataidlistZ cache_onlyZ packagelistZerrataidZtmpListZcurrent_packages_with_archZcurrent_packagespudatar r r rsD   cCsttdgdS)Niie)printrr r r r mainPsr__main__)N) Zup2date_clientrrrZ rhn.actionsrZ __rhnexport__ZACTION_VERSIONr rr__name__r r r r  s     7__pycache__/packages.cpython-39.opt-1.pyc000064400000020523151103301520014113 0ustar00a ߾g.@sddlZddlZddlZddlZddlmZddlmZddlmZddlm Z e Z dZ gdZ d"dd Zd#d d Zd$d d Zd%ddZd&ddZd'ddZddZd(ddZd)ddZggdddfddZddZd d!ZdS)*N) up2dateLog)config)rpmUtils)rhnPackageInfoz/var/lib/up2date/dbtimestamp)updateremove refresh_list fullUpdatecheckNeedUpdaterunTransactionverifycsj|rddifSt|ts"ddifStd|tddd}|jfd d |D}t||d|d S) z0We have been told that we should remove packagesrno-ops for caching $Invalid arguments passed to functionzCalled remove_packagesTFload_system_repoload_available_reposcsg|]}t|qS)_package_tup2obj).0tup installedr8/usr/lib/python3.9/site-packages/rhn/actions/packages.py :zremove..)r allow_erasing cache_only) isinstancelistlog log_debug _dnf_basesackqueryr_dnf_transaction) package_listrbase to_removerrrr-s     rcCst|tsddifStd|tddd}|j}|j}d}g}g}|D]}t |dkrt| d|\} } } } } | dkr| dkr| dkr| dkr|j | d rtd | qX| dkrd } |j | | d  }t ||}|sd t|}td|| |qX|D]R}||}|d krDtdt|qXn |d krtdt|qXq| |qX|s|rddd|dddf}n d dif}|j||St|||dS)z:We have been told that we should retrieve/install packagesrrz Called updateTrN)namezPackage %s is already installedr)r+archz,Package %s is not available for installationzE: zPackage %s already installedz6More recent version of package %s is already installed z-Failed: Packages failed to install properly:  1package_install_failure)versionr+z$Requested packages already installed)installr)rrr r!r"r#r$r availablelenappendfilterZlatestr_package_tup2strZlog_meZevr_cmpjoin_plugins_unloadcloser%)r&rr'rr3errZerrmsgs to_installpackager+r1releaseepochr,pkgsZ requested_pkgpkgZpkg_cmpretrrrr?sp                 rc Cs|rddifStddd}|j}|j}g}g}|dddD]N}|\}} t||} | dkr|| r||| qN| dkrN| sNt||} || qN|s|sdd ifSt|||d|d S) z Run a transaction on a group of packages. This was historicaly meant as generic call, but is only called for rollback. rr TrpackagesNeiz6Requested package actions have already been performed.)r2rrr)r"r#r$rr3rr5r%) Ztransaction_datarr'rr3r=r(Zpackage_objectr>actionrBnewrrrr s(         r cCstddd}t|d|dS)z$ Update all packages on the system. Tr) full_updater)r"r%)forcerr'rrrr s r c Cs|rddifSi}d}t}|dr.|d}d|}zt|d}Wndd|fYS0zttd}Wnd}Yn0||dkrdd |fS|dkrzttd }|Wndd |fYS0td d S)z Check if the locally installed package list changed, if needed the list is updated on the server In case of error avoid pushing data to stay safe rr z /var/lib/rpmdbpathz %s/Packageszunable to stat the rpm database zNrpm database not modified since last update (or package list recently updated)w+!unable to open the timestamp file)rhnsd)rZinitUp2dateConfigosstatLAST_UPDATE_FILEopenr;r) rQrdatarKZcfgZRPM_PACKAGE_FILEZdbtimelastfilerrrr s6     r cCsX|rddifStdd}z tWntdddifYS0tddifS) z3 push again the list of rpm packages to the server rr zCalled refresh_rpmlistNz8ERROR: refreshing remote package list for System ProfilezError refreshing package listzrpmlist refreshed)r r!rZupdatePackageProfileprinttouch_time_stamp)rQrrCrrrrs   rcCsjzttd}|WnddifYS0t}ztt||fWnddtifYS0dS)NrNrrOz6unable to set the time stamp on the time stamp file %s)rUrTr;timerRutime)Zfile_dtrrrr[s  r[cCsvtd|rddifSi}d|d<d|d<t|\}}||d<t|rld|d<d|d<||d <d d |fSdd |fS) NzCalled packages.verifyrr zpackages.verifyr+r1Z verify_infoz packages.verify.missing_packagesmissing_packages+z-packages requested to be verified are missingzpackages verified)r r!rZverifyPackagesr4)rDrrVrCr_rrrr s   r TcCs6t}|jjs||r$||jddd|S)NTr)dnfZBaser9ZpluginsZ init_pluginsZread_all_reposZ fill_sack)rrr'rrrr" sr"Fc Cszfz|r|n0|D]}|r||q|D]}|r0||q0||tdt|jsntj d|jj rtddd|jj D| |jj |jj rtddd|jj D|s|Wntj jy4}zFi}d|d <d |d <d d t||fWYd}~W|j|Sd}~0tj jy}zFi}d|d <d|d <ddt||fWYd}~W|j|Sd}~0tj jy}zFi}d|d <d|d <ddt||fWYd}~W|j|Sd}~0tj j yR}z>d} dt|} i}| | |fWYd}~W|j|Sd}~00W|j|n|j|0ddifS)zE command is an function excpecting dnf.Base() as an argument zDependencies Resolvedzempty transactionzDownloading and installing: cSsg|] }t|qSrstrrprrrr-rz$_dnf_transaction..z Removing: cSsg|] }t|qSrrbrdrrrr1rr/r1r0r+r-z/Failed: Packages failed to install properly: %sNrZrpmremoveerrorsz%sZ failed_depsz9Failed: packages requested raised dependency problems: %s)z)Error while executing packages action: %szUpdate Succeeded)Z upgrade_allZpackage_installZpackage_removeresolver r!r4Z transactionra exceptionsErrorZ install_setZdownload_packagesZ remove_setZdo_transactionZ MarkingErrorrcr9r:r;Z DepsolveError) r'r2rrIrrrBrErVstatusmessagerrrr%s                  r%c Cs|dd\}}}}t|dkr(|dnd}d|i}|durPt|dkrP||d<|durlt|dkrl||d<|durt|dkrt||d<|durt|dkr||d<|jfi|}|r|dSdS)Nr+rr1r?r@r,)r4intr6run) qrr+r1r?r@r,r$rArrrrUs rcCsD|dd\}}}}}|sd}d||||f}|r>|d|7}|fS)z6 Create a package name from an rhn package tuple. N0z %s-%s:%s-%sz.%sr)Z package_tupnvrrEaZpkginforrrr7gs r7)N)N)N)rN)NN)NN)N)TT)rRr\Zdnf.exceptionsraZdnf.cliZup2date_clientrrrrZinitLogr rTZ __rhnexport__rrr r r rr[r r"r%rr7rrrrs0      E  )    >__pycache__/packages.cpython-39.pyc000064400000020523151103301520013154 0ustar00a ߾g.@sddlZddlZddlZddlZddlmZddlmZddlmZddlm Z e Z dZ gdZ d"dd Zd#d d Zd$d d Zd%ddZd&ddZd'ddZddZd(ddZd)ddZggdddfddZddZd d!ZdS)*N) up2dateLog)config)rpmUtils)rhnPackageInfoz/var/lib/up2date/dbtimestamp)updateremove refresh_list fullUpdatecheckNeedUpdaterunTransactionverifycsj|rddifSt|ts"ddifStd|tddd}|jfd d |D}t||d|d S) z0We have been told that we should remove packagesrno-ops for caching $Invalid arguments passed to functionzCalled remove_packagesTFload_system_repoload_available_reposcsg|]}t|qS)_package_tup2obj).0tup installedr8/usr/lib/python3.9/site-packages/rhn/actions/packages.py :zremove..)r allow_erasing cache_only) isinstancelistlog log_debug _dnf_basesackqueryr_dnf_transaction) package_listrbase to_removerrrr-s     rcCst|tsddifStd|tddd}|j}|j}d}g}g}|D]}t |dkrt| d|\} } } } } | dkr| dkr| dkr| dkr|j | d rtd | qX| dkrd } |j | | d  }t ||}|sd t|}td|| |qX|D]R}||}|d krDtdt|qXn |d krtdt|qXq| |qX|s|rddd|dddf}n d dif}|j||St|||dS)z:We have been told that we should retrieve/install packagesrrz Called updateTrN)namezPackage %s is already installedr)r+archz,Package %s is not available for installationzE: zPackage %s already installedz6More recent version of package %s is already installed z-Failed: Packages failed to install properly:  1package_install_failure)versionr+z$Requested packages already installed)installr)rrr r!r"r#r$r availablelenappendfilterZlatestr_package_tup2strZlog_meZevr_cmpjoin_plugins_unloadcloser%)r&rr'rr3errZerrmsgs to_installpackager+r1releaseepochr,pkgsZ requested_pkgpkgZpkg_cmpretrrrr?sp                 rc Cs|rddifStddd}|j}|j}g}g}|dddD]N}|\}} t||} | dkr|| r||| qN| dkrN| sNt||} || qN|s|sdd ifSt|||d|d S) z Run a transaction on a group of packages. This was historicaly meant as generic call, but is only called for rollback. rr TrpackagesNeiz6Requested package actions have already been performed.)r2rrr)r"r#r$rr3rr5r%) Ztransaction_datarr'rr3r=r(Zpackage_objectr>actionrBnewrrrr s(         r cCstddd}t|d|dS)z$ Update all packages on the system. Tr) full_updater)r"r%)forcerr'rrrr s r c Cs|rddifSi}d}t}|dr.|d}d|}zt|d}Wndd|fYS0zttd}Wnd}Yn0||dkrdd |fS|dkrzttd }|Wndd |fYS0td d S)z Check if the locally installed package list changed, if needed the list is updated on the server In case of error avoid pushing data to stay safe rr z /var/lib/rpmdbpathz %s/Packageszunable to stat the rpm database zNrpm database not modified since last update (or package list recently updated)w+!unable to open the timestamp file)rhnsd)rZinitUp2dateConfigosstatLAST_UPDATE_FILEopenr;r) rQrdatarKZcfgZRPM_PACKAGE_FILEZdbtimelastfilerrrr s6     r cCsX|rddifStdd}z tWntdddifYS0tddifS) z3 push again the list of rpm packages to the server rr zCalled refresh_rpmlistNz8ERROR: refreshing remote package list for System ProfilezError refreshing package listzrpmlist refreshed)r r!rZupdatePackageProfileprinttouch_time_stamp)rQrrCrrrrs   rcCsjzttd}|WnddifYS0t}ztt||fWnddtifYS0dS)NrNrrOz6unable to set the time stamp on the time stamp file %s)rUrTr;timerRutime)Zfile_dtrrrr[s  r[cCsvtd|rddifSi}d|d<d|d<t|\}}||d<t|rld|d<d|d<||d <d d |fSdd |fS) NzCalled packages.verifyrr zpackages.verifyr+r1Z verify_infoz packages.verify.missing_packagesmissing_packages+z-packages requested to be verified are missingzpackages verified)r r!rZverifyPackagesr4)rDrrVrCr_rrrr s   r TcCs6t}|jjs||r$||jddd|S)NTr)dnfZBaser9ZpluginsZ init_pluginsZread_all_reposZ fill_sack)rrr'rrrr" sr"Fc Cszfz|r|n0|D]}|r||q|D]}|r0||q0||tdt|jsntj d|jj rtddd|jj D| |jj |jj rtddd|jj D|s|Wntj jy4}zFi}d|d <d |d <d d t||fWYd}~W|j|Sd}~0tj jy}zFi}d|d <d|d <ddt||fWYd}~W|j|Sd}~0tj jy}zFi}d|d <d|d <ddt||fWYd}~W|j|Sd}~0tj j yR}z>d} dt|} i}| | |fWYd}~W|j|Sd}~00W|j|n|j|0ddifS)zE command is an function excpecting dnf.Base() as an argument zDependencies Resolvedzempty transactionzDownloading and installing: cSsg|] }t|qSrstrrprrrr-rz$_dnf_transaction..z Removing: cSsg|] }t|qSrrbrdrrrr1rr/r1r0r+r-z/Failed: Packages failed to install properly: %sNrZrpmremoveerrorsz%sZ failed_depsz9Failed: packages requested raised dependency problems: %s)z)Error while executing packages action: %szUpdate Succeeded)Z upgrade_allZpackage_installZpackage_removeresolver r!r4Z transactionra exceptionsErrorZ install_setZdownload_packagesZ remove_setZdo_transactionZ MarkingErrorrcr9r:r;Z DepsolveError) r'r2rrIrrrBrErVstatusmessagerrrr%s                  r%c Cs|dd\}}}}t|dkr(|dnd}d|i}|durPt|dkrP||d<|durlt|dkrl||d<|durt|dkrt||d<|durt|dkr||d<|jfi|}|r|dSdS)Nr+rr1r?r@r,)r4intr6run) qrr+r1r?r@r,r$rArrrrUs rcCsD|dd\}}}}}|sd}d||||f}|r>|d|7}|fS)z6 Create a package name from an rhn package tuple. N0z %s-%s:%s-%sz.%sr)Z package_tupnvrrEaZpkginforrrr7gs r7)N)N)N)rN)NN)NN)N)TT)rRr\Zdnf.exceptionsraZdnf.cliZup2date_clientrrrrZinitLogr rTZ __rhnexport__rrr r r rr[r r"r%rr7rrrrs0      E  )    >__pycache__/__init__.cpython-39.opt-1.pyc000064400000000223151103301520014067 0ustar00a f8h@sdS)Nrrr8/usr/lib/python3.9/site-packages/rhn/actions/__init__.py__pycache__/__init__.cpython-39.pyc000064400000000223151103301520013130 0ustar00a f8h@sdS)Nrrr8/usr/lib/python3.9/site-packages/rhn/actions/__init__.py__pycache__/hardware.cpython-39.opt-1.pyc000064400000001737151103301520014140 0ustar00a f8hI@sRddlmZddlmZddlmZdZdgZd ddZddZed krNedS) )hardware) up2dateAuth) rpcServer refresh_listNcCsn|rddifSt}t}tdkr.tdz|jt |WntdddifYS0ddifS) Nrzno-ops for cachingzCalled refresh_hardwarez3ERROR: sending hardware database for System Profile z Error refreshing system hardwarezhardware list refreshed) rZHardwarerZ getServer argVerboseprintZ registrationZrefresh_hw_profilerZ getSystemId)Z cache_onlyZ hardwareListsr 8/usr/lib/python3.9/site-packages/rhn/actions/hardware.pyrs  cCsttdS)N)r rr r r r main(sr __main__)N) Zup2date_clientrrrrZ __rhnexport__rr __name__r r r r  s    __pycache__/hardware.cpython-39.pyc000064400000001737151103301520013201 0ustar00a f8hI@sRddlmZddlmZddlmZdZdgZd ddZddZed krNedS) )hardware) up2dateAuth) rpcServer refresh_listNcCsn|rddifSt}t}tdkr.tdz|jt |WntdddifYS0ddifS) Nrzno-ops for cachingzCalled refresh_hardwarez3ERROR: sending hardware database for System Profile z Error refreshing system hardwarezhardware list refreshed) rZHardwarerZ getServer argVerboseprintZ registrationZrefresh_hw_profilerZ getSystemId)Z cache_onlyZ hardwareListsr 8/usr/lib/python3.9/site-packages/rhn/actions/hardware.pyrs  cCsttdS)N)r rr r r r main(sr __main__)N) Zup2date_clientrrrrZ __rhnexport__rr __name__r r r r  s    __pycache__/reboot.cpython-39.opt-1.pyc000064400000002340151103301520013624 0ustar00a f8hN@s^ddlZdgZddlmZddlmZeZeZdZ d ddZ ddZ e d krZe dS) Nreboot) up2dateLog)configcCs|rddifStdr ddifSt}ddi}dtd d }|sz4|rftd d d d d|gntd d d d|gWn$tyd|d<dd|fYS0tddd|fS)Nrzno-ops for cachingZnoReboot&z*Up2date is configured not to allow rebootsversion0zReboot of system "z'" initiated by Spacewalk reboot action.z/sbin/shutdownz-rz-kz+3zreboot.reboot.shutdown_failedname"z Could not execute /sbin/shutdownzRebooting the system nowzReboot sucessfully started)cfgosforkunameexecvpOSErrorlogZlog_me)testZ cache_onlypiddataZreboot_messager6/usr/lib/python3.9/site-packages/rhn/actions/reboot.pyrs"    cCsttdddS)Nr )r)printrrrrrmain1sr__main__)NN) r Z __rhnexport__Zup2date_clientrrZinitUp2dateConfigr ZinitLogrZACTION_VERSIONrr__name__rrrr s   __pycache__/reboot.cpython-39.pyc000064400000002340151103301520012665 0ustar00a f8hN@s^ddlZdgZddlmZddlmZeZeZdZ d ddZ ddZ e d krZe dS) Nreboot) up2dateLog)configcCs|rddifStdr ddifSt}ddi}dtd d }|sz4|rftd d d d d|gntd d d d|gWn$tyd|d<dd|fYS0tddd|fS)Nrzno-ops for cachingZnoReboot&z*Up2date is configured not to allow rebootsversion0zReboot of system "z'" initiated by Spacewalk reboot action.z/sbin/shutdownz-rz-kz+3zreboot.reboot.shutdown_failedname"z Could not execute /sbin/shutdownzRebooting the system nowzReboot sucessfully started)cfgosforkunameexecvpOSErrorlogZlog_me)testZ cache_onlypiddataZreboot_messager6/usr/lib/python3.9/site-packages/rhn/actions/reboot.pyrs"    cCsttdddS)Nr )r)printrrrrrmain1sr__main__)NN) r Z __rhnexport__Zup2date_clientrrZinitUp2dateConfigr ZinitLogrZACTION_VERSIONrr__name__rrrr s   __pycache__/rhnsd.cpython-39.opt-1.pyc000064400000002441151103301520013452 0ustar00a f8hS@srddlZdgZd ddZdddZedkrneedeedd eed d d eed d eed dS)N configurec Csd}t|d}|}d}d}g}|D]:}|} || | dd} | ddkrX|}|d}q&|dkrvd|||<|t|d}d |} || |dS) Nz/etc/sysconfig/rhn/rhnsdrr=ZINTERVALz INTERVAL=%sw )open readlinesstripappendsplitclosejoinwrite) interval cache_onlyZ rhnsdconfigfdlinescountindexZtmplineslinetmpcompscontentsr5/usr/lib/python3.9/site-packages/rhn/actions/rhnsd.py __configRhnsds(         rcCsd|rddifSd}|rDzt|d}WntyBddifYS0|rZtd}|d}d|ifS) Nrzno-ops for cachingzrhnsd interval config updated. %z)Could not modify /etc/sysconfig/rhn/rhnsdz'/sbin/service rhnsd restart > /dev/nullzrhnsd restarted)rIOErrorossystem)rrestartrmsgrcrrrr(s   __main__Z240Z361rZ127)r"Z192)N)NNN)r Z __rhnexport__rr__name__printrrrrs   __pycache__/rhnsd.cpython-39.pyc000064400000002441151103301520012513 0ustar00a f8hS@srddlZdgZd ddZdddZedkrneedeedd eed d d eed d eed dS)N configurec Csd}t|d}|}d}d}g}|D]:}|} || | dd} | ddkrX|}|d}q&|dkrvd|||<|t|d}d |} || |dS) Nz/etc/sysconfig/rhn/rhnsdrr=ZINTERVALz INTERVAL=%sw )open readlinesstripappendsplitclosejoinwrite) interval cache_onlyZ rhnsdconfigfdlinescountindexZtmplineslinetmpcompscontentsr5/usr/lib/python3.9/site-packages/rhn/actions/rhnsd.py __configRhnsds(         rcCsd|rddifSd}|rDzt|d}WntyBddifYS0|rZtd}|d}d|ifS) Nrzno-ops for cachingzrhnsd interval config updated. %z)Could not modify /etc/sysconfig/rhn/rhnsdz'/sbin/service rhnsd restart > /dev/nullzrhnsd restarted)rIOErrorossystem)rrestartrmsgrcrrrr(s   __main__Z240Z361rZ127)r"Z192)N)NNN)r Z __rhnexport__rr__name__printrrrrs   __pycache__/systemid.cpython-39.opt-1.pyc000064400000001225151103301520014174 0ustar00a f8h@sddlZdgZdddZdS)NdisablecCsJ|rddifSd}t|d}|dtt|f|ddifS)z5We have been told that we should disable the systemidrzno-ops for cachingz/etc/sysconfig/rhn/disablewz4Disable lock created on %s. RHN Server Message: %s z*systemId disable lock file has been writen)openwritetimectimeclose)Z messageTextZ cache_onlyZdisableFilePathfdr 8/usr/lib/python3.9/site-packages/rhn/actions/systemid.pyrs  )N)rZ __rhnexport__rr r r r s__pycache__/systemid.cpython-39.pyc000064400000001225151103301520013235 0ustar00a f8h@sddlZdgZdddZdS)NdisablecCsJ|rddifSd}t|d}|dtt|f|ddifS)z5We have been told that we should disable the systemidrzno-ops for cachingz/etc/sysconfig/rhn/disablewz4Disable lock created on %s. RHN Server Message: %s z*systemId disable lock file has been writen)openwritetimectimeclose)Z messageTextZ cache_onlyZdisableFilePathfdr 8/usr/lib/python3.9/site-packages/rhn/actions/systemid.pyrs  )N)rZ __rhnexport__rr r r r s__pycache__/up2date_config.cpython-39.opt-1.pyc000064400000003240151103301520015223 0ustar00a f8h@s^ddlZddlZddlmZeZddgZdZd ddZd ddZ ddZ e d krZe dS) N)configupdategetcCs|rddifStdkrtdt|tikr8ddifSg}tdrNtd}ng}|D]}||vrhqZt|||qZt|r|StddifS) z9Invoke this to change the ondisk configuration of up2daterno-ops for cachingzcalled update_up2date_config z$Invalid arguments passed to functionZdisallowConfChangeszconfig updated) argVerboseprinttypecfgkeyssetlenZsave)Z configdict cache_onlyZ unknownparamsZ skipParamsZparamr>/usr/lib/python3.9/site-packages/rhn/actions/up2date_config.pyrs$    cCsJ|rddifStdkrtdi}tD]}t|||<q*ddd|ifS)z.Reterieve the current configuration of up2daterrrzcalled get_up2date_configzconfiguration retriveddata)rr r r )rretkrrrr3s  cCsjt}|dd}ddl}|}||d<t|ddl}|t|d|d<d|d<|t|dS) NrrZ timeStampTestz)https://xmlrpc.cln.cloudlinux.com/XMLRPC/Z serverURLz.https://ipv6.xmlrpc.cln.cloudlinux.com/XMLRPC/Z serverURLipv6)rtimer pprintr)Z configdatatupZ configdatarZ timestamprrrrmain@s r__main__)N)N) osreZup2date_clientrZinitUp2dateConfigr Z __rhnexport__rrrr__name__rrrrs   __pycache__/up2date_config.cpython-39.pyc000064400000003240151103301520014264 0ustar00a f8h@s^ddlZddlZddlmZeZddgZdZd ddZd ddZ ddZ e d krZe dS) N)configupdategetcCs|rddifStdkrtdt|tikr8ddifSg}tdrNtd}ng}|D]}||vrhqZt|||qZt|r|StddifS) z9Invoke this to change the ondisk configuration of up2daterno-ops for cachingzcalled update_up2date_config z$Invalid arguments passed to functionZdisallowConfChangeszconfig updated) argVerboseprinttypecfgkeyssetlenZsave)Z configdict cache_onlyZ unknownparamsZ skipParamsZparamr>/usr/lib/python3.9/site-packages/rhn/actions/up2date_config.pyrs$    cCsJ|rddifStdkrtdi}tD]}t|||<q*ddd|ifS)z.Reterieve the current configuration of up2daterrrzcalled get_up2date_configzconfiguration retriveddata)rr r r )rretkrrrr3s  cCsjt}|dd}ddl}|}||d<t|ddl}|t|d|d<d|d<|t|dS) NrrZ timeStampTestz)https://xmlrpc.cln.cloudlinux.com/XMLRPC/Z serverURLz.https://ipv6.xmlrpc.cln.cloudlinux.com/XMLRPC/Z serverURLipv6)rtimer pprintr)Z configdatatupZ configdatarZ timestamprrrrmain@s r__main__)N)N) osreZup2date_clientrZinitUp2dateConfigr Z __rhnexport__rrrr__name__rrrrs   errata.py000064400000004625151103301520006372 0ustar00# # Client code for Update Agent # Copyright (c) 1999--2016 Red Hat, Inc. Distributed under GPLv2. # # Author: Adrian Likins 4: # Newer sats send down arch, filter using name+arch for p in packagelist: if "%s%s" % (p[0], p[4]) in current_packages_with_arch: u[p[0] + p[4]] = p elif "%snoarch" % p[0] in current_packages_with_arch: u[p[0] + p[4]] = p elif p[4] == "noarch" and p[0] in current_packages: u[p[0]] = p else: # 5.2 and older sats + hosted dont send arch for p in packagelist: if p[0] in current_packages: u[p[0]] = p # XXX: Fix me - once we keep all errata packages around, # this is the WRONG thing to do - we want to keep the specific versions # that the user has asked for. packagelist = list(u.values()) if packagelist == []: data = {} data['version'] = "0" data['name'] = "errata.update.no_packages" data['erratas'] = errataidlist return (39, "No packages from that errata are available", data) return packages.update(packagelist, cache_only) def main(): print(update([23423423])) if __name__ == "__main__": main() packages.py000064400000027030151103301520006665 0ustar00# # Copyright (c) 2015--2017 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 # along with this software; if not, see # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. # # Red Hat trademarks are not licensed under GPLv2. No permission is # granted to use or replicate Red Hat trademarks that are incorporated # in this software or its documentation. # import os import time import dnf.exceptions import dnf.cli from up2date_client import up2dateLog from up2date_client import config from up2date_client import rpmUtils from up2date_client import rhnPackageInfo log = up2dateLog.initLog() # file used to keep track of the next time rhn_check # is allowed to update the package list on the server LAST_UPDATE_FILE = "/var/lib/up2date/dbtimestamp" # mark this module as acceptable __rhnexport__ = [ 'update', 'remove', 'refresh_list', 'fullUpdate', 'checkNeedUpdate', 'runTransaction', 'verify' ] def remove(package_list, cache_only=None): """We have been told that we should remove packages""" if cache_only: return (0, "no-ops for caching", {}) if not isinstance(package_list, list): return (13, "Invalid arguments passed to function", {}) log.log_debug("Called remove_packages", package_list) # initialize dnf base = _dnf_base(load_system_repo=True, load_available_repos=False) installed = base.sack.query().installed() to_remove = [_package_tup2obj(installed, tup) for tup in package_list] return _dnf_transaction(base, remove=to_remove, allow_erasing=True, cache_only=cache_only) def update(package_list, cache_only=None): """We have been told that we should retrieve/install packages""" if not isinstance(package_list, list): return (13, "Invalid arguments passed to function", {}) log.log_debug("Called update", package_list) # initialize dnf base = _dnf_base(load_system_repo=True, load_available_repos=True) installed = base.sack.query().installed() available = base.sack.query().available() # skip already installed packages err = None errmsgs = [] to_install = [] for package in package_list: if len(package) < 5: package.append('') (name, version, release, epoch, arch) = package if version == '' and release == '' \ and epoch == '' and arch == '' \ and installed.filter(name=name): log.log_debug('Package %s is already installed' % name) continue if epoch == '': epoch = 0 pkgs = installed.filter(name=name, arch=arch).latest() requested_pkg = _package_tup2obj(available, package) if not requested_pkg: err = 'Package %s is not available for installation' \ % _package_tup2str(package) log.log_me('E: ', err) errmsgs.append(err) continue for pkg in pkgs: pkg_cmp = pkg.evr_cmp(requested_pkg) if pkg_cmp == 0: log.log_debug('Package %s already installed' % _package_tup2str(package)) break elif pkg_cmp > 0: log.log_debug('More recent version of package %s is already installed' % _package_tup2str(package)) break else: to_install.append(requested_pkg) # Don't proceed further with empty list, # since this would result into an empty yum transaction if not to_install: if err: ret = (32, "Failed: Packages failed to install properly:\n" + '\n'.join(errmsgs), {'version': '1', 'name': "package_install_failure"}) else: ret = (0, "Requested packages already installed", {}) # workaround for RhBug:1218071 base._plugins._unload() base.close() return ret return _dnf_transaction(base, install=to_install, cache_only=cache_only) def runTransaction(transaction_data, cache_only=None): """ Run a transaction on a group of packages. This was historicaly meant as generic call, but is only called for rollback. """ if cache_only: return (0, "no-ops for caching", {}) # initialize dnf base = _dnf_base(load_system_repo=True, load_available_repos=True) installed = base.sack.query().installed() available = base.sack.query().available() to_install = [] to_remove = [] for package_object in transaction_data['packages'][:]: [package, action] = package_object pkg = _package_tup2obj(installed, package) if action == 'e' and pkg: to_remove.append(pkg) elif action == 'i' and not pkg: new = _package_tup2obj(available, package) to_install.append(new) # Don't proceed further with empty package lists if not to_install and not to_remove: return (0, "Requested package actions have already been performed.", {}) return _dnf_transaction(base, install=to_install, remove=to_remove, allow_erasing=True, cache_only=cache_only) def fullUpdate(force=0, cache_only=None): """ Update all packages on the system. """ base = _dnf_base(load_system_repo=True, load_available_repos=True) return _dnf_transaction(base, full_update=True, cache_only=cache_only) # The following functions are the same as the old up2date ones. def checkNeedUpdate(rhnsd=None, cache_only=None): """ Check if the locally installed package list changed, if needed the list is updated on the server In case of error avoid pushing data to stay safe """ if cache_only: return (0, "no-ops for caching", {}) data = {} dbpath = "/var/lib/rpm" cfg = config.initUp2dateConfig() if cfg['dbpath']: dbpath = cfg['dbpath'] RPM_PACKAGE_FILE = "%s/Packages" % dbpath try: dbtime = os.stat(RPM_PACKAGE_FILE)[8] # 8 is st_mtime except: return (0, "unable to stat the rpm database", data) try: last = os.stat(LAST_UPDATE_FILE)[8] except: last = 0 # Never update the package list more than once every 1/2 hour if last >= (dbtime - 10): return (0, "rpm database not modified since last update (or package " "list recently updated)", data) if last == 0: try: file = open(LAST_UPDATE_FILE, "w+") file.close() except: return (0, "unable to open the timestamp file", data) # call the refresh_list action with a argument so we know it's # from rhnsd return refresh_list(rhnsd=1) def refresh_list(rhnsd=None, cache_only=None): """ push again the list of rpm packages to the server """ if cache_only: return (0, "no-ops for caching", {}) log.log_debug("Called refresh_rpmlist") ret = None try: rhnPackageInfo.updatePackageProfile() except: print("ERROR: refreshing remote package list for System Profile") return (20, "Error refreshing package list", {}) touch_time_stamp() return (0, "rpmlist refreshed", {}) def touch_time_stamp(): try: file_d = open(LAST_UPDATE_FILE, "w+") file_d.close() except: return (0, "unable to open the timestamp file", {}) # Never update the package list more than once every hour. t = time.time() try: os.utime(LAST_UPDATE_FILE, (t, t)) except: return (0, "unable to set the time stamp on the time stamp file %s" % LAST_UPDATE_FILE, {}) def verify(packages, cache_only=None): log.log_debug("Called packages.verify") if cache_only: return (0, "no-ops for caching", {}) data = {} data['name'] = "packages.verify" data['version'] = 0 ret, missing_packages = rpmUtils.verifyPackages(packages) data['verify_info'] = ret if len(missing_packages): data['name'] = "packages.verify.missing_packages" data['version'] = 0 data['missing_packages'] = missing_packages return(43, "packages requested to be verified are missing", data) return (0, "packages verified", data) def _dnf_base(load_system_repo=True, load_available_repos=True): # initialize dnf base = dnf.Base() if not base._plugins.plugins: base.init_plugins() if load_available_repos: base.read_all_repos() base.fill_sack(load_system_repo=True, load_available_repos=True) return base def _dnf_transaction(base, install=[], remove=[], full_update=False, allow_erasing=False, cache_only=None): """ command is an function excpecting dnf.Base() as an argument """ try: if full_update: base.upgrade_all() else: for pkg in install: if pkg: base.package_install(pkg) for pkg in remove: if pkg: base.package_remove(pkg) base.resolve(allow_erasing) log.log_debug("Dependencies Resolved") if not len(base.transaction): raise dnf.exceptions.Error('empty transaction') if base.transaction.install_set: log.log_debug("Downloading and installing: ", [str(p) for p in base.transaction.install_set]) base.download_packages(base.transaction.install_set) if base.transaction.remove_set: log.log_debug("Removing: ", [str(p) for p in base.transaction.remove_set]) if not cache_only: base.do_transaction() except dnf.exceptions.MarkingError as e: data = {} data['version'] = "1" data['name'] = "package_install_failure" return (32, "Failed: Packages failed to install " "properly: %s" % str(e), data) except dnf.exceptions.MarkingError as e: data = {} data['version'] = 0 data['name'] = "rpmremoveerrors" return (15, "%s" % str(e), data) except dnf.exceptions.DepsolveError as e: data = {} data["version"] = "1" data["name"] = "failed_deps" return (18, "Failed: packages requested raised " "dependency problems: %s" % str(e), data) except dnf.exceptions.Error as e: status = 6, message = "Error while executing packages action: %s" % str(e) data = {} return (status, message, data) finally: # workaround for RhBug:1218071 base._plugins._unload() base.close() return (0, "Update Succeeded", {}) def _package_tup2obj(q, tup): (name, version, release, epoch) = tup[:4] arch = tup[4] if len(tup) > 4 else None query = {'name': name} if version is not None and len(version) > 0: query['version'] = version if release is not None and len(release) > 0: query['release'] = release if epoch is not None and len(epoch) > 0: query['epoch'] = int(epoch) if arch is not None and len(arch) > 0: query['arch'] = arch pkgs = q.filter(**query).run() if pkgs: return pkgs[0] return None def _package_tup2str(package_tup): """ Create a package name from an rhn package tuple. """ n, v, r, e, a = package_tup[:] if not e: e = '0' pkginfo = '%s-%s:%s-%s' % (n, e, v, r) if a: pkginfo += '.%s' % (a) return (pkginfo,) __init__.py000075500000000023151103301520006642 0ustar00#!/usr/bin/python3 hardware.py000075500000002111151103301520006700 0ustar00#!/usr/bin/python3 # Copyright (c) 1999--2018 Red Hat, Inc. Distributed under GPLv2. # # Author: Adrian Likins # imports are a bit weird here to avoid name collions on "harware" from up2date_client import hardware from up2date_client import up2dateAuth from up2date_client import rpcServer argVerbose = 0 __rhnexport__ = [ 'refresh_list' ] # resync hardware information with the server profile def refresh_list(cache_only=None): if cache_only: return (0, "no-ops for caching", {}) # read all hardware in hardwareList = hardware.Hardware() s = rpcServer.getServer() if argVerbose > 1: print("Called refresh_hardware") try: s.registration.refresh_hw_profile(up2dateAuth.getSystemId(), hardwareList) except: print("ERROR: sending hardware database for System Profile") return (12, "Error refreshing system hardware", {}) return (0, "hardware list refreshed", {}) def main(): print(refresh_list()) if __name__ == "__main__": main() reboot.py000075500000002516151103301520006406 0ustar00#!/usr/bin/python3 # Client code for Update Agent # Copyright (c) 1999--2018 Red Hat, Inc. Distributed under GPLv2. # # Author: Adrian Likins # import os # mark this module as acceptable __rhnexport__ = [ 'configure', ] def __configRhnsd(interval, cache_only=None): rhnsdconfig = "/etc/sysconfig/rhn/rhnsd" fd = open(rhnsdconfig, "r") lines = fd.readlines() count = 0 index = None tmplines = [] for line in lines: tmp = line.strip() tmplines.append(tmp) comps = tmp.split("=", 1) if comps[0] == "INTERVAL": index = count count = count + 1 if index != None: tmplines[index] = "INTERVAL=%s" % interval fd.close() fd = open(rhnsdconfig, "w") contents = "\n".join(tmplines) fd.write(contents) fd.close() def configure(interval=None, restart=None, cache_only=None): if cache_only: return (0, "no-ops for caching", {}) msg = "" if interval: try: __configRhnsd(interval) msg = "rhnsd interval config updated. " except IOError: # i'm runing as root, must of been chattr'ed. # i'll resist the erge to unchattr this file return (37,"Could not modify /etc/sysconfig/rhn/rhnsd", {}) if restart: rc = os.system("/sbin/service rhnsd restart > /dev/null") msg = msg + "rhnsd restarted" return(0, msg, {}) if __name__ == "__main__": print(configure("240")) print(configure("361", 1)) print(configure("127", restart=1)) print(configure(restart=1)) print(configure("192")) systemid.py000075500000001345151103301520006754 0ustar00#!/usr/bin/python3 # # Copyright (c) 1999--2018 Red Hat, Inc. Distributed under GPLv2. # # Author: Adrian Likins import time # mark this module as acceptable __rhnexport__ = [ 'disable', ] def disable(messageText, cache_only=None): """We have been told that we should disable the systemid""" if cache_only: return (0, "no-ops for caching", {}) disableFilePath = "/etc/sysconfig/rhn/disable" # open and shut off fd = open(disableFilePath, "w") fd.write("Disable lock created on %s. RHN Server Message:\n\n%s\n" % ( time.ctime(time.time()), messageText)) fd.close() # done if we survived this long return(0, "systemId disable lock file has been writen", {}) up2date_config.py000075500000003657151103301520010014 0ustar00#!/usr/bin/python3 # Copyright (c) 1999--2018 Red Hat, Inc. Distributed under GPLv2. # # Author: Adrian Likins # import os import re from up2date_client import config cfg = config.initUp2dateConfig() __rhnexport__ = ["update", "get"] argVerbose = 0 def update(configdict, cache_only=None): """Invoke this to change the ondisk configuration of up2date""" if cache_only: return (0, "no-ops for caching", {}) if argVerbose > 1: print("called update_up2date_config") if type(configdict) != type({}): return (13, "Invalid arguments passed to function", {}) unknownparams = [] if cfg["disallowConfChanges"]: skipParams = cfg["disallowConfChanges"] else: skipParams = [] for param in configdict.keys(): # dont touch params in the skip params list if param in skipParams: continue # write out all params, even ones we dont know about # could be useful cfg.set(param, configdict[param]) if len(unknownparams): return unknownparams cfg.save() return (0, "config updated", {}) def get(cache_only=None): """Reterieve the current configuration of up2date""" if cache_only: return (0, "no-ops for caching", {}) if argVerbose > 1: print("called get_up2date_config") ret = {} for k in cfg.keys(): ret[k] = cfg[k] return (0, "configuration retrived", {"data": ret}) def main(): configdatatup = get() configdata = configdatatup[2]["data"] import time timestamp = time.time() configdata["timeStampTest"] = timestamp print(configdata) import pprint pprint.pprint(update(configdata)) configdata["serverURL"] = "https://xmlrpc.cln.cloudlinux.com/XMLRPC/" configdata["serverURLipv6"] = "https://ipv6.xmlrpc.cln.cloudlinux.com/XMLRPC/" pprint.pprint(update(configdata)) if __name__ == "__main__": main()