3
\me @ s U d Z ddlZddlmZ ddlmZmZ ddlmZ ddl m
Z
ddlmZm
Z
ddlmZ dd lmZ d
ddd
dgZdd
ddd
gZejeZdddedegedgdgdZee
eZ ee
eeddddZdS )z/Disable EC2 Metadata: Disable AWS EC2 metadata. N)dedent)subputil)Cloud)Config)
MetaSchemaget_meta_doc)ALL_DISTROS)
PER_ALWAYSZrouteaddz-hostz169.254.169.254ZrejectipZprohibitZcc_disable_ec2_metadatazDisable EC2 MetadatazDisable AWS EC2 Metadataz This module can disable the ec2 datasource by rejecting the route to
``169.254.169.254``, the usual route to the datasource. This module
is disabled by default.zdisable_ec2_metadata: truedisable_ec2_metadata)idnametitledescriptionZdistrosZ frequencyZexamplesZactivate_by_schema_keys)r cfgcloudargsreturnc C sd t j|dd}|rTd }tjdr&t}ntjdr6t}ntjd d S tj|dd ntjd| d S )Nr
Fr ZifconfigzJNeither "route" nor "ip" command found, unable to manipulate routing table)Zcapturez=Skipping module named %s, disabling the ec2 route not enabled) r Zget_cfg_option_boolr Zwhich
REJECT_CMD_IP
REJECT_CMD_IFLOGerrordebug)r r r r ZdisabledZ
reject_cmd r -/usr/lib/python3.6/cc_disable_ec2_metadata.pyhandle- s
r )__doc__Zloggingtextwrapr Z cloudinitr r Zcloudinit.cloudr Zcloudinit.configr Zcloudinit.config.schemar r Zcloudinit.distrosr Zcloudinit.settingsr
r r Z getLogger__name__r metastrlistr r r r r