/usr/lib/fixperms/venv/lib/python3.13/site-packages/rads/__pycache__
NameSizeModeActions
color.cpython-313.pyc30620644editdlrm
semaphore.cpython-313.pyc65850644editdlrm
ssh.cpython-313.pyc63080644editdlrm
vz.cpython-313.pyc229000644editdlrm
_email.cpython-313.pyc42930644editdlrm
_fsquota.cpython-313.pyc99850644editdlrm
_globals.cpython-313.pyc28090644editdlrm
_input.cpython-313.pyc39900644editdlrm
_locking.cpython-313.pyc31200644editdlrm
_logging.cpython-313.pyc97910644editdlrm
_sa.cpython-313.pyc45670644editdlrm
_tickets.cpython-313.pyc22070644editdlrm
_users.cpython-313.pyc253820644editdlrm
_yaml.cpython-313.pyc29180644editdlrm
__init__.cpython-313.pyc37490644editdlrm
Edit: /usr/lib/fixperms/venv/lib/python3.13/site-packages/rads/__pycache__/vz.cpython-313.pyc (22900B)
giE JSrSSKrSSKrSSKrSSKrSSKJr SSKJr SSK J r SSK r "SS5r "SS \R5r"S S \5rS \4S jrS \4SjrS \4Sjr"SS\5rS \\\44SjrS\ S \R2\4SjrS\\-S \4SjrS\S \4SjrS\\-S \4SjrS\\-S \4SjrS\ S\ S-S\S-S \!\\ \44Sjr"S\S\ \S\ \S\ \S \\\44 S jr#SS\RH4S\ S-S\ S-S\S \ \\\44S!jjr%g)"zVZ / HA functionsN)Path) TypedDict)Iterablec\rSrSrSrS\4SjrSrS\R4Sjr S\R4Sjr S\R4S jr S\R4S jr S\R4S jrS\R4S jrS \S\R4SjrS\R4SjrS\S\R4SjrS\S\R4SjrS\S\R4SjrSS\SS4SjjrSrg)CT zCreate a CT object representing a VZ Container Args: ctid (str): container ID to collect information from. All vzctl/prlctl actions will interact with this container. Raises: VZError: if vzlist fails to run ctidc6[U5Ul/SQnSSSRU5UR/n[R"USSSS9n[R"UR5SnURS S5Ul URS S5UlURS S5UlURS S 5UlURSS 5UlURSS 5UlURSS5UlURS05UlURS05UlURSS 5UlURS/5UlURS/5UlURSS 5UlURSS 5UlURS05UlURS05UlURSS5UlURSS 5UlURS05UlURSS 5UlURSS 5Ul URS S 5Ul!URS!05Ul"URS"S#5Ul#URS$S 5Ul$URS%S 5Ul%g![R an[ UR5UeSnAf[an[ [U55UeSnAff=f)&Ncpulimitcpuscpuunitsr descriptiondevicedisabled diskinodes diskspacehostnameiplaveragename netfilter numiptentnumproconboot ostemplate physpagesprivaterootstatus swappagesuptimeuuidveidvzlistz-jo,Tutf-8capture_outputencodingcheckrr r rr rrrFrrrrrrrrrrrrrrr r!r"gr#r$)&strr join subprocessrunCalledProcessErrorVZErrorstderrOSErrorjsonloadsstdoutgetr r rrrrrrrrrrrrrrrrrrr r!r"r#r$)selfr optscommandresultexcdatas >/usr/lib/fixperms/venv/lib/python3.13/site-packages/rads/vz.py__init__ CT.__init__sI  <UCHHTNDII> -^^wdFZZ .q1!XXj!4 &!, !XXj!4 #xx3 $ ;88Hb1 "hhz59 $r :#xx R8!XXj"5 !XXdB/%)XXj"%= &"- "hh{B7#xx R8!XXi4  HHXu5 #xx b9#xx R8 HHY3 &"- 88Hb1 #xx R8!XXh4 &"- &"- C,, 4SZZL* 3 -#c(# , -s#KLK11 L>LLcZ^SRU4SjTR55nSUS3$)Nz, c 3V># UHoS[[TU553v M g7f)=N)reprgetattr).0keyr9s r? CT.__repr__..es* ;HCe1T'$,-. /=s&)zCT())r.__dict__)r9attrss` r?__repr__ CT.__repr__ds2  ;?==  UG1~returncNSSUR/n[R"USSSS9$)zxStarts the container using 'vzctl start' Returns: subprocess.CompletedProcess: result of the 'vzctl start' command vzctlstartTr'Fr(r r/r0r9r;s r?rTCT.startj. GTYY/~~ D7%  rPcNSSUR/n[R"USSSS9$)zuStops the container using 'vzctl stop' Returns: subprocess.CompletedProcess: result of the 'vzctl stop' command rSstopTr'Fr(rUrVs r?rZCT.stopus. FDII.~~ D7%  rPcNSSUR/n[R"USSSS9$)z~Restarts the container using 'vzctl restart' Returns: subprocess.CompletedProcess: result of the 'vzctl restart' command rSrestartTr'Fr(rUrVs r?r] CT.restart. Ityy1~~ D7%  rPcNSSUR/n[R"USSSS9$)zMounts the container's filesystem using the 'vzctl mount' command Returns: subprocess.CompletedProcess: result of the 'vzctl mount' command rSmountTr'Fr(rUrVs r?raCT.mountrXrPcNSSUR/n[R"USSSS9$)zUnmounts the container's filesystem using the 'vzctl umount' command Returns: subprocess.CompletedProcess: result of the 'vzctl umount' command rSumountTr'Fr(rUrVs r?rd CT.umounts. Hdii0~~ D7%  rPcNSSUR/n[R"USSSS9$)zDestroys the container using the 'vzctl destroy' command Returns: subprocess.CompletedProcess: result of the 'vzctl destroy' command rSdestroyTr'Fr(rUrVs r?rg CT.destroyr_rPdstcNSSXR/n[R"USSSS9$)aRegisters the container at the specified destination using the 'vzctl register' command Args: dst (str): The destination path where the container is to be registered Returns: subprocess.CompletedProcess: result of the 'vzctl register' command rSregisterTr'Fr(rU)r9rir;s r?rk CT.registers.JYY7~~ D7%  rPcNSSUR/n[R"USSSS9$)zUnregisters the container using the 'vzctl unregister' command Returns: subprocess.CompletedProcess: result of the 'vzctl unregister' command rS unregisterTr'Fr(rUrVs r?rn CT.unregisters.L$))4~~ D7%  rPrcdSSURS[U5/n[R"USSSS9$)zClones the container with the specified name using the 'prlctl clone' Args: name (str): The name for the new cloned container Returns: subprocess.CompletedProcess: result of the 'prlctl clone' command prlctlclonez--nameTr'Fr()r r-r/r0)r9rr;s r?rrCT.clones6Wdii3t9E~~ D7%  rPcmdczSSUR/[R"U5Qn[R"USSSS9$)aYExecutes the specified command within the container using the 'vzctl exec2' command Args: cmd (str): The command to execute within the container. If args for the command come from user input, you may want to use shlex.join or shlex.quote on them Returns: subprocess.CompletedProcess: result of the 'vzctl exec2' command rSexec2Tr'Fr()r shlexsplitr/r0)r9rtr;s r?rvCT.exec2s<GTYYBS1AB~~ D7%  rPkwargsc /nUR5Hup4URSU3U/5 M URS5 SSUR/UQn[R "USSSS9nUR UR5 U$) aSets various configuration options for the container This method constructs a command to modify the container's configuration using the `vzctl set` command. It accepts keyword arguments where each key-value pair represents an option and its corresponding value to be set. The method appends "--save" to the command to save the changes permanently. After running the command, the method reinitializes the object to reflect the updated configuration. Args: **kwargs: Arbitrary keyword arguments representing configuration options and values. Returns: subprocess.CompletedProcess: The result of the `subprocess.run` call, containing information about the execution of the command z--z--saverSsetTr'Fr()itemsextendappendr r/r0r@)r9rzarg_listrHvaluer;r<s r?r|CT.sets$ ,,.JC OOr#ZE74 5)!E4998x8 D7%  dii  rPrTNcUR5 UR5 [SUR35n[SUR35nUR U5 [ U5UlSUR3UlUR=UlUl URUR5 U(aUR5 gg)a#A tool for offline fixing CTID fields of VZ7 containers. Re-registers the container while offline. This method stops the container, unregisters it, renames the container directory from the current CTID to the container name, updates the instance attributes accordingly, and re-registers the container with the new details. Optionally, it can restart the container if the `start` parameter is set to True. Args: start (bool): If True, the container will be restarted after the CTID fix is applied. Defaults to True Returns: None z /vz/private/z /vz/root/N) rZrnrr rrenamer-rrr$rkrT)r9rTsrcris r?fix_ctid CT.fix_ctids"  \$))-.\$))-. 33x  {+ $ ) DI dll#  JJL rPr )T)__name__ __module__ __qualname____firstlineno____doc__r-r@rNr/CompletedProcessrTrZr]rardrgrkrnrrrvr|boolr__static_attributes__rPr?rr sJ.SJ.X  z22    j11    44    z22    33    44    C  J$?$?    J77    #  *"="=    !s #g 6&kkm))+G7}}Ta MMOA   197 6  s? A<A+A< B + A95A<9A<< B B  BBc4\rSrSr%Sr\\S'\\\S'Sr g) VeInfoDictiPzValues used in the return type of rads.vz.veinfo(). procs is the number of processes in the container; ips is a list of ip addressesprocsipsrN) rrrrrr__annotations__rr-rrrPr?rrPsD J cNrPrc0n[SSS9nUH-nUR5tp4pVUS:XaM[U5US.X'M/ SSS5 U$!,(df  U$=f)aRead running containers from /proc/vz/veinfo. VMs are not listed. Returns: dict[str, VeInfoDict]: container IDs mapped to dicts. Each dict contains "procs" (the number of processes in the container) and "ips" (all ip addresses assigned to the container) rrr0)rrN)rrxr)retrliner _rrs r?veinforXsh C ' 2fD#'::< DUs{"%e*S9CI  3 J 3 2 Js 4A  Artc[R"USSSS9nUR(a[SU<SUR <35eU$![an[U5UeSnAff=f)zFor executing prlctl or vzlistTr'Fr(NzError running z . stderr=)r/r0FileNotFoundErrorr2 returncoder3)rtrr=s r?_execrmsf$nn we   ~~sgYszznEFF J $cl#$sA A$ AA$r c [R"SSSSS[U5/[R[RSSS9nUR R 5S S :H$![a O[Ra g f=f[S SSS[U5/5nO![a g f=fUR R 5S S :H$) zChecks if a container is running Args: ctid: container ID to check Returns: True if the container is running on this node, False if it isn't or if some other error occurs rrr-or r'T)r7r3r*r+rrunningFr) r/r0r-PIPEDEVNULLr7rxrr1rr2r rs r? is_ct_runningrzs 2nn dHc$i H??%%  zz!!$ 11    ( ('tXs4yIJ  ::   a I --s*AA%% B1BB B%% B21B2r#c^[SSSSSU/5nURR5S$)zget the legacy CTID of a container Args: uuid: VZ UUID to find the legacy CTID for Raises: VZError: if the prlctl command fails rrrrrr)rr7rx)r#rs r? uuid2ctidrs4 "FD$E FC ::   a  rPc [SSSSS[U5/5nURR5SR S5$)zObtain the UUID of a container from its legacy CTID Warning: This does not work on VZ4 Args: ctid: Legacy CTID to get the UUID for Raises: VZError: if the prlctl command fails rrrrr#rz{})rr-r7rxrrs r? ctid2uuidrsC "FD$D J KC ::   a & &u --rPc H[SSS9nSUR5;a[U5sSSS5 $SSS5 [ SSSS S [U5/5nUR R5S $!,(df  NE=f![an[ U5UeSnAff=f) alObtain the EnvID of a container Note: This determines what the subdirectory of /vz/root and /vz/private will be. This also has to run on VZ4 which lacks the envid field or prlctl, so we just return the CTID Args: ctid: legacy CTID to find the envid for Raises: VZError: if the prlctl command fails or /etc/virtuozzo-release is missing z/etc/virtuozzo-releaser'rzVirtuozzo release 4Nrrrrenvidr)rrr-rr2rr7rx)r rr=rs r? get_envidrs$ *W =$ 54y> =5> "FD$TK LC ::   a  > = $cl#$s8 BA5 BB5 B?BB B! BB!r:argslist_cmdcU[R:XaUVs0sH o3US:XaSOU_M nnOUVs0sH o3US:XaSOU_M nnURR5nUbUR U5 SR UVs/sHo4UPM sn5nUR SU/5 X%4$s snfs snfs snf)zDeterines the cmd to run based on VZ version for get_cts() Args: opts: items to send into ``-o/--output`` args: optional params to send such as ``--all`` list_cmd (ListCmd): set this to ListCmd.VZLIST to switch to that command rr$r rr&r)rrrcopyr~r.)r:rrx conv_optsrtcmd_optss r? _list_cmdrs7>>!AEFA1<Q6 F AEE11;A5 E ..   C  4xxt4t!1t45HJJh =GF 5sB2B7B<rowc [U5[U5:Xa#[U5VVs0sH upEXRU_M snn$U[R:Xak[U5[U5S- :XaPSU;aJUR 5nUR S5 [U5VVs0sH upEXRU_M nnnSUS'U$[ [R"U5S[U5S[U5SU35es snnfs snnf)Nr-z expected z columns, but got z: ) len enumeraterrrremover2rwr.)rrtrr:irrs r? _read_rowrs 3x3t9&/o6odaq6 o66 GNN" HD A % D yy{ L!%.t_5_TQqa&y_5L  ::c? :c$i[1H:Ru & 76s C7 C=c U(dS/n/nU(dAU[R:Xa-US/:Xa&[5HnURSU05 M U$[ XU5up%[ U5R R5HFnUR5nU(dMUR[X%UR5U55 MH U$)aiReturns containers according to platform as a list of dicts Args: opts: items to send into -o/--output (will default to ['ctid'] if None) args: optional params to send such as --all list_cmd (ListCmd): set this to ListCmd.VZLIST force using that command. Otherwise, we use prlctl. Raises: VZError: if the prlctl or vzlist command fails r ) rrrrrrr7 splitlinesrrrx)r:rrrr rtrs r?get_ctsrs x C H.4F83CHD JJ~ & d(3MHSz  ++-iik  9XCIIK>? . JrP)&renumr5rwr/pathlibrtypingrcollections.abcrrrEnumr Exceptionr2rrrrrdictr-rrrrrrrrrtuplerrrrrrPr?rs $ YYx/dii//i/.t. ;; $S*_%* x J77< .c .d.< !C !C ! .C#I .# .!C#I!#!. Tk-4t^ 7DI 0 I,0I=A#Y #s(^2 + + $sCx. rP