/usr/share/netplan/netplan/cli/commands/__pycache__
NameSizeModeActions
apply.cpython-38.pyc91460644editdlrm
generate.cpython-38.pyc20170644editdlrm
get.cpython-38.pyc22130644editdlrm
info.cpython-38.pyc17510644editdlrm
ip.cpython-38.pyc46330644editdlrm
migrate.cpython-38.pyc106360644editdlrm
set.cpython-38.pyc55720644editdlrm
sriov_rebind.cpython-38.pyc17010644editdlrm
try_command.cpython-38.pyc58770644editdlrm
__init__.cpython-38.pyc8160644editdlrm
Edit: /usr/share/netplan/netplan/cli/commands/__pycache__/set.cpython-38.pyc (5572B)
U ø)/bÍ"ã@s€dZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z dZddgZGdd „d e ƒZdS) znetplan set command lineéN)ÚNetplanCommand)Ú ConfigManagerz70-netplan-setÚrendererÚversioncsbeZdZ‡fdd„Zdd„Zdd„Zeefdœdd „Zd d „Z d d „Z ddd„Z ddd„Z ‡Z S)Ú NetplanSetcstƒjdddddS)NÚsetzTAdd new setting by specifying a dotted key=value pair like ethernets.eth0.dhcp4=trueT)Ú command_idÚ descriptionÚleaf)ÚsuperÚ__init__©Úself©Ú __class__©ú./usr/share/netplan/netplan/cli/commands/set.pyr &sþzNetplanSet.__init__cCsR|jjdtdd|jjdtdd|jjdddd |j|_| ¡| ¡dS) NÚ key_valuezNThe nested key=value pair in dotted format. Value can be NULL to delete a key.)ÚtypeÚhelpz --origin-hintz”Can be used to help choose a name for the overwrite YAML file. A .yaml suffix will be appended automatically.z --root-dirú/zAOverwrite configuration files in this root directory instead of /)Údefaultr)ÚparserÚ add_argumentÚstrÚ command_setÚfuncÚ parse_argsÚ run_commandr rrrÚrun+s ÿ ÿ ÿzNetplanSet.runcCs0t|tƒr,t| ¡ƒdgkr,|ddkr,dSdS)NÚnetworkTF)Ú isinstanceÚdictÚlistÚkeys)rÚtreerrrÚ is_emtpy_yaml9s(zNetplanSet.is_emtpy_yaml)Úreturnc s2| di¡‰tƒ}ˆD]ª}|tkr$qˆ |g¡}|dkrXdd„t ||j¡Dƒ}|ˆ|<|D]b}t}t ||j¡}|rŠtj   |¡dd…}d||ˆ |¡ |¡iii}|  | |i¡|¡||<q\qt ‡fdd„tDƒƒr*t |ƒdkròt|ƒdnt}tD].} d| ˆ | ¡ii} |  | |i¡| ¡||<qú| ¡S) Nr cSsi|] }|d“qS©Nr)Ú.0ÚdevrrrÚ Jsz1NetplanSet.split_tree_by_hint..éûÿÿÿc3s|]}ˆ |¡VqdSr()Úget)r)Úkey©r rrÚ Xsz0NetplanSet.split_tree_by_hint..ér)r-r"Ú GLOBAL_KEYSÚ libnetplanÚnetplan_get_ids_for_devtypeÚroot_dirÚ FALLBACK_HINTÚnetplan_get_filename_by_idÚosÚpathÚbasenameÚmergeÚanyÚlenr#Úitems) rÚset_treeZsubtreesÚdevtypeZdevtype_contentÚnetdefÚhintÚfilenameZ netdef_treer.r%rr/rÚsplit_tree_by_hint>s,  zNetplanSet.split_tree_by_hintc Cs |jdk r t|jƒdkr tdƒ‚|j dd¡}t|ƒdkrBtdƒ‚|\}}| |t |¡¡}| |¡rÚt j   dd¡}|jrªt j   |j ||jd ¡}t j   |¡rÖt  |¡n,t t j   |j |d ¡¡}|D]}t  |¡qÆdS|j|fg} |jdkrú| |¡} | D]\} } | | | d |j ¡qþdS) NrzInvalid/empty origin-hintú=r1ézInvalid value specifiedÚetcÚnetplanz.yamlz*.yaml)Z origin_hintr=Ú ExceptionrÚsplitÚ parse_keyÚyamlÚ safe_loadr&r8r9Újoinr5ÚisfileÚremoveÚglobrDÚ write_file) rrJr.Úvaluer?r9Z hint_pathZ yaml_filesÚfÚhintsrBZsubtreerrrrbs,         zNetplanSet.command_setc Cst| d¡s|dksd|}t d|¡}i}d}|}|D]8}| dd¡}i}|t|ƒkrZ|}| ||¡}|d7}q6|S)Nznetwork.r z (?s