diff --git a/translator/conf/translator.conf b/translator/conf/translator.conf index 62962594..6ebf2922 100644 --- a/translator/conf/translator.conf +++ b/translator/conf/translator.conf @@ -1,4 +1,4 @@ [DEFAULT] # Relative path location for custom types -custom_types_location=contrib/hot \ No newline at end of file +custom_types_location=translator/custom/hot \ No newline at end of file diff --git a/contrib/__init__.py b/translator/custom/__init__.py similarity index 100% rename from contrib/__init__.py rename to translator/custom/__init__.py diff --git a/contrib/hot/__init__.py b/translator/custom/hot/__init__.py similarity index 100% rename from contrib/hot/__init__.py rename to translator/custom/hot/__init__.py diff --git a/contrib/hot/tosca_collectd.py b/translator/custom/hot/tosca_collectd.py similarity index 100% rename from contrib/hot/tosca_collectd.py rename to translator/custom/hot/tosca_collectd.py diff --git a/contrib/hot/tosca_elasticsearch.py b/translator/custom/hot/tosca_elasticsearch.py similarity index 100% rename from contrib/hot/tosca_elasticsearch.py rename to translator/custom/hot/tosca_elasticsearch.py diff --git a/contrib/hot/tosca_kibana.py b/translator/custom/hot/tosca_kibana.py similarity index 100% rename from contrib/hot/tosca_kibana.py rename to translator/custom/hot/tosca_kibana.py diff --git a/contrib/hot/tosca_logstash.py b/translator/custom/hot/tosca_logstash.py similarity index 100% rename from contrib/hot/tosca_logstash.py rename to translator/custom/hot/tosca_logstash.py diff --git a/contrib/hot/tosca_nodejs.py b/translator/custom/hot/tosca_nodejs.py similarity index 100% rename from contrib/hot/tosca_nodejs.py rename to translator/custom/hot/tosca_nodejs.py diff --git a/contrib/hot/tosca_paypalpizzastore.py b/translator/custom/hot/tosca_paypalpizzastore.py similarity index 100% rename from contrib/hot/tosca_paypalpizzastore.py rename to translator/custom/hot/tosca_paypalpizzastore.py diff --git a/contrib/hot/tosca_rsyslog.py b/translator/custom/hot/tosca_rsyslog.py similarity index 100% rename from contrib/hot/tosca_rsyslog.py rename to translator/custom/hot/tosca_rsyslog.py diff --git a/contrib/hot/tosca_wordpress.py b/translator/custom/hot/tosca_wordpress.py similarity index 100% rename from contrib/hot/tosca_wordpress.py rename to translator/custom/hot/tosca_wordpress.py diff --git a/translator/hot/translate_node_templates.py b/translator/hot/translate_node_templates.py index c70d670d..4c6ede36 100644 --- a/translator/hot/translate_node_templates.py +++ b/translator/hot/translate_node_templates.py @@ -66,6 +66,7 @@ def _generate_type_map(): def _load_custom_mod(custom_path): '''Dynamically load the parent module for all the custom types.''' + fp = None try: fp, filename, desc = imp.find_module(custom_path) imp.load_module(custom_path.replace('/', '.'), @@ -81,8 +82,12 @@ def _load_classes(locations, classes): '''Dynamically load all the classes from the given locations.''' for cls_path in locations: + # Use the absolute path of the class path + abs_path = os.path.dirname(os.path.abspath(__file__)) + abs_path = abs_path.replace('translator/hot', cls_path) + # Grab all the tosca type module files in the given path - mod_files = [f for f in os.listdir(cls_path) if f.endswith('.py') + mod_files = [f for f in os.listdir(abs_path) if f.endswith('.py') and not f.startswith('__init__') and f.startswith('tosca_')]