diff options
author | Scott Moser <smoser@ubuntu.com> | 2011-01-19 04:35:46 +0000 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2011-01-19 04:35:46 +0000 |
commit | b85106a10a78e4c15303ac3b9b16d03a3f2f9cab (patch) | |
tree | 97d3b765b5214c86e30144beee35fe10106282b2 /cloudinit | |
parent | 548f5b3f81799f3339e66444be58f7016fa8c0a2 (diff) | |
download | vyos-cloud-init-b85106a10a78e4c15303ac3b9b16d03a3f2f9cab.tar.gz vyos-cloud-init-b85106a10a78e4c15303ac3b9b16d03a3f2f9cab.zip |
move user scripts ('#!' and runcmd) to be per-instance (LP: #675711)
Previously, if you ran an instance with either runcmd data or user-data
scripts, it would run again after rebundle or create-image.
This puts the files created by runcmd or user-data scripts into instance-id
specific paths, and then runs them by that instance-id specific path.
LP: #675711
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/CloudConfig/cc_runcmd.py | 3 | ||||
-rw-r--r-- | cloudinit/__init__.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/cloudinit/CloudConfig/cc_runcmd.py b/cloudinit/CloudConfig/cc_runcmd.py index 97d21900..969f6394 100644 --- a/cloudinit/CloudConfig/cc_runcmd.py +++ b/cloudinit/CloudConfig/cc_runcmd.py @@ -21,7 +21,8 @@ import cloudinit.util as util def handle(name,cfg,cloud,log,args): if not cfg.has_key("runcmd"): return - outfile="%s/runcmd" % cloudinit.user_scripts_dir + outfile="%s/%s/runcmd" % \ + (cloudinit.user_scripts_dir, cloud.get_instance_id()) content="#!/bin/sh\n" escaped="%s%s%s%s" % ( "'", '\\', "'", "'" ) diff --git a/cloudinit/__init__.py b/cloudinit/__init__.py index fd20c7be..be366d4c 100644 --- a/cloudinit/__init__.py +++ b/cloudinit/__init__.py @@ -338,7 +338,8 @@ class CloudInit: return filename=filename.replace(os.sep,'_') - util.write_file("%s/%s" % (user_scripts_dir,filename), payload, 0700) + util.write_file("%s/%s/%s" % + (user_scripts_dir,self.get_instance_id(),filename), payload, 0700) def handle_upstart_job(self,data,ctype,filename,payload): if ctype == "__end__" or ctype == "__begin__": return |