Your IP : 18.119.116.125


Current Path : /usr/lib/python3.6/site-packages/tuned/plugins/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/tuned/plugins/__pycache__/plugin_bootloader.cpython-36.pyc

3

�<�e:e�@s�ddlmZddlTddlZddlmZddlmZddlj	Z	ddl
Z
ddlZddlZddl
mZejj�ZGdd	�d	ej�ZdS)
�)�base)�*�N)�
exceptions)�commands)�sleepcs�eZdZdZ�fdd�Zdd�Zdd�Zedd	��Ze	d[dd��Z
e	d
d��Zdd�Zdd�Z
iifdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zejfd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Z d5d6�Z!d7d8�Z"d9d:�Z#d;d<�Z$d=d>�Z%d?d@�Z&e'dA�dBdC��Z(e'dD�dEdF��Z)e'dG�dHdI��Z*e'dJdKdLdM�dNdO��Z+e'dPdKdLdM�dQdR��Z,e'dSdKdLdM�dTdU��Z-e'dVdKdLdM�dWdX��Z.dYdZ�Z/�Z0S)\�BootloaderPlugina�
	`bootloader`::
	
	Adds options to the kernel command line. This plug-in supports the
	GRUB 2 boot loader and the Boot Loader Specification (BLS).
	+
	NOTE: *TuneD* will not remove or replace kernel command line
	parameters added via other methods like *grubby*. *TuneD* will manage
	the kernel command line parameters added via *TuneD*. Please refer
	to your platform bootloader documentation about how to identify and
	manage kernel command line parameters set outside of *TuneD*.
	+
	Customized non-standard location of the GRUB 2 configuration file
	can be specified by the [option]`grub2_cfg_file` option.
	+
	The kernel options are added to the current GRUB configuration and
	its templates. Reboot the system for the kernel option to take effect.
	+
	Switching to another profile or manually stopping the `tuned`
	service removes the additional options. If you shut down or reboot
	the system, the kernel options persist in the [filename]`grub.cfg`
	file and grub environment files.
	+
	The kernel options can be specified by the following syntax:
	+
	[subs="+quotes,+macros"]
	----
	cmdline__suffix__=__arg1__ __arg2__ ... __argN__
	----
	+
	Or with an alternative, but equivalent syntax:
	+
	[subs="+quotes,+macros"]
	----
	cmdline__suffix__=+__arg1__ __arg2__ ... __argN__
	----
	+
	Where __suffix__ can be arbitrary (even empty) alphanumeric
	string which should be unique across all loaded profiles. It is
	recommended to use the profile name as the __suffix__
	(for example, [option]`cmdline_my_profile`). If there are multiple
	[option]`cmdline` options with the same suffix, during the profile
	load/merge the value which was assigned previously will be used. This
	is the same behavior as any other plug-in options. The final kernel
	command line is constructed by concatenating all the resulting
	[option]`cmdline` options.
	+
	It is also possible to remove kernel options by the following syntax:
	+
	[subs="+quotes,+macros"]
	----
	cmdline__suffix__=-__arg1__ __arg2__ ... __argN__
	----
	+
	Such kernel options will not be concatenated and thus removed during
	the final kernel command line construction.
	+
	.Modifying the kernel command line
	====
	For example, to add the [option]`quiet` kernel option to a *TuneD*
	profile, include the following lines in the [filename]`tuned.conf`
	file:
	
	----
	[bootloader]
	cmdline_my_profile=+quiet
	----
	
	An example of a custom profile `my_profile` that adds the
	[option]`isolcpus=2` option to the kernel command line:
	
	----
	[bootloader]
	cmdline_my_profile=isolcpus=2
	----
	
	An example of a custom profile `my_profile` that removes the
	[option]`rhgb quiet` options from the kernel command line (if
	previously added by *TuneD*):
	
	----
	[bootloader]
	cmdline_my_profile=-rhgb quiet
	----
	====
	+
	.Modifying the kernel command line, example with inheritance
	====
	For example, to add the [option]`rhgb quiet` kernel options to a
	*TuneD* profile `profile_1`:
	
	----
	[bootloader]
	cmdline_profile_1=+rhgb quiet
	----
	
	In the child profile `profile_2` drop the [option]`quiet` option
	from the kernel command line:
	
	----
	[main]
	include=profile_1
	
	[bootloader]
	cmdline_profile_2=-quiet
	----
	
	The final kernel command line will be [option]`rhgb`. In case the same
	[option]`cmdline` suffix as in the `profile_1` is used:
	
	----
	[main]
	include=profile_1
	
	[bootloader]
	cmdline_profile_1=-quiet
	----
	
	It will result in the empty kernel command line because the merge
	executes and the [option]`cmdline_profile_1` gets redefined to just
	[option]`-quiet`. Thus there is nothing to remove in the final kernel
	command line processing.
	====
	+
	The [option]`initrd_add_img=IMAGE` adds an initrd overlay file
	`IMAGE`. If the `IMAGE` file name begins with '/', the absolute path is
	used. Otherwise, the current profile directory is used as the base
	directory for the `IMAGE`.
	+
	The [option]`initrd_add_dir=DIR` creates an initrd image from the
	directory `DIR` and adds the resulting image as an overlay.
	If the `DIR` directory name begins with '/', the absolute path
	is used. Otherwise, the current profile directory is used as the
	base directory for the `DIR`.
	+
	The [option]`initrd_dst_img=PATHNAME` sets the name and location of
	the resulting initrd image. Typically, it is not necessary to use this
	option. By default, the location of initrd images is `/boot` and the
	name of the image is taken as the basename of `IMAGE` or `DIR`. This can
	be overridden by setting [option]`initrd_dst_img`.
	+
	The [option]`initrd_remove_dir=VALUE` removes the source directory
	from which the initrd image was built if `VALUE` is true. Only 'y',
	'yes', 't', 'true' and '1' (case insensitive) are accepted as true
	values for this option. Other values are interpreted as false.
	+
	.Adding an overlay initrd image
	====
	----
	[bootloader]
	initrd_remove_dir=True
	initrd_add_dir=/tmp/tuned-initrd.img
	----
	
	This creates an initrd image from the `/tmp/tuned-initrd.img` directory
	and and then removes the `tuned-initrd.img` directory from `/tmp`.
	====
	+
	The [option]`skip_grub_config=VALUE` does not change grub
	configuration if `VALUE` is true. However, [option]`cmdline`
	options are still processed, and the result is used to verify the current
	cmdline. Only 'y', 'yes', 't', 'true' and '1' (case insensitive) are accepted
	as true values for this option. Other values are interpreted as false.
	+
	.Do not change grub configuration
	====
	----
	[bootloader]
	skip_grub_config=True
	cmdline=+systemd.cpu_affinity=1
	----
	====
	cs6tjjtj�stjd��tt|�j	||�t
�|_dS)Nz4Required GRUB2 template not found, disabling plugin.)�os�path�isfile�constsZGRUB2_TUNED_TEMPLATE_PATHrZNotSupportedPluginException�superr�__init__r�_cmd)�self�args�kwargs)�	__class__��'/usr/lib/python3.6/plugin_bootloader.pyr�s
zBootloaderPlugin.__init__cCsVd|_d|_d|_d|_d|_d|_d|_d|_|j�|_	|j
�|_|j�dk	|_
dS)NFT�)Z_has_dynamic_tuningZ_has_static_tuning�update_grub2_cfg�_skip_grub_config_val�_initrd_remove_dir�_initrd_dst_img_val�_cmdline_val�_initrd_val�_get_grub2_cfg_files�_grub2_cfg_file_names�_bls_enabled�_bls�_rpm_ostree_status�_rpm_ostree)r�instancerrr�_instance_init�s

