Server IP : 23.254.227.96 / Your IP : 216.73.216.7 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3.6/site-packages/cloudinit/config/__pycache__/ |
Upload File : |
3 ��b?I � @ s� d Z ddlZddlZddlZddlmZ ddlmZmZm Z dZ eje �ZdZ eje �Zejde �ZdZd Zeje�Zd d� Zdd � Zdd� Zddd�Zd dd�Zd!dd�Zeedd�dd�Zd"dd�Zdd� Zdd� ZdS )#a< Mounts ------ **Summary:** configure mount points and swap files This module can add or remove mountpoints from ``/etc/fstab`` as well as configure swap. The ``mounts`` config key takes a list of fstab entries to add. Each entry is specified as a list of ``[ fs_spec, fs_file, fs_vfstype, fs_mntops, fs-freq, fs_passno ]``. For more information on these options, consult the manual for ``/etc/fstab``. When specifying the ``fs_spec``, if the device name starts with one of ``xvd``, ``sd``, ``hd``, or ``vd``, the leading ``/dev`` may be omitted. In order to remove a previously listed mount, an entry can be added to the mounts list containing ``fs_spec`` for the device to be removed but no mountpoint (i.e. ``[ sda1 ]`` or ``[ sda1, null ]``). The ``mount_default_fields`` config key allows default options to be specified for the values in a ``mounts`` entry that are not specified, aside from the ``fs_spec`` and the ``fs_file``. If specified, this must be a list containing 6 values. It defaults to:: mount_default_fields: [none, none, "auto", "defaults,nobootwait", "0", "2"] On a systemd booted system that default is the mostly equivalent:: mount_default_fields: [none, none, "auto", "defaults,nofail,x-systemd.requires=cloud-init.service", "0", "2"] Note that `nobootwait` is an upstart specific boot option that somewhat equates to the more standard `nofail`. Swap files can be configured by setting the path to the swap file to create with ``filename``, the size of the swap file with ``size`` maximum size of the swap file if using an ``size: auto`` with ``maxsize``. By default no swap file is created. **Internal name:** ``cc_mounts`` **Module frequency:** per instance **Supported distros:** all **Config keys**:: mounts: - [ /dev/ephemeral0, /mnt, auto, "defaults,noexec" ] - [ sdc, /opt/data ] - [ xvdh, /opt/data, "auto", "defaults,nofail", "0", "0" ] mount_default_fields: [None, None, "auto", "defaults,nofail", "0", "2"] swap: filename: <file> size: <"auto"/size in bytes> maxsize: <size in bytes> � N)� whitespace)�subp� type_utils�utilz&^([x]{0,1}[shv]d[a-z][0-9]*|sr[0-9]+)$z^.+:.*z[%s]+z /etc/fstabzcomment=cloudconfigc C s: | d krdS x(dD ] }| j |�r| jd�dkrdS qW d S ) N�ami�root�swapT� ephemeral�ebs�:� F)r r r )r r ���)� startswith�find)�nameZenumname� r �/usr/lib/python3.6/cc_mounts.py�is_meta_device_nameU s r c C s t j| �rdS dS )NTF)�NETWORK_NAME_RE�match)r r r r �is_network_devicea s r c C sH t |�d|f d|f g}x(|D ] }d| |f }tjj|�r |S q W d S )Nzp%sz-part%sz%s%s)�str�os�path�exists)�device_path�partition_numberZpotential_suffixes�suffixZpotential_partition_devicer r r �_get_nth_partition_for_deviceh s r c C sX t jj| �jd�d }t jjd|�}|d k rLt jj|t jj|�jd�d �}t jj|�S )N�/r z/sys/block/r r )r r �realpath�split�joinr )r �partition_pathZdevice_nameZsys_pathr r r �_is_block_deviceu s r$ c C s |j d| � | }|dkr&d}|j d� t| �r2| S tj|�\}}|}|rj|j||�}||krj|j d||� t|�r�||�}|s�d S |jd�s�d|f }|j d||� ntj| �r�d|f }d }|d kr�t |d �}nt ||�}|d kr�d S t ||��r|d k �r|S |S d S ) Nz+Attempting to determine the real name of %sr � ephemeral0z2Adjusted mount option from ephemeral to ephemeral0zMapped device alias %s to %sr z/dev/%szMapped metadata name %s to %sr )�debugr r Zexpand_dotted_devname�getr r �DEVICE_NAME_REr r r$ ) Z startnameZtransformer�log�aliasesZdevnamer r Zorigr# r r r �sanitize_devname sD r+ c s� | d krt j� d } d� d� }d|| d�}|d krB|d krB|}nd|r�tj|�}|j|j }||d<