관리-도구
편집 파일: cloud.cpython-39.opt-1.pyc
a '�Dg� � @ st d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZm Z d dl mZ d dlm Z e�e�ZG dd� d�ZdS ) � N)�Optional)�Distro)�Paths�Runners)�events)� DataSourcec @ s� e Zd Zd!eeeeeee j d�dd�Zedd� �Z d"dd �Zd d� Zd#d d�Zdd� Zedd� �Zdd� Zdd� Zd$dd�Zdd� Zd%dd�Zd&dd�Zd'dd �ZdS )(�CloudN)� datasource�paths�cfg�distro�runners�reporterc C s@ || _ || _|| _|| _|| _|d u r6tjdddd�}|| _d S )Nzunnamed-cloud-reporterF)�name�descriptionZreporting_enabled)r r r �_cfg�_runnersr �ReportEventStackr )�selfr r r r r r � r �3/usr/lib/python3.9/site-packages/cloudinit/cloud.py�__init__ s �zCloud.__init__c C s t �| j�S �N)�copy�deepcopyr �r r r r r 6 s z Cloud.cfgFc C s | j �|||||�S )a� Run a function gated by a named semaphore for a desired frequency. The typical case for this method would be to limit running of the provided func to a single well-defined frequency: PER_INSTANCE, PER_BOOT or PER_ONCE The semaphore provides a gate that persists across cloud-init boot stage boundaries so multiple modules can share this state even if they happen to be run in different boot stages or across reboots. )r �run)r r Zfunctor�argsZfreqZ clear_on_failr r r r ; s z Cloud.runc C s6 | j j| }tj�|�s2t�dtj�|�|� d S |S )Nz-No template found in %s for template named %s)r Ztemplate_tpl�os�path�isfile�LOGZwarning�dirname)r r �fnr r r �get_template_filenameI s �zCloud.get_template_filenameTc C s | j �|�S r )r �get_userdata)r Zapply_filterr r r r% U s zCloud.get_userdatac C s | j �� S r )r �get_instance_idr r r r r&