zBootloaderPlugin._instance_initcCsdS)Nr)rr#rrr�_instance_cleanup�sz"BootloaderPlugin._instance_cleanupcCsdddddddd�S)N)�grub2_cfg_file�initrd_dst_img�initrd_add_img�initrd_add_dir�initrd_remove_dir�cmdline�skip_grub_configr)�clsrrr�_get_config_options�sz$BootloaderPlugin._get_config_optionsrcCs`i}|j�}xN|j�D]B}||kr|jdd�}|j|dg�jt|�dkrR|dnd�qW|S)z�
		Returns dict created from options
		e.g.: _options_to_dict("A=A A=B A B=A C=A", "A=B B=A B=B") returns {'A': ['A', None], 'C': ['A']}
		�=rrN)�split�
setdefault�append�len)�optionsZomit�d�oZarrrrr�_options_to_dict�s.z!BootloaderPlugin._options_to_dictcCsdjdd�|j�D��S)N� cSs2g|]*\}}|D]}|dk	r(|d|n|�qqS)Nr/r)�.0�k�vZv1rrr�
<listcomp>�sz5BootloaderPlugin._dict_to_options.<locals>.<listcomp>)�join�items)r5rrr�_dict_to_options�sz!BootloaderPlugin._dict_to_optionscCsr|jjddgdd�\}}}tjd||f�|dkr8dS|j�}t|�dksX|dd	krjtjd
|�dS|dS)zW
		Returns status of rpm-ostree transactions or None if not run on rpm-ostree system
		z
