📂 FileMgr
📍
/
usr
/
lib
/
python3
/
dist-packages
/
cloudinit
/
sources
/
__pycache__
✏️ /usr/lib/python3/dist-packages/cloudinit/sources/__pycache__/DataSourceCloudStack.cpython-312.pyc
✕ Tutup
� ��im2 � � � d dl Z d dlZd dlZd dlmZ d dlmZmZmZ d dl m Z d dlmZm Z mZmZ d dlmZ d dlmZ d dlmZ d d lmZ d d lmZ d dlmZ e j6 e� ZdZ G d � d� Z G d� dej@ � Z! G d� de!� Z"d� Z#d� Z$d� Z%de&fd�Z'e"ejP ffe!ejP ejR ffgZ*d� Z+y)� N)�suppress)�gaierror�getaddrinfo� inet_ntoa)�pack)�dmi�net�performance�sources)� url_helper)�util)�dhcp)�NoDHCPLeaseError)�EphemeralIPNetwork)�ec2� CloudStackc �P � e Zd ZdZd� Zd� Z ej dd�� d� � Zy) �CloudStackPasswordServerClienta� Implements password fetching from the CloudStack password server. http://cloudstack-administration.readthedocs.org/ en/latest/templates.html#adding-password-management-to-your-templates has documentation about the system. This implementation is following that found at https://github.com/shankerbalan/cloudstack-scripts/ blob/master/cloud-set-guest-password-debian c � � || _ y �N)�virtual_router_address)�selfr s �H/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceCloudStack.py�__init__z'CloudStackPasswordServerClient.__init__/ s � �&<��#� c �� � d| j � d�}d|i}t j ||dd�� }|j � st d� �|j j d� j � S ) N�http://z:8080�DomU_Request� � )�headers�timeout�retriesz+Failed to fetch VM password from CloudStackzutf-8)r �uhelp�readurl�ok�RuntimeError�contents�decode�strip)r �domu_request�urlr! �resps r �_do_requestz*CloudStackPasswordServerClient._do_request2 sh � ���3�3�4�E�:��!�<�0���}�}�S�'�2�q�I���w�w�y��L�M�M��}�}�#�#�G�,�2�2�4�4r zGetting password�always��log_modec �t � | j d� }|dv ry |dk( rt d� �| j d� |S )N�send_my_password)� �saved_password�bad_requestz-Error when attempting to fetch root password.r5 )r. r'