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/2ffefc49 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/2ffefc49 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/2ffefc49 Branch: refs/heads/ARIA-48-aria-cli Commit: 2ffefc498812a8c3f5c02e994d0333296ec2e180 Parents: 060f8cc Author: Ran Ziv <r...@gigaspaces.com> Authored: Sun Apr 2 17:53:13 2017 +0300 Committer: Ran Ziv <r...@gigaspaces.com> Committed: Tue Apr 4 13:20:46 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/2ffefc49/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/2ffefc49/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. "