rpm-ostreeZstatusT)�
return_errz.rpm-ostree status output stdout:
%s
stderr:
%srN�zState:z2Exceptional format of rpm-ostree status result:
%sr)r�execute�log�debugr0r3�warn)r�rc�out�errZsplitedrrrr!�sz#BootloaderPlugin._rpm_ostree_statuscCsFd}d}x(t|�D]}|j�dkr&dSt|�qW|j�dkrBdSdS)N�
g�?ZidleTF)�ranger!r)rZsleep_cyclesZ
sleep_secs�irrr�_wait_till_idlesz BootloaderPlugin._wait_till_idlecs�|jjddgdd�\}}}tjd||f�|dkr8dS|j|�}|j�sXtjd�dSi}|j|�j�}x8|j	�D],\�}	x|	D]}
|�j
|
�q�W|	|�<qtWi}|j|�j�}x�|j	�D]~\�}	|j���r$tjd	�|�f�|j�g�j
|��|j
�fd
d�|�D��g|�<|j�g�j
|	�|	|�<q�W||k�rdtjd|�|||fStjd
||f�|jjddgdd�|D�dd�|D�dd�\}}
}|dk�r�tjd|�|j|�ddfS|||fSdS)z�
		Method for appending or deleting rpm-ostree karg
		returns None if rpm-ostree not present or is run on not ostree system
		or tuple with new kargs, appended kargs and deleted kargs
		z
rpm-ostree�kargsT)r@z'rpm-ostree output stdout:
%s
stderr:
%srNzCannot wait for transaction endz)adding rpm-ostree kargs %s: %s for deletecs$g|]}|dk	r�d|n��qS)Nr/r)r9r;)r:rrr<.sz6BootloaderPlugin._rpm_ostree_kargs.<locals>.<listcomp>z3skipping rpm-ostree kargs - append == deleting (%s)z2rpm-ostree kargs - appending: '%s'; deleting: '%s'cSsg|]}d|�qS)z--append=%sr)r9r;rrrr<9scSsg|]}d|�qS)z--delete=%sr)r9r;rrrr<:sz-Something went wrong with rpm-ostree kargs
%s)NNN)NNN)rrBrCrDr7rL�errorr?r0r>�remove�getr1�extend�info)rr2�deleterFrGrHrM�deletedZ
delete_params�valr;�appendedZ
append_params�_r)r:r�_rpm_ostree_kargs
sF





