summaryrefslogtreecommitdiff
path: root/extensions/install-files.configure
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2015-09-18 09:53:15 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2015-09-18 10:28:24 +0000
commitaeeab946dac9100be26756bfd4948f4b52df386e (patch)
treee7f49236d1f0ba027cc049c79395192f6bdaa6e9 /extensions/install-files.configure
parent5407fd1066c3a4e56d34f5db9e8a7c5d71745937 (diff)
downloaddefinitions-aeeab946dac9100be26756bfd4948f4b52df386e.tar.gz
install-files: Allow definition of manifests in multiple variables
install-files was initially designed such that if you wanted to install multiple manifests you should put multiple whitespace separated paths in the INSTALL_FILES variable. This is clunky if you want to extend the set of files to install, particularly in cluster deployments with multiple systems, as otherwise you could make use of YAML merge keys. So now, like fstab.configure you can set multple options, by using environment variables that start with INSTALL_FILES. It's also easier to extend the set of install files on the command-line or in the environment this way too, since you don't need to parse the YAML to see what it originally had. Change-Id: I298db7ae9790a536e5a5f32b069d0908012695af
Diffstat (limited to 'extensions/install-files.configure')
-rwxr-xr-xextensions/install-files.configure12
1 files changed, 7 insertions, 5 deletions
diff --git a/extensions/install-files.configure b/extensions/install-files.configure
index 64fcecca..782065d1 100755
--- a/extensions/install-files.configure
+++ b/extensions/install-files.configure
@@ -16,7 +16,7 @@
''' A Morph configuration extension for adding arbitrary files to a system
-It will read the manifest files specified in the environment variable
+It will read the manifest files specified in environment variables starting
INSTALL_FILES, then use the contens of those files to determine which files
to install into the target system.
@@ -41,12 +41,14 @@ import writeexts
class InstallFilesConfigureExtension(writeexts.Extension):
def process_args(self, args):
- if not 'INSTALL_FILES' in os.environ:
+ if not any(var.startswith('INSTALL_FILES') for var in os.environ):
return
target_root = args[0]
- manifests = shlex.split(os.environ['INSTALL_FILES'])
- for manifest in manifests:
- self.install_manifest(manifest, target_root)
+ for manifest_var in sorted((var for var in os.environ
+ if var.startswith('INSTALL_FILES'))):
+ manifests = shlex.split(os.environ[manifest_var])
+ for manifest in manifests:
+ self.install_manifest(manifest, target_root)
def install_manifest(self, manifest, target_root):
manifest_dir = os.path.dirname(manifest)