From 9b1f260f2ba305da9405d88867fec4f0e838681e Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 18 Jun 2010 00:35:20 -0400 Subject: add the instance-id to the environment as INSTANCE_ID for boothooks passing the instance-id of this instance to a boothook will give it the unique id that is needed to implement run-once-per-instance. --- cloudinit/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cloudinit/__init__.py b/cloudinit/__init__.py index b0ee5fe8..04beca1e 100644 --- a/cloudinit/__init__.py +++ b/cloudinit/__init__.py @@ -439,7 +439,9 @@ class CloudInit: filepath = "%s/%s" % (boothooks_dir,filename) util.write_file(filepath, payload, 0700) try: - ret = subprocess.check_call([filepath]) + env=os.environ.copy() + env['INSTANCE_ID']= self.datasource.get_instance_id() + ret = subprocess.check_call([filepath], env=env) except subprocess.CalledProcessError as e: log.error("boothooks script %s returned %i" % (filepath,e.returncode)) -- cgit v1.2.3