z"BootloaderPlugin._rpm_ostree_kargscCsV|j�j�}g}xR|D]J}t|�jd�r4|j|�q||krJ||||<qtjd||jjf�qWd}x�|D]�}||}|dksn|dkr�qn|d}|dd�}|dd�j	�}	|dks�|d	kr�|dkr�|	dkr�|d|	7}qn|d
k�r(|	dk�r4x@|	j
�D]&}
tj|
�}tj
d|d
d|�}�q�Wqn|d|7}qnW|j	�}|dk�rR||d<|S)zSMerge provided options with plugin default options and merge all cmdline.* options.r+z$Unknown option '%s' for plugin '%s'.rNrrrA�+�\�-r8z(\A|\s)z	(?=\Z|\s))rZrYr[)r.�copy�str�
startswithr2rCrEr�__name__�stripr0�re�escape�sub)rr4Z	effectiveZcmdline_keys�keyr+rU�opZop1�vals�pZregexrrr�_get_effective_optionsAs:





z'BootloaderPlugin._get_effective_optionscCs.g}x$tjD]}tjj|�r|j|�qW|S)N)rZGRUB2_CFG_FILESr	r
�existsr2)rZ	cfg_files�frrrrcs
z%BootloaderPlugin._get_grub2_cfg_filescCsH|jjtjdd�}t|�dkr2tjdtj�dStjd|tj	d�dk	S)NT)�no_errorrzcannot read '%s'Fz=^\s*GRUB_ENABLE_BLSCFG\s*=\s*\"?\s*[tT][rR][uU][eE]\s*\"?\s*$)�flags)
r�	read_filer�GRUB2_DEFAULT_ENV_FILEr3rCrRra�search�	MULTILINE)r�grub2_default_envrrrrjszBootloaderPlugin._bls_enabledcCs|jjtj|�S)N)r�add_modify_option_in_filer�BOOT_CMDLINE_FILE)rr5rrr�_patch_bootcmdlinessz#BootloaderPlugin._patch_bootcmdlinecCs�|jtjdtjdi�|js*tjd�dSx4|jD]*}|jj|dtj	ddtj
didd�q2W|jdk	r�tjd|j�|jj|j�dS)Nrzcannot find grub.cfg to patchzset\s+F)�addzremoving initrd image '%s')
rtr�BOOT_CMDLINE_TUNED_VAR�BOOT_CMDLINE_INITRD_ADD_VARrrCrRrrr�GRUB2_TUNED_VAR�GRUB2_TUNED_INITRD_VARr�unlink)rrjrrr�_remove_grub2_tuningvs
*
z%BootloaderPlugin._remove_grub2_tuningcCsf|jjtj�}tjtjd|tjd�}|r2|dnd}tjtjd|tjd�}|rZ|dnd}||fS)Nz	=\"(.*)\")rlrr)	rrmrrsrarorvrp�BOOT_CMDLINE_KARGS_DELETED_VAR)rrjrVrTrrr�_get_rpm_ostree_changes�sz(BootloaderPlugin._get_rpm_ostree_changescCs@|j�\}}|j|j|�|j|�d�|jtjdtjdi�dS)N)r2rSr)r}rXr7rtrrvr|)rrVrTrrr�_remove_rpm_ostree_tuning�sz*BootloaderPlugin._remove_rpm_ostree_tuningcCsR|tjkrN|jrN|jr,tjd�|j�n"tjd�|j�|jddd��dS)Nz4removing rpm-ostree tuning previously added by Tunedz/removing grub2 tuning previously added by Tunedr)�tuned_params�tuned_initrd)	rZ
ROLLBACK_FULLrr"rCrRr~r{�_update_grubenv)rr#Zrollbackrrr�_instance_unapply_static�s


