summaryrefslogtreecommitdiff
path: root/cloudinit/CloudConfig/cc_disable_ec2_metadata.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/CloudConfig/cc_disable_ec2_metadata.py')
-rw-r--r--cloudinit/CloudConfig/cc_disable_ec2_metadata.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/cloudinit/CloudConfig/cc_disable_ec2_metadata.py b/cloudinit/CloudConfig/cc_disable_ec2_metadata.py
new file mode 100644
index 00000000..a4b4280f
--- /dev/null
+++ b/cloudinit/CloudConfig/cc_disable_ec2_metadata.py
@@ -0,0 +1,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(' '))