File: //lib/python3.6/site-packages/cloudinit/__pycache__/ec2_utils.cpython-36.opt-1.pyc
3
��b� � @ s� d dl Z d dlZd dlmZ d dlmZmZ eje�Z e
ejg�ZG dd� de
�ZG dd� de
�Zdd � Zdd
d�Zddd�Zddd�Zddd�ZdS )� N)�log)�
url_helper�utilc @ s e Zd ZdZdd� Zdd� ZdS )�MetadataLeafDecoderz.Decodes a leaf blob into something meaningful.c C s, |sdS |j � }|jd�r(|jd�r(dS dS )NF�{�}T)�strip�
startswith�endswith)�self�text� r
�/usr/lib/python3.6/ec2_utils.py�_maybe_json_object s z&MetadataLeafDecoder._maybe_json_objectc C s� |sdS yt j|�}W n tk
r* |S X | j|�rvy
tj|�S ttfk
rt } ztj d||� W Y d d }~X nX |j
d�dkr�|j� S |S )N� z6Field %s looked like a json object, but it was not: %s�
� ���)r �
decode_binary�UnicodeDecodeErrorr �json�loads�
ValueError� TypeError�LOG�warning�find�
splitlines)r �field�blob�er
r
r �__call__ s"