/usr/lib/python3/dist-packages/uaclient/__pycache__
NameSizeModeActions
actions.cpython-310.pyc113810644editdlrm
apt.cpython-310.pyc283670644editdlrm
apt_news.cpython-310.pyc73460644editdlrm
config.cpython-310.pyc137600644editdlrm
contract.cpython-310.pyc248990644editdlrm
contract_data_types.cpython-310.pyc80680644editdlrm
data_types.cpython-310.pyc147880644editdlrm
defaults.cpython-310.pyc29130644editdlrm
event_logger.cpython-310.pyc78400644editdlrm
exceptions.cpython-310.pyc250390644editdlrm
gpg.cpython-310.pyc10250644editdlrm
livepatch.cpython-310.pyc106950644editdlrm
lock.cpython-310.pyc46350644editdlrm
log.cpython-310.pyc46330644editdlrm
secret_manager.cpython-310.pyc12560644editdlrm
security_status.cpython-310.pyc165980644editdlrm
snap.cpython-310.pyc64710644editdlrm
status.cpython-310.pyc183610644editdlrm
system.cpython-310.pyc227620644editdlrm
types.cpython-310.pyc4720644editdlrm
update_contract_info.cpython-310.pyc13320644editdlrm
upgrade_lts_contract.cpython-310.pyc29920644editdlrm
util.cpython-310.pyc135250644editdlrm
version.cpython-310.pyc24990644editdlrm
yaml.cpython-310.pyc11780644editdlrm
__init__.cpython-310.pyc1440644editdlrm
Edit: /usr/lib/python3/dist-packages/uaclient/__pycache__/livepatch.cpython-310.pyc (10695B)
o Kih3 @sVddlZddlZddlZddlZddlZddlmZddlmZm Z m Z ddl m Z m Z mZmZmZddlmZmZmZmZmZmZddlmZddlmZdZd Zd Zd Ze Z!e"e#e$Z%ej&Gd d d ej'Z(GdddeZ)GdddeZ*GdddeZ+GdddeZ,de e+fddZ-de e.de e(fddZ/Gdddej0Z1de e(fddZ2d e.d!e.d"e.d#e.de e3e e3ff d$d%Z4d e.d!e.d"e.d#e.d&e ejde e(f d'd(Z5edd)de(fd*d+Z6 d9d,e.d-e ee7ddfd.d/Z8   d:d0e e.d1e e.d-e ee7ddfd2d3Z9d4e.de e.fd5d6Z:de3fd7d8Z;dS);N) lru_cache)ListOptionalTuple) event_logger exceptionsmessagessystemutil) BoolDataValue DataObjectFieldIncorrectTypeErrorStringDataValue data_list) state_files) serviceclientz http-proxyz https-proxyz/snap/bin/canonical-livepatchz/v1/api/kernels/supportedc@s*eZdZeZeZeZeZeZdS)LivepatchSupportN) __name__ __module__ __qualname__object SUPPORTEDKERNEL_UPGRADE_REQUIRED KERNEL_EOL UNSUPPORTEDUNKNOWNrr4/usr/lib/python3/dist-packages/uaclient/livepatch.pyr s  rc@sFeZdZededddededddgZdeedee fddZ d S) LivepatchPatchFixStatusnameFNamerequireddict_keypatchedPatchedcCs||_||_dSN)r r%)selfr r%rrr__init__/s z LivepatchPatchFixStatus.__init__N) rrrr rr fieldsrstrboolr)rrrrr)src@sdeZdZededddedeedddededddgZdee dee edee fd d Z d S) LivepatchPatchStatusstateFStater"fixesFixesversionVersioncC||_||_||_dSr')r.r0r2)r(r.r0r2rrrr)D zLivepatchPatchStatus.__init__N) rrrr rrrr*rr+rr)rrrrr-8s"  r-c@s\eZdZededddededddededddgZdeedeedeefd d Z d S) LivepatchStatusStatuskernelFKernelr" livepatch Livepatch supported SupportedcCr4r')r7r9r;)r(r7r9r;rrrr)`r5zLivepatchStatusStatus.__init__N) rrrr rr-r*rr+r)rrrrr6Os,r6c@s8eZdZedeedddgZdeeefddZ dS)LivepatchStatusstatusFStatusr"cCs ||_dSr')r>)r(r>rrrr)us zLivepatchStatus.__init__N) rrrr rr6r*rrr)rrrrr=ks r=returnc Cs*ts tddSzttddddg\}}Wn(tjy@}zd|jvr3t |jWYd}~dStj d|d|d}~wwzt |}Wnt j yd}ztj d ||dWYd}~dSd}~wwzt |}Wnty|t d |YdSw|jdust|jd krtd dS|jd S)Nz$canonical-livepatch is not installedr>z --verbosez--formatjsonzMachine is not enabledz;canonical-livepatch returned error when checking status: %s)exc_infozPJSONDecodeError while parsing livepatch status, returning None. output was: "%s"zlen)out_e status_json status_rootrrrr>|sT          r> status_strcCsJ|dkrtjS|dkrtjS|dkrtjS|dkrtjS|dkr#tjSdS)Nr;zkernel-upgrade-requiredzkernel-end-of-life unsupportedunknown)rrrrrr)rUrrr(_convert_str_to_livepatch_support_statussrXc @s<eZdZdZdededededeejdeef dd Zd S) UALivepatchClient livepatch_urlr2flavorarchcodename build_dater@c Cs|||||dur |ndd}|}z |jt||d}Wnty;} ztdt| WYd} ~ dSd} ~ ww|jdkrNtdt|jdS|j d} | dus]t | t re| rbt jSt jSt| S)NrW)zkernel-versionflavour architecturer]z build-date) query_paramsheadersz4error while checking livepatch supported kernels APIz0livepatch supported kernels API was unsuccessfulr<) isoformatrb request_url"LIVEPATCH_API_V1_KERNELS_SUPPORTED ExceptionrErKcodebody json_dictget isinstancer,rrrrX) r(r2r[r\r]r^rarbresponserRapi_supported_valrrris_kernel_supporteds:         z%UALivepatchClient.is_kernel_supportedN) rrrcfg_url_base_attrr+rdatetimerrorrrrrYsrYcCs8zt}Wn tjyYdSw|durdSt|jSr')r>rrIrXr;) lp_statusrrr_on_supported_kernel_clis  rsr2r[r\r]cCsztj}Wn tyd}Ynw|durLtjtjjtjdd}t |j |k|j |k|j |k|j |k|j|kgrL|jdurGtdd|jfSdS)zOCheck local cache of kernel support :return: (is_cache_valid, result) N)daysz-livepatch kernel support cache has None valueT)FN)rlivepatch_support_cachereadrgrqnowtimezoneutc timedeltaall cached_atr2r[r\r]r;rErK)r2r[r\r] cache_data one_week_agorrr_on_supported_kernel_caches.    rr^c Csxtj|||||d}d}|tjkrd}n|tjkrd}tjtj|||||t j t j j d|dur:t d|S)N)r2r[r\r]r^TF)r2r[r\r]r;r}z3livepatch kernel support API response was ambiguous)rYrorrrrrvwriteLivepatchSupportCacheDatarqrxryrzrErK)r2r[r\r]r^r;cache_supportedrrr_on_supported_kernel_apis2   r)maxsizecCst}|durtd|St}|jdus!|jdus!|jdur)tdt j St |j }tj}dj|j|jd}t||j||\}}|r_td|durUt j S|rZt jS|s_t jStdt||j|||j}|durut j S|S)z Checks CLI, local cache, and API in that order for kernel support If all checks fail to return an authoritative answer, we return None Nzusing livepatch cli for supportzHunable to determine enough kernel information to check livepatch supportz{major}.{minor})majorminorzusing livepatch support cachezusing livepatch support api)rsrErFr get_kernel_infor[rrrKrrr standardize_arch_nameuname_machine_archget_release_infoseriesformatrrrrr^)cli_says kernel_infor\r]lp_api_kernel_veris_cache_valid cache_saysapi_saysrrron_supported_kernel:sN         r protocol_type retry_sleepscCs(tsdStjtdd|g|ddS)a Unset livepatch configuration settings for http and https proxies. :param protocol_type: String either http or https :param retry_sleeps: Optional list of sleep lengths to apply between retries. Specifying a list of [0.5, 1] tells subp to retry twice on failure; sleeping half a second before the first retry and 1 second before the second retry. Nconfigz {}-proxy=r)rDr rGrHr)rrrrrunconfigure_livepatch_proxyvs   r http_proxy https_proxycCsnddlm}|s |rttjj|jd|r$tj t dd|g|d|r5tj t dd|g|ddSdS) a Configure livepatch to use http and https proxies. :param http_proxy: http proxy to be used by livepatch. If None, it will not be configured :param https_proxy: https proxy to be used by livepatch. If None, it will not be configured :@param retry_sleeps: Optional list of sleep lengths to apply between snap calls r)LivepatchEntitlement)servicerz http-proxy={}rzhttps-proxy={}N) uaclient.entitlementsreventinforSETTING_SERVICE_PROXYrtitler rGrH)rrrrrrrconfigure_livepatch_proxys$  rkeycCs\ttdg\}}td||tj}|r|dnd}|r&tdd|}|r,| SdS)z Gets the config value from livepatch. :param key: can be any valid livepatch config option :return: the value of the livepatch config option, or None if not set rz ^{}: (.*)$rCNz\"(.*)\"z\g<1>) r rGrHresearchr MULTILINEgroupsubstrip)rrPrQmatchvaluerrrget_config_option_values rcCsttduSr')r whichrHrrrrrDsrDr')NNN)r+rXUAServiceClientrYrsr,rrrfloatrrrrDrrrrs    0 /   %<    %