You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by ra...@apache.org on 2017/04/15 12:44:16 UTC
incubator-ariatosca git commit: fixed service-template-filename
parameter usage
Repository: incubator-ariatosca
Updated Branches:
refs/heads/ARIA-48-aria-cli faa67acdb -> 2e9d81a18
fixed service-template-filename parameter usage
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/2e9d81a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/2e9d81a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/2e9d81a1
Branch: refs/heads/ARIA-48-aria-cli
Commit: 2e9d81a189fe0bf279749d83786b39425b109218
Parents: faa67ac
Author: Ran Ziv <ra...@gigaspaces.com>
Authored: Sat Apr 15 15:43:23 2017 +0300
Committer: Ran Ziv <ra...@gigaspaces.com>
Committed: Sat Apr 15 15:43:23 2017 +0300
----------------------------------------------------------------------
aria/cli/commands/service_templates.py | 14 +++++++++-----
aria/cli/service_template_utils.py | 23 +++++++++++------------
2 files changed, 20 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2e9d81a1/aria/cli/commands/service_templates.py
----------------------------------------------------------------------
diff --git a/aria/cli/commands/service_templates.py b/aria/cli/commands/service_templates.py
index 79b2104..8e0e91c 100644
--- a/aria/cli/commands/service_templates.py
+++ b/aria/cli/commands/service_templates.py
@@ -99,14 +99,15 @@ def list(sort_by, descending, model_storage, logger):
@service_templates.command(name='store',
short_help='Store a service template')
@aria.argument('service-template-path')
+@aria.argument('service-template-name')
@aria.options.service_template_filename
@aria.options.verbose()
@aria.pass_model_storage
@aria.pass_resource_storage
@aria.pass_plugin_manager
@aria.pass_logger
-def store(service_template_path, service_template_name, model_storage, resource_storage,
- plugin_manager, logger):
+def store(service_template_path, service_template_name, service_template_filename,
+ model_storage, resource_storage, plugin_manager, logger):
"""Store a service template
`SERVICE_TEMPLATE_PATH` is the path of the service template to store.
@@ -115,7 +116,8 @@ def store(service_template_path, service_template_name, model_storage, resource_
"""
logger.info('Storing service template {0}...'.format(service_template_name))
- service_template_path = service_template_utils.get(service_template_path)
+ service_template_path = service_template_utils.get(service_template_path,
+ service_template_filename)
core = Core(model_storage, resource_storage, plugin_manager)
try:
core.create_service_template(service_template_path,
@@ -166,18 +168,20 @@ def inputs(service_template_name, model_storage, logger):
@service_templates.command(name='validate',
short_help='Validate a service template')
@aria.argument('service-template')
+@aria.options.service_template_filename
@aria.options.verbose()
@aria.pass_model_storage
@aria.pass_resource_storage
@aria.pass_plugin_manager
@aria.pass_logger
-def validate(service_template, model_storage, resource_storage, plugin_manager, logger):
+def validate(service_template, service_template_filename,
+ model_storage, resource_storage, plugin_manager, logger):
"""Validate a service template
`SERVICE_TEMPLATE` is the path or url of the service template or archive to validate.
"""
logger.info('Validating service template: {0}'.format(service_template))
- service_template_path = service_template_utils.get(service_template)
+ service_template_path = service_template_utils.get(service_template, service_template_filename)
core = Core(model_storage, resource_storage, plugin_manager)
try:
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2e9d81a1/aria/cli/service_template_utils.py
----------------------------------------------------------------------
diff --git a/aria/cli/service_template_utils.py b/aria/cli/service_template_utils.py
index caeb5c1..3a0488b 100644
--- a/aria/cli/service_template_utils.py
+++ b/aria/cli/service_template_utils.py
@@ -19,11 +19,10 @@ from urlparse import urlparse
from . import csar
from . import utils
from .exceptions import AriaCliError
-from .constants import DEFAULT_SERVICE_TEMPLATE_FILENAME
from ..utils import archive as archive_utils
-def get(source, service_template_filename=DEFAULT_SERVICE_TEMPLATE_FILENAME):
+def get(source, service_template_filename):
"""Get a source and return a path to the main service template file
The behavior based on then source argument content is:
@@ -116,16 +115,16 @@ def _map_to_github_url(source):
return url
-def generate_id(service_template_path, service_template_filename=DEFAULT_SERVICE_TEMPLATE_FILENAME):
- """The name of the service template will be the name of the folder.
- If service_template_filename is provided, it will be appended to the folder.
- """
- service_template_id = os.path.split(os.path.dirname(os.path.abspath(
- service_template_path)))[-1]
- if service_template_filename != DEFAULT_SERVICE_TEMPLATE_FILENAME:
- filename, _ = os.path.splitext(os.path.basename(service_template_filename))
- service_template_id = (service_template_id + '.' + filename)
- return service_template_id.replace('_', '-')
+# def generate_id(service_template_path, service_template_filename=DEFAULT_SERVICE_TEMPLATE_FILENAME):
+# """The name of the service template will be the name of the folder.
+# If service_template_filename is provided, it will be appended to the folder.
+# """
+# service_template_id = os.path.split(os.path.dirname(os.path.abspath(
+# service_template_path)))[-1]
+# if service_template_filename != DEFAULT_SERVICE_TEMPLATE_FILENAME:
+# filename, _ = os.path.splitext(os.path.basename(service_template_filename))
+# service_template_id = (service_template_id + '.' + filename)
+# return service_template_id.replace('_', '-')
def _is_archive(source):