summaryrefslogtreecommitdiff
path: root/cloudinit/CloudConfig/cc_disable_ec2_metadata.py
blob: a4b4280fd5b44058c55f635ea8df13474feffc85 (plain)
1
2
3
4
5
6
7
8
9
import cloudinit.util as util
from cloudinit.CloudConfig import per_always

frequency = per_always

def handle(name,cfg,cloud,log,args):
    if util.get_cfg_option_bool(cfg, "disable_ec2_metadata", False):
        fwall="route add -host 169.254.169.254 reject"
        subprocess.call(fwall.split(' '))