z)BootloaderPlugin._instance_unapply_staticcCs�tjd�tjdtjdd|tjd�}tjdtjd|tjd�}tjdtjdd|tjd�}tjdtjd|tjd�}tjtjdd|tjd�}tjtj	dd|tjd�S)	Nzunpatching grub.cfgz
^\s*set\s+z\s*=.*
r)rlz *\$z\nz\n+)
rCrDrarcrrxrpry�GRUB2_TEMPLATE_HEADER_BEGIN�GRUB2_TEMPLATE_HEADER_END)r�	grub2_cfg�cfgrrr�_grub2_cfg_unpatch�s
z#BootloaderPlugin._grub2_cfg_unpatchcCs�tjd�dtjd}x8|D]0}|d|jj|�d|jj||�d7}qW|tjd7}tjd||tj	d	�}tj
tjd
�}xt|D]l}tjd|dd
|||tj	d	�}tjd|d||dd|tj	d	�}tjd|dd|tj	d	�}q�W|S)Nzinitial patching of grub.cfgz\1\n\n�
zset z="z"
z\nz+^(\s*###\s+END\s+[^#]+/00_header\s+### *)\n)rl)�linuxZinitrdz^(\s*z(16|efi)?\s+.*)$z\1 $z(?:16|efi)?\s+\S+rescue.*)\$z *(.*)$z\1\2z(?:16|efi)?\s+\S+rescue.*) +$z\1)rCrDrr�rrbr�rarcrprxry)rr�r5�s�optZd2rKrrr�_grub2_cfg_patch_initial�s

0
$( z)BootloaderPlugin._grub2_cfg_patch_initialcCs�|jjtj�}t|�dkr.tjdtj�dStjtjd�}d}xv|D]n}t	j
d|d||d|t	jd�dkrFd	}|ddkr�|d7}||d|d
|d||d7}qFW|r�tjdtj�|jj
tj|�d	S)Nrzcannot read '%s'F)ZGRUB_CMDLINE_LINUX_DEFAULTZGRUB_INITRD_OVERLAYz^[^#]*\bz
\s*=.*\\\$z\b.*$)rlTrr�z="${z:+$z }\$z"
z
patching '%s'���)rrmrrnr3rCrRrxryrarorprD�
write_to_file)rrqr5�writerKrrr�_grub2_default_env_patch�s 
*,z)BootloaderPlugin._grub2_default_env_patchcCs�|jjtj�}t|�dkr.tjdtj�dSd}tjdtj	d|tj
d�r�d}tjdtj	dd	|tj
d�}|d
dkr�|d7}|r�tjdtj�|jj
tj|�dS)Nrzcannot read '%s'Fzb^GRUB_CMDLINE_LINUX_DEFAULT=\"\$\{GRUB_CMDLINE_LINUX_DEFAULT:\+\$GRUB_CMDLINE_LINUX_DEFAULT \}\\\$z"$)rlTz"$
rrr�zunpatching '%s'r�)rrmrrnr3rCrRrarorxrprcrDr�)rrqr�r�rrr�_grub2_default_env_unpatch�s z+BootloaderPlugin._grub2_default_env_unpatchcCsZtjd�|jstjd�dS�x|jD�]}|jj|�}t|�dkrVtjd|�q(tjd|�|}d}xf|D]^}tjd|dd|jj	||�d
|tj
d�\}}|dks�tjd
||tj
d�dkrrd}qrWttjd
t
j|tj
d��ttjd
t
j|tj
d��k�rd}|�r*|j|j|�|�}|jj||�q(W|j�rN|j�n|j�dS)Nzpatching grub.cfgzcannot find grub.cfg to patchFrzcannot patch %sz+adding boot command line parameters to '%s'z	\b(set\s+z\s*=).*$z\1�")rlrz\$Tz\1")rCrDrrRrrmr3ra�subnrbrpro�findallrrxryr�r�r�r r�r�)rr5rjr�Z
grub2_cfg_newZ
patch_initialr�Znsubsrrr�_grub2_cfg_patch�s4


