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/03 20:28:16 UTC
incubator-ariatosca git commit: few deletion-commands related fixes
Repository: incubator-ariatosca
Updated Branches:
refs/heads/ARIA-48-aria-cli aa75638a2 -> 4c168db8e
few deletion-commands related fixes
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/4c168db8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/4c168db8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/4c168db8
Branch: refs/heads/ARIA-48-aria-cli
Commit: 4c168db8e5b239dfc6e32db7cb0cb80d29623aec
Parents: aa75638
Author: Ran Ziv <ra...@gigaspaces.com>
Authored: Mon Apr 3 23:28:11 2017 +0300
Committer: Ran Ziv <ra...@gigaspaces.com>
Committed: Mon Apr 3 23:28:11 2017 +0300
----------------------------------------------------------------------
aria/cli/commands/service_templates.py | 13 +++++++------
aria/cli/commands/services.py | 3 ++-
aria/core.py | 4 ++--
3 files changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4c168db8/aria/cli/commands/service_templates.py
----------------------------------------------------------------------
diff --git a/aria/cli/commands/service_templates.py b/aria/cli/commands/service_templates.py
index 6c6224b..a324131 100644
--- a/aria/cli/commands/service_templates.py
+++ b/aria/cli/commands/service_templates.py
@@ -126,23 +126,24 @@ def store(service_template_path, service_template_name, model_storage, resource_
@service_templates.command(name='delete',
short_help='Delete a service template')
-@aria.argument('service-template-id')
+@aria.argument('service-template-name')
@aria.options.verbose()
@aria.pass_model_storage
@aria.pass_resource_storage
@aria.pass_plugin_manager
@aria.pass_logger
-def delete(service_template_id, model_storage, resource_storage, plugin_manager, logger):
+def delete(service_template_name, model_storage, resource_storage, plugin_manager, logger):
"""Delete a service template
- `SERVICE_TEMPLATE_ID` is the id of the service template to delete.
+ `SERVICE_TEMPLATE_NAME` is the name of the service template to delete.
"""
- logger.info('Deleting service template {0}...'.format(service_template_id))
+ logger.info('Deleting service template {0}...'.format(service_template_name))
+ service_template = model_storage.service_template.get_by_name(service_template_name)
core = Core(model_storage, resource_storage, plugin_manager)
try:
- core.delete_service_template(service_template_id)
+ core.delete_service_template(service_template.id)
except storage_exceptions.NotFoundError:
raise AriaCliError()
- logger.info('Service template {0} deleted'.format(service_template_id))
+ logger.info('Service template {0} deleted'.format(service_template_name))
@service_templates.command(name='inputs',
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4c168db8/aria/cli/commands/services.py
----------------------------------------------------------------------
diff --git a/aria/cli/commands/services.py b/aria/cli/commands/services.py
index 9f9d104..e09db21 100644
--- a/aria/cli/commands/services.py
+++ b/aria/cli/commands/services.py
@@ -123,8 +123,9 @@ def delete(service_name, force, model_storage, resource_storage, plugin_manager,
`SERVICE_NAME` is the name of the service to delete.
"""
logger.info('Deleting service {0}...'.format(service_name))
+ service = model_storage.service.get_by_name(service_name)
core = Core(model_storage, resource_storage, plugin_manager)
- core.delete_service(service_name, force=force)
+ core.delete_service(service.id, force=force)
logger.info('Service {0} deleted'.format(service_name))
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4c168db8/aria/core.py
----------------------------------------------------------------------
diff --git a/aria/core.py b/aria/core.py
index a589a8e..1fd3cf7 100644
--- a/aria/core.py
+++ b/aria/core.py
@@ -88,11 +88,11 @@ class Core(object):
"Active execution id: {1}".format(service.name, active_executions[0].id))
if not force:
- available_nodes = [n for n in service.nodes.values() if n.is_available()]
+ available_nodes = [str(n.id) for n in service.nodes.values() if n.is_available()]
if available_nodes:
raise exceptions.DependentAvailableNodesError(
"Can't delete service {0} - there are available nodes for this service. "
- "Available node ids: {1}".format(service.name, available_nodes))
+ "Available node ids: {1}".format(service.name, ', '.join(available_nodes)))
self.model_storage.service.delete(service)