small fixes after rebase from master
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/0dacbafd Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/0dacbafd Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/0dacbafd Branch: refs/heads/ARIA-48-aria-cli Commit: 0dacbafd96ea19ddd360cdec6d07a1cd1ffc8019 Parents: fb6a8d9 Author: Ran Ziv <[email protected]> Authored: Sun Apr 2 17:53:13 2017 +0300 Committer: Ran Ziv <[email protected]> Committed: Thu Apr 6 11:29:17 2017 +0300 ---------------------------------------------------------------------- aria/cli/commands/node_templates.py | 2 +- aria/core.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0dacbafd/aria/cli/commands/node_templates.py ---------------------------------------------------------------------- diff --git a/aria/cli/commands/node_templates.py b/aria/cli/commands/node_templates.py index 5614aee..7365f0c 100644 --- a/aria/cli/commands/node_templates.py +++ b/aria/cli/commands/node_templates.py @@ -62,7 +62,7 @@ def show(node_template_id, model_storage, logger): logger.info('\tNo properties') # print node IDs - nodes = node_template.nodes.all() + nodes = node_template.nodes logger.info('Nodes:') if nodes: for node in nodes: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0dacbafd/aria/core.py ---------------------------------------------------------------------- diff --git a/aria/core.py b/aria/core.py index 96a967f..f2dfb09 100644 --- a/aria/core.py +++ b/aria/core.py @@ -61,7 +61,7 @@ class Core(object): def delete_service_template(self, service_template_id): service_template = self.model_storage.service_template.get(service_template_id) - if service_template.services.all(): + if service_template.services: raise exceptions.DependentServicesError( "Can't delete service template {0} - Service template has existing services") @@ -89,16 +89,14 @@ class Core(object): def delete_service(self, service_name, force=False): service = self.model_storage.service.get_by_name(service_name) - active_executions = [e for e in service.executions - if e.status not in models.Execution.ACTIVE_STATES] + active_executions = [e for e in service.executions if e.is_active()] if active_executions: raise exceptions.DependentActiveExecutionsError( "Can't delete service {0} - there is an active execution for this service. " "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.state not in ('deleted', 'errored')] + available_nodes = [n 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. "