4" 
z!BootloaderPlugin._grub2_cfg_patchcCsb|j�\}}|j|j|�}|s"dS|j|d�\}}}|dkr@dS|jtj|jtj|j|�i�dS)N)r2)	r}r7rrXrtrrvr|r?)rrVrWZ
_cmdline_dictr5rrr�_rpm_ostree_update�sz#BootloaderPlugin._rpm_ostree_updatecCs8|jtj|jtj|ji�|jtj|jtj|ji�dS)N)	r�rrxrryrrtrvrw)rrrr�
_grub2_updateszBootloaderPlugin._grub2_updatecCstjjtj�S)N)r	r
rirZBLS_ENTRIES_PATH)rrrr�_has_blsszBootloaderPlugin._has_blscCs\tjdt|��dd�|j�D�}|jjdddg|�\}}|dkrXtjd|�d	Sd
S)Nzupdating grubenv, setting %scSs$g|]\}}dt|�t|�f�qS)z%s=%s)r])r9Zoption�valuerrrr<sz4BootloaderPlugin._update_grubenv.<locals>.<listcomp>z
grub2-editenvr[�setrzcannot update grubenv: '%s'FT)rCrDr]r>rrBrE)rr5�lrFrGrrrr�
sz BootloaderPlugin._update_grubenvcCsb|jj�}|dkrdStjdtj�|jjtjdgd|id�\}}|dkr^tjd|�dSd	S)
NrFz4running kernel update hook '%s' to patch BLS entriesruZKERNEL_INSTALL_MACHINE_ID)�envrzcannot patch BLS entries: '%s'T)rZget_machine_idrCrDrZKERNEL_UPDATE_HOOK_FILErBrE)rZ
machine_idrFrGrrr�_bls_entries_patch_initials
z+BootloaderPlugin._bls_entries_patch_initialcCs6tjd�|j�r2|j|j|jd��r2|j�r2dSdS)Nzupdating BLS)rr�TF)rCrDr�r�rrr�)rrrr�_bls_updates
zBootloaderPlugin._bls_updatecCs(|jdkr$tjjtjtjj|��|_dS)N)rr	r
r=r�BOOT_DIR�basename)r�namerrr�_init_initrd_dst_img&s
z%BootloaderPlugin._init_initrd_dst_imgcCstjjtj�S)N)r	r
�isdirrZPETITBOOT_DETECT_DIR)rrrr�_check_petitboot*sz!BootloaderPlugin._check_petitbootcCs�|jrtjd�dS|j�r&tjd�tjd|j�tjj|j�}|j	j
||j�sXdSd|_|j	jd�j
�}d}t|�}|r�tjdd	|�}t|�|kr�|}tjj||�|_dS)
Nz:Detected rpm-ostree which doesn't support initrd overlays.FzkDetected Petitboot which doesn't support initrd overlays. The initrd overlay will be ignored by bootloader.zinstalling initrd image as '%s'Tz
/proc/cmdline�/z)^\s*BOOT_IMAGE=\s*(?:\([^)]*\))?(\S*/).*$z\1)r"rCrEr�rRrr	r
r�rr\rrm�rstripr3rarcr=r)rZimgZimg_nameZcurr_cmdlineZinitrd_grubpathZlcr
rrr�_install_initrd-s&

z BootloaderPlugin._install_initrdr&cCs$|rdS|r |dk	r t|�g|_dS)N)r]r)r�enablingr��verify�ignore_missingrrr�_grub2_cfg_fileBsz BootloaderPlugin._grub2_cfg_filer'cCsR|rdS|rN|dk	rNt|�|_|jdkr,dS|jddkrNtjjtj|j�|_dS)NrFrr�)r]rr	r
r=rr�)rr�r�r�r�rrr�_initrd_dst_imgJs

