🔐 Sid Gifari File Manager Pro
v8.0.5 | 2026-08-07 10:17:02 | PHP 8.2.32
📂
/ (Root)
/
usr
/
lib
/
python3.6
/
site-packages
/
cloudinit
/
config
/
__pycache__
📍 /usr/lib/python3.6/site-packages/cloudinit/config/__pycache__
🔄 Refresh
✏️
Editing: cc_power_state_change.cpython-36.opt-1.pyc
Read Only
3 \�me� � @ s& U d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl m Z mZ ddlm Z ddlmZ ddlmZmZ ddlmZ dd lmZ eZd ZdZdd deegeed�ed�gdgd�Zeee�Z eje�Zdd� Zdd� Ze ee e!dd�dd�Z"dd� Z#dd� Z$d"dd�Z%d d!� Z&dS )#z&Power State Change: Change power state� N)�dedent)�subp�util)�Cloud)�Config)� MetaSchema�get_meta_doc)�ALL_DISTROS)�PER_INSTANCE� a[ This module handles shutdown/reboot after all config modules have been run. By default it will take no action, and the system will keep running unless a package installation/upgrade requires a system reboot (e.g. installing a new kernel) and ``package_reboot_if_required`` is true. Using this module ensures that cloud-init is entirely finished with modules that would be executed. An example to distinguish delay from timeout: If you delay 5 (5 minutes) and have a timeout of 120 (2 minutes), then the max time until shutdown will be 7 minutes, though it could be as soon as 5 minutes. Cloud-init will invoke 'shutdown +5' after the process finishes, or when 'timeout' seconds have elapsed. .. note:: With Alpine Linux any message value specified is ignored as Alpine's halt, poweroff, and reboot commands do not support broadcasting a message. Zcc_power_state_changezPower State ChangezChange power statez� power_state: delay: now mode: poweroff message: Powering off timeout: 2 condition: true z� power_state: delay: 30 mode: reboot message: Rebooting machine condition: test -f /var/tmp/reboot_me �power_state)�id�name�title�descriptionZdistros� frequencyZexamplesZactivate_by_schema_keysc C sn yTt j� rDtjddt| �g�\}}|j� d }tjd|�}|jd�S t jd| �S W n t k rh d S X d S )NZprocstatz-c� z\d+ (\w|\.|-)+\s+(/\w.+)� z/proc/%s/cmdline) r Z is_FreeBSDr �str� splitlines�re�search�groupZ load_file�IOError)�pid�outputZ_err�line�m� r �+/usr/lib/python3.6/cc_power_state_change.py�givecmdlineU s r c C s� t | t�rtjd| � | S d| }yjtj| t | t� d�}|j� |j}|dkr`tjd|� dS |dkrxtjd|� d S tj d ||� d S W n. t k r� } ztj d||� d S d }~X nX d S )NzStatic Condition: %szcheck_condition command (%s): )�shellr z%sexited 0. condition met.Tr z%sexited 1. condition not met.Fz*%sunexpected exit %s. do not apply change.z%sUnexpected error: %s)� isinstance�bool�LOG�debug� subprocess�Popen�list�communicate� returncode�warning� Exception)ZcondZpre�proc�ret�er r r �check_conditiong s&