You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fluo.apache.org by ct...@apache.org on 2019/08/27 03:35:01 UTC
[fluo-muchos] branch master updated: Addresses minor issues related
to PR #274: (#276)
This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/fluo-muchos.git
The following commit(s) were added to refs/heads/master by this push:
new 4f1a4ae Addresses minor issues related to PR #274: (#276)
4f1a4ae is described below
commit 4f1a4aeae8fc8f3f880bcaff345468906a2b5092
Author: keith-ratcliffe <ra...@gmail.com>
AuthorDate: Mon Aug 26 23:34:57 2019 -0400
Addresses minor issues related to PR #274: (#276)
- Eliminated unnecessary directory walk in init_template()
Other:
- Fixed bug in validate_template(), i.e., dereferencing non-existent
'id' member when cluster_template_d field is undefined
- Clarification of 'devices' file usage in templates/README.md
---
conf/templates/README.md | 3 ++-
conf/templates/user/.gitignore | 2 +-
lib/muchos/config.py | 25 +++++++++----------------
3 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/conf/templates/README.md b/conf/templates/README.md
index 235d5be..cb15e83 100644
--- a/conf/templates/README.md
+++ b/conf/templates/README.md
@@ -122,7 +122,8 @@ automatically by simply adding them to the **ec2** section of
The *devices* file contains the user-defined mapping of storage
devices and mount points for all data (i.e., non-root) volumes in your
-cluster.
+cluster. Muchos Ansible scripts leverage this information to prepare
+all data volumes during the cluster `setup` phase.
Two (and only two) device mappings should exist within *devices*:
* One map to represent your **worker** device mounts, and
diff --git a/conf/templates/user/.gitignore b/conf/templates/user/.gitignore
index f59ec20..72e8ffc 100644
--- a/conf/templates/user/.gitignore
+++ b/conf/templates/user/.gitignore
@@ -1 +1 @@
-*
\ No newline at end of file
+*
diff --git a/lib/muchos/config.py b/lib/muchos/config.py
index 3b07c27..1b0c196 100644
--- a/lib/muchos/config.py
+++ b/lib/muchos/config.py
@@ -339,21 +339,14 @@ class DeployConfig(ConfigParser):
exit("Property '{0}' was not found".format(key))
def init_template(self, templates_path):
- if not self.has_option('ec2', 'cluster_template'):
- return
-
- template_id = self.get('ec2', 'cluster_template')
- for root, dirs, files in os.walk(templates_path):
- for dir_name in dirs:
- if dir_name == template_id:
- self.cluster_template_d = {'id': template_id}
- template_dir = os.path.join(root, dir_name)
- self.load_template_ec2_requests(template_dir)
- self.load_template_device_map(template_dir)
- break
- break
-
- self.validate_template()
+ if self.has_option('ec2', 'cluster_template'):
+ template_id = self.get('ec2', 'cluster_template')
+ template_path = os.path.join(templates_path, template_id)
+ if os.path.exists(template_path):
+ self.cluster_template_d = {'id': template_id}
+ self.load_template_ec2_requests(template_path)
+ self.load_template_device_map(template_path)
+ self.validate_template()
def load_template_ec2_requests(self, template_dir):
for json_path in glob.glob(os.path.join(template_dir, '*.json')):
@@ -374,7 +367,7 @@ class DeployConfig(ConfigParser):
def validate_template(self):
if not self.cluster_template_d:
- exit("ERROR - Template '{0}' is not defined!".format(self.cluster_template_d['id']))
+ exit("ERROR - Template '{0}' is not defined!".format(self.get('ec2', 'cluster_template')))
if 'worker' not in self.cluster_template_d:
exit("ERROR - '{0}' template config is invalid. No 'worker' launch request is defined".format(