z BootloaderPlugin._initrd_dst_imgr*cCs*|rdS|r&|dk	r&|jj|�dk|_dS)N�1)r�get_boolr)rr�r�r�r�rrrrVsz#BootloaderPlugin._initrd_remove_dirr(FrI)Z
per_deviceZprioritycCsD|rdS|r@|dk	r@t|�}|j|�|dkr2dS|j|�s@dSdS)NrF)r]r�r�)rr�r�r�r�Zsrc_imgrrr�_initrd_add_img^s

z BootloaderPlugin._initrd_add_imgr)c
Cs|rdS|o|dk	�rt|�}|j|�|dkr4dStjj|�sRtjd|�dStjd|�tj	ddd�\}}tj
d|�tj|�|jj
d	||d
d�\}}	tj
d|	�|d
kr�tjd�|jj|d
d�dS|j|�|jj|�|j�rtjd|�|jj|�dS)NrFzFerror: cannot create initrd image, source directory '%s' doesn't existz+generating initrd image from directory '%s'ztuned-bootloader-z.tmp)�prefix�suffixz+writing initrd image to temporary file '%s'zfind . | cpio -co > %sT)�cwd�shellzcpio log: %srzerror generating initrd image)rkzremoving directory '%s')r]r�r	r
r�rCrNrR�tempfileZmkstemprD�closerrBrzr�rZrmtree)
rr�r�r�r�Zsrc_dir�fdZtmpfilerFrGrrr�_initrd_add_dirks2



z BootloaderPlugin._initrd_add_dirr+cCsJ|jj|jj|��}|�r |jr8|j�d}|j|�}n|jjd�}t|�dkrTdSt	|j
��}t	|j
��}	|	|}
t|
�dkr�tjt
jdt|	�f�dSdd�|D�}xR|
D]J}|j
dd�d}
|
|kr�tjt
j|
|f�q�tjt
j||
|f�q�W|	|@}tjd	d
j|�f�dS|�rF|dk	�rFtjd�d|_||_dS)
Nrz
/proc/cmdliner+TcSsi|]}||jdd�d�qS)r/rr)r0)r9r;rrr�
<dictcomp>�sz-BootloaderPlugin._cmdline.<locals>.<dictcomp>r/rz2expected arguments that are present in cmdline: %sr8Fz;installing additional boot command line parameters to grub2)Z
_variables�expandrZunquoter"rXr?rmr3r�r0rCrRrZSTR_VERIFY_PROFILE_VALUE_OKr]rNZ'STR_VERIFY_PROFILE_CMDLINE_FAIL_MISSINGZSTR_VERIFY_PROFILE_CMDLINE_FAILr=rr)rr�r�r�r�r;Zrpm_ostree_kargsr+Zcmdline_setZ	value_setZmissing_setZcmdline_dict�m�argZpresent_setrrr�_cmdline�s6

zBootloaderPlugin._cmdliner,cCs8|rdS|r4|dk	r4|jj|�dkr4tjd�d|_dS)Nr�z(skipping any modification of grub configT)rr�rCrRr)rr�r�r�r�rrr�_skip_grub_config�s
z"BootloaderPlugin._skip_grub_configcCs�|rV|jrVt|j�dkr"tjd�t|j�dkr:tjd�|jtj|jtj	|ji�n0|r�|j
r�|jrp|j�n|j
�|j�d|_
dS)Nrz0requested changes to initrd will not be applied!z1requested changes to cmdline will not be applied!F)rr3rrCrErrtrrvrwrr"r�r�r�)rr#r�rrr�_instance_post_static�s




z&BootloaderPlugin._instance_post_static)r)1r_�
__module__�__qualname__�__doc__rr$r%�classmethodr.�staticmethodr7r?r!rLrXrhrrrtr{r}r~rZ
ROLLBACK_SOFTr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zcommand_customr�r�rr�r�r�r�r��
__classcell__rr)rrrsT.
4"	
	 
	
!	r)rrZ
decoratorsZ
tuned.logsZtunedrZtuned.utils.commandsrZtuned.constsrr	rar�ZtimerZlogsrPrCZPluginrrrrr�<module>s



?>