You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ariatosca.apache.org by ar...@apache.org on 2017/09/06 17:49:18 UTC
[69/70] incubator-ariatosca-website git commit: Adding Sphinx based
Docs minisite
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/commands/executions.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/commands/executions.py b/apache-ariatosca-0.1.1/aria/cli/commands/executions.py
deleted file mode 100644
index ea70af5..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/commands/executions.py
+++ /dev/null
@@ -1,250 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-CLI ``executions`` sub-commands.
-"""
-
-import os
-
-from .. import helptexts
-from .. import table
-from .. import utils
-from .. import logger as cli_logger
-from .. import execution_logging
-from ..core import aria
-from ...modeling.models import Execution
-from ...orchestrator.workflow_runner import WorkflowRunner
-from ...orchestrator.workflows.executor.dry import DryExecutor
-from ...utils import formatting
-from ...utils import threading
-
-EXECUTION_COLUMNS = ('id', 'workflow_name', 'status', 'service_name',
- 'created_at', 'error')
-
-
-@aria.group(name='executions')
-@aria.options.verbose()
-def executions():
- """
- Manage executions
- """
- pass
-
-
-@executions.command(name='show',
- short_help='Show information for an execution')
-@aria.argument('execution-id')
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def show(execution_id, model_storage, logger):
- """
- Show information for an execution
-
- EXECUTION_ID is the unique ID of the execution.
- """
- logger.info('Showing execution {0}'.format(execution_id))
- execution = model_storage.execution.get(execution_id)
-
- table.print_data(EXECUTION_COLUMNS, execution, 'Execution:', col_max_width=50)
-
- # print execution parameters
- logger.info('Execution Inputs:')
- if execution.inputs:
- #TODO check this section, havent tested it
- execution_inputs = [ei.to_dict() for ei in execution.inputs]
- for input_name, input_value in formatting.decode_dict(
- execution_inputs).iteritems():
- logger.info('\t{0}: \t{1}'.format(input_name, input_value))
- else:
- logger.info('\tNo inputs')
-
-
-@executions.command(name='list',
- short_help='List executions')
-@aria.options.service_name(required=False)
-@aria.options.sort_by()
-@aria.options.descending
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def list(service_name,
- sort_by,
- descending,
- model_storage,
- logger):
- """
- List executions
-
- If SERVICE_NAME is provided, list executions on that service. Otherwise, list executions on all
- services.
- """
- if service_name:
- logger.info('Listing executions for service {0}...'.format(
- service_name))
- service = model_storage.service.get_by_name(service_name)
- filters = dict(service=service)
- else:
- logger.info('Listing all executions...')
- filters = {}
-
- executions_list = model_storage.execution.list(
- filters=filters,
- sort=utils.storage_sort_param(sort_by, descending)).items
-
- table.print_data(EXECUTION_COLUMNS, executions_list, 'Executions:')
-
-
-@executions.command(name='start',
- short_help='Start a workflow on a service')
-@aria.argument('workflow-name')
-@aria.options.service_name(required=True)
-@aria.options.inputs(help=helptexts.EXECUTION_INPUTS)
-@aria.options.dry_execution
-@aria.options.task_max_attempts()
-@aria.options.task_retry_interval()
-@aria.options.mark_pattern()
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_resource_storage
-@aria.pass_plugin_manager
-@aria.pass_logger
-def start(workflow_name,
- service_name,
- inputs,
- dry,
- task_max_attempts,
- task_retry_interval,
- mark_pattern,
- model_storage,
- resource_storage,
- plugin_manager,
- logger):
- """
- Start a workflow on a service
-
- SERVICE_NAME is the unique name of the service.
-
- WORKFLOW_NAME is the unique name of the workflow within the service (e.g. "uninstall").
- """
- service = model_storage.service.get_by_name(service_name)
- executor = DryExecutor() if dry else None # use WorkflowRunner's default executor
-
- workflow_runner = \
- WorkflowRunner(
- model_storage, resource_storage, plugin_manager,
- service_id=service.id, workflow_name=workflow_name, inputs=inputs, executor=executor,
- task_max_attempts=task_max_attempts, task_retry_interval=task_retry_interval
- )
- logger.info('Starting {0}execution. Press Ctrl+C cancel'.format('dry ' if dry else ''))
-
- _run_execution(workflow_runner, logger, model_storage, dry, mark_pattern)
-
-
-@executions.command(name='resume',
- short_help='Resume a stopped execution')
-@aria.argument('execution-id')
-@aria.options.inputs(help=helptexts.EXECUTION_INPUTS)
-@aria.options.dry_execution
-@aria.options.task_max_attempts()
-@aria.options.task_retry_interval()
-@aria.options.mark_pattern()
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_resource_storage
-@aria.pass_plugin_manager
-@aria.pass_logger
-def resume(execution_id,
- dry,
- task_max_attempts,
- task_retry_interval,
- mark_pattern,
- model_storage,
- resource_storage,
- plugin_manager,
- logger):
- """
- Resume a stopped execution
-
- EXECUTION_ID is the unique ID of the execution.
- """
- executor = DryExecutor() if dry else None # use WorkflowRunner's default executor
-
- execution = model_storage.execution.get(execution_id)
- if execution.status != execution.status.CANCELLED:
- logger.info("Can't resume execution {execution.id} - "
- "execution is in status {execution.status}. "
- "Can only resume executions in status {valid_status}"
- .format(execution=execution, valid_status=execution.status.CANCELLED))
- return
-
- workflow_runner = \
- WorkflowRunner(
- model_storage, resource_storage, plugin_manager,
- execution_id=execution_id, executor=executor,
- task_max_attempts=task_max_attempts, task_retry_interval=task_retry_interval
- )
-
- logger.info('Resuming {0}execution. Press Ctrl+C cancel'.format('dry ' if dry else ''))
- _run_execution(workflow_runner, logger, model_storage, dry, mark_pattern)
-
-
-def _run_execution(workflow_runner, logger, model_storage, dry, mark_pattern):
- execution_thread_name = '{0}_{1}'.format(workflow_runner.service.name,
- workflow_runner.execution.workflow_name)
- execution_thread = threading.ExceptionThread(target=workflow_runner.execute,
- name=execution_thread_name)
-
- execution_thread.start()
-
- last_task_id = workflow_runner.execution.logs[-1].id if workflow_runner.execution.logs else 0
- log_iterator = cli_logger.ModelLogIterator(model_storage,
- workflow_runner.execution_id,
- offset=last_task_id)
- try:
- while execution_thread.is_alive():
- execution_logging.log_list(log_iterator, mark_pattern=mark_pattern)
- execution_thread.join(1)
-
- except KeyboardInterrupt:
- _cancel_execution(workflow_runner, execution_thread, logger, log_iterator)
-
- # It might be the case where some logs were written and the execution was terminated, thus we
- # need to drain the remaining logs.
- execution_logging.log_list(log_iterator, mark_pattern=mark_pattern)
-
- # raise any errors from the execution thread (note these are not workflow execution errors)
- execution_thread.raise_error_if_exists()
-
- execution = workflow_runner.execution
- logger.info('Execution has ended with "{0}" status'.format(execution.status))
- if execution.status == Execution.FAILED and execution.error:
- logger.info('Execution error:{0}{1}'.format(os.linesep, execution.error))
-
- if dry:
- # remove traces of the dry execution (including tasks, logs, inputs..)
- model_storage.execution.delete(execution)
-
-
-def _cancel_execution(workflow_runner, execution_thread, logger, log_iterator):
- logger.info('Cancelling execution. Press Ctrl+C again to force-cancel.')
- workflow_runner.cancel()
- while execution_thread.is_alive():
- try:
- execution_logging.log_list(log_iterator)
- execution_thread.join(1)
- except KeyboardInterrupt:
- pass
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/commands/logs.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/commands/logs.py b/apache-ariatosca-0.1.1/aria/cli/commands/logs.py
deleted file mode 100644
index b751b97..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/commands/logs.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-CLI ``logs`` sub-commands.
-"""
-
-from .. import execution_logging
-from ..logger import ModelLogIterator
-from ..core import aria
-
-
-@aria.group(name='logs')
-@aria.options.verbose()
-def logs():
- """
- Manage logs of workflow executions
- """
- pass
-
-
-@logs.command(name='list',
- short_help='List logs for an execution')
-@aria.argument('execution-id')
-@aria.options.verbose()
-@aria.options.mark_pattern()
-@aria.pass_model_storage
-@aria.pass_logger
-def list(execution_id, mark_pattern, model_storage, logger):
- """
- List logs for an execution
-
- EXECUTION_ID is the unique ID of the execution.
- """
- logger.info('Listing logs for execution id {0}'.format(execution_id))
- log_iterator = ModelLogIterator(model_storage, execution_id)
-
- any_logs = execution_logging.log_list(log_iterator, mark_pattern=mark_pattern)
-
- if not any_logs:
- logger.info('\tNo logs')
-
-
-@logs.command(name='delete',
- short_help='Delete logs of an execution')
-@aria.argument('execution-id')
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def delete(execution_id, model_storage, logger):
- """
- Delete logs of an execution
-
- EXECUTION_ID is the unique ID of the execution.
- """
- logger.info('Deleting logs for execution id {0}'.format(execution_id))
- logs_list = model_storage.log.list(filters=dict(execution_fk=execution_id))
- for log in logs_list:
- model_storage.log.delete(log)
- logger.info('Deleted logs for execution id {0}'.format(execution_id))
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/commands/node_templates.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/commands/node_templates.py b/apache-ariatosca-0.1.1/aria/cli/commands/node_templates.py
deleted file mode 100644
index ec160d2..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/commands/node_templates.py
+++ /dev/null
@@ -1,100 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-CLI ``node-templates`` sub-commands.
-"""
-
-from .. import table
-from .. import utils
-from ..core import aria
-
-
-NODE_TEMPLATE_COLUMNS = ['id', 'name', 'description', 'service_template_name', 'type_name']
-
-
-@aria.group(name='node-templates')
-@aria.options.verbose()
-def node_templates():
- """
- Manages stored service templates' node templates
- """
- pass
-
-
-@node_templates.command(name='show',
- short_help='Show information for a stored node template')
-@aria.argument('node-template-id')
-# @aria.options.service_template_name(required=True)
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def show(node_template_id, model_storage, logger):
- """
- Show information for a stored node template
-
- NODE_TEMPLATE_ID is the unique node template ID.
- """
- logger.info('Showing node template {0}'.format(node_template_id))
- node_template = model_storage.node_template.get(node_template_id)
-
- table.print_data(NODE_TEMPLATE_COLUMNS, node_template, 'Node template:', col_max_width=50)
-
- # print node template properties
- logger.info('Node template properties:')
- if node_template.properties:
- logger.info(utils.get_parameter_templates_as_string(node_template.properties))
- else:
- logger.info('\tNo properties')
-
- # print node IDs
- nodes = node_template.nodes
- logger.info('Nodes:')
- if nodes:
- for node in nodes:
- logger.info('\t{0}'.format(node.name))
- else:
- logger.info('\tNo nodes')
-
-
-@node_templates.command(name='list',
- short_help='List stored node templates')
-@aria.options.service_template_name()
-@aria.options.sort_by('service_template_name')
-@aria.options.descending
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def list(service_template_name, sort_by, descending, model_storage, logger):
- """
- List stored node templates
-
- If SERVICE_TEMPLATE_NAME is provided, list node templates for that stored service template.
- Otherwise, list node templates for all service templates.
- """
- if service_template_name:
- logger.info('Listing node templates for service template {0}...'.format(
- service_template_name))
- service_template = model_storage.service_template.get_by_name(service_template_name)
- filters = dict(service_template=service_template)
- else:
- logger.info('Listing all node templates...')
- filters = {}
-
- node_templates_list = model_storage.node_template.list(
- filters=filters,
- sort=utils.storage_sort_param(sort_by, descending))
-
- table.print_data(NODE_TEMPLATE_COLUMNS, node_templates_list, 'Node templates:')
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/commands/nodes.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/commands/nodes.py b/apache-ariatosca-0.1.1/aria/cli/commands/nodes.py
deleted file mode 100644
index 30f1dd4..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/commands/nodes.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-CLI ``nodes`` sub-commands.
-"""
-
-from .. import table
-from .. import utils
-from ..core import aria
-
-
-NODE_COLUMNS = ['id', 'name', 'service_name', 'node_template_name', 'state']
-
-
-@aria.group(name='nodes')
-@aria.options.verbose()
-def nodes():
- """
- Manage services' nodes
- """
- pass
-
-
-@nodes.command(name='show',
- short_help='Show information for a node')
-@aria.argument('node_id')
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def show(node_id, model_storage, logger):
- """
- Show information for a node
-
- NODE_ID is the unique node ID.
- """
- logger.info('Showing node {0}'.format(node_id))
- node = model_storage.node.get(node_id)
-
- table.print_data(NODE_COLUMNS, node, 'Node:', col_max_width=50)
-
- # print node attributes
- logger.info('Node attributes:')
- if node.attributes:
- for param_name, param in node.attributes.iteritems():
- logger.info('\t{0}: {1}'.format(param_name, param.value))
- else:
- logger.info('\tNo attributes')
-
-
-@nodes.command(name='list',
- short_help='List node')
-@aria.options.service_name(required=False)
-@aria.options.sort_by('service_name')
-@aria.options.descending
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def list(service_name,
- sort_by,
- descending,
- model_storage,
- logger):
- """
- List nodes
-
- If SERVICE_NAME is provided, list nodes for that service. Otherwise, list nodes for all
- services.
- """
- if service_name:
- logger.info('Listing nodes for service {0}...'.format(service_name))
- service = model_storage.service.get_by_name(service_name)
- filters = dict(service=service)
- else:
- logger.info('Listing all nodes...')
- filters = {}
-
- nodes_list = model_storage.node.list(
- filters=filters,
- sort=utils.storage_sort_param(sort_by, descending))
-
- table.print_data(NODE_COLUMNS, nodes_list, 'Nodes:')
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/commands/plugins.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/commands/plugins.py b/apache-ariatosca-0.1.1/aria/cli/commands/plugins.py
deleted file mode 100644
index b5d68a2..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/commands/plugins.py
+++ /dev/null
@@ -1,111 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-CLI ``plugins`` sub-commands.
-"""
-
-from .. import table
-from .. import utils
-from ..core import aria
-
-
-PLUGIN_COLUMNS = ['id', 'package_name', 'package_version', 'supported_platform',
- 'distribution', 'distribution_release', 'uploaded_at']
-
-
-@aria.group(name='plugins')
-@aria.options.verbose()
-def plugins():
- """
- Manage plugins
- """
- pass
-
-
-@plugins.command(name='validate',
- short_help='Validate a plugin archive')
-@aria.argument('plugin-path')
-@aria.options.verbose()
-@aria.pass_plugin_manager
-@aria.pass_logger
-def validate(plugin_path, plugin_manager, logger):
- """
- Validate a plugin archive
-
- A valid plugin is a wagon (`http://github.com/cloudify-cosmo/wagon`) in the ZIP format (suffix
- may also be `.wgn`).
-
- PLUGIN_PATH is the path to the wagon archive.
- """
- logger.info('Validating plugin {0}...'.format(plugin_path))
- plugin_manager.validate_plugin(plugin_path)
- logger.info('Plugin validated successfully')
-
-
-@plugins.command(name='install',
- short_help='Install a plugin')
-@aria.argument('plugin-path')
-@aria.options.verbose()
-@aria.pass_context
-@aria.pass_plugin_manager
-@aria.pass_logger
-def install(ctx, plugin_path, plugin_manager, logger):
- """
- Install a plugin
-
- A valid plugin is a wagon (`http://github.com/cloudify-cosmo/wagon`) in the ZIP format (suffix
- may also be `.wgn`).
-
- PLUGIN_PATH is the path to the wagon archive.
- """
- ctx.invoke(validate, plugin_path=plugin_path)
- logger.info('Installing plugin {0}...'.format(plugin_path))
- plugin = plugin_manager.install(plugin_path)
- logger.info("Plugin installed. The plugin's id is {0}".format(plugin.id))
-
-
-@plugins.command(name='show',
- short_help='Show information for an installed plugin')
-@aria.argument('plugin-id')
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def show(plugin_id, model_storage, logger):
- """
- Show information for an installed plugin
-
- PLUGIN_ID is the unique installed plugin ID in this ARIA instance.
- """
- logger.info('Showing plugin {0}...'.format(plugin_id))
- plugin = model_storage.plugin.get(plugin_id)
- table.print_data(PLUGIN_COLUMNS, plugin, 'Plugin:')
-
-
-@plugins.command(name='list',
- short_help='List all installed plugins')
-@aria.options.sort_by('uploaded_at')
-@aria.options.descending
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def list(sort_by, descending, model_storage, logger):
- """
- List all installed plugins
- """
- logger.info('Listing all plugins...')
- plugins_list = model_storage.plugin.list(
- sort=utils.storage_sort_param(sort_by, descending)).items
- table.print_data(PLUGIN_COLUMNS, plugins_list, 'Plugins:')
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/commands/reset.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/commands/reset.py b/apache-ariatosca-0.1.1/aria/cli/commands/reset.py
deleted file mode 100644
index c82c707..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/commands/reset.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-CLI ``reset`` command.
-"""
-
-from .. import helptexts
-from ..core import aria
-from ..env import env
-from ..exceptions import AriaCliError
-
-
-@aria.command(name='reset',
- short_help="Reset ARIA working directory")
-@aria.options.force(help=helptexts.FORCE_RESET)
-@aria.options.reset_config
-@aria.pass_logger
-@aria.options.verbose()
-def reset(force, reset_config, logger):
- """
- Reset ARIA working directory
-
- Deletes installed plugins, service templates, services, executions, and logs. The user
- configuration will remain intact unless the `--reset_config` flag has been set as well, in
- which case the entire ARIA working directory shall be removed.
- """
- if not force:
- raise AriaCliError("To reset the ARIA's working directory, you must also provide the force"
- " flag ('-f'/'--force').")
-
- env.reset(reset_config=reset_config)
- logger.info("ARIA's working directory has been reset")
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/commands/service_templates.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/commands/service_templates.py b/apache-ariatosca-0.1.1/aria/cli/commands/service_templates.py
deleted file mode 100644
index f567aa8..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/commands/service_templates.py
+++ /dev/null
@@ -1,245 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-CLI ``service-templates`` sub-commands.
-"""
-
-import os
-
-from .. import csar
-from .. import service_template_utils
-from .. import table
-from .. import utils
-from ..core import aria
-from ...core import Core
-from ...storage import exceptions as storage_exceptions
-from ...parser import consumption
-from ...utils import (formatting, collections, console)
-
-
-DESCRIPTION_FIELD_LENGTH_LIMIT = 20
-SERVICE_TEMPLATE_COLUMNS = \
- ('id', 'name', 'description', 'main_file_name', 'created_at', 'updated_at')
-
-
-@aria.group(name='service-templates')
-@aria.options.verbose()
-def service_templates():
- """
- Manage service templates
- """
- pass
-
-
-@service_templates.command(name='show',
- short_help='Show information for a stored service template')
-@aria.argument('service-template-name')
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.options.service_template_mode_full
-@aria.options.mode_types
-@aria.options.format_json
-@aria.options.format_yaml
-@aria.pass_logger
-def show(service_template_name, model_storage, mode_full, mode_types, format_json, format_yaml,
- logger):
- """
- Show information for a stored service template
-
- SERVICE_TEMPLATE_NAME is the unique name of the stored service template.
- """
- service_template = model_storage.service_template.get_by_name(service_template_name)
-
- if format_json or format_yaml:
- mode_full = True
-
- if mode_full:
- consumption.ConsumptionContext()
- if format_json:
- console.puts(formatting.json_dumps(collections.prune(service_template.as_raw)))
- elif format_yaml:
- console.puts(formatting.yaml_dumps(collections.prune(service_template.as_raw)))
- else:
- service_template.dump()
- elif mode_types:
- consumption.ConsumptionContext()
- service_template.dump_types()
- else:
- logger.info('Showing service template {0}...'.format(service_template_name))
- service_template_dict = service_template.to_dict()
- service_template_dict['#services'] = len(service_template.services)
- columns = SERVICE_TEMPLATE_COLUMNS + ('#services',)
- column_formatters = \
- dict(description=table.trim_formatter_generator(DESCRIPTION_FIELD_LENGTH_LIMIT))
- table.print_data(columns, service_template_dict, 'Service-template:',
- column_formatters=column_formatters, col_max_width=50)
-
- if service_template_dict['description'] is not None:
- logger.info('Description:')
- logger.info('{0}{1}'.format(service_template_dict['description'].encode('UTF-8') or '',
- os.linesep))
-
- if service_template.services:
- logger.info('Existing services:')
- for service_name in service_template.services:
- logger.info('\t{0}'.format(service_name))
-
-
-@service_templates.command(name='list',
- short_help='List all stored service templates')
-@aria.options.sort_by()
-@aria.options.descending
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def list(sort_by, descending, model_storage, logger):
- """
- List all stored service templates
- """
-
- logger.info('Listing all service templates...')
- service_templates_list = model_storage.service_template.list(
- sort=utils.storage_sort_param(sort_by, descending))
-
- column_formatters = \
- dict(description=table.trim_formatter_generator(DESCRIPTION_FIELD_LENGTH_LIMIT))
- table.print_data(SERVICE_TEMPLATE_COLUMNS, service_templates_list, 'Service templates:',
- column_formatters=column_formatters)
-
-
-@service_templates.command(name='store',
- short_help='Parse and store a service template archive')
-@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, service_template_filename,
- model_storage, resource_storage, plugin_manager, logger):
- """
- Parse and store a service template archive
-
- SERVICE_TEMPLATE_PATH is the path to the service template archive.
-
- SERVICE_TEMPLATE_NAME is the unique name to give to the service template in storage.
- """
- logger.info('Storing service template {0}...'.format(service_template_name))
-
- 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,
- os.path.dirname(service_template_path),
- service_template_name)
- except storage_exceptions.StorageError as e:
- utils.check_overriding_storage_exceptions(e, 'service template', service_template_name)
- raise
- logger.info('Service template {0} stored'.format(service_template_name))
-
-
-@service_templates.command(name='delete',
- short_help='Delete a stored service template')
-@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_name, model_storage, resource_storage, plugin_manager, logger):
- """
- Delete a stored service template
-
- SERVICE_TEMPLATE_NAME is the unique name of the stored service template.
- """
- 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)
- core.delete_service_template(service_template.id)
- logger.info('Service template {0} deleted'.format(service_template_name))
-
-
-@service_templates.command(name='inputs',
- short_help='Show stored service template inputs')
-@aria.argument('service-template-name')
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def inputs(service_template_name, model_storage, logger):
- """
- Show stored service template inputs
-
- SERVICE_TEMPLATE_NAME is the unique name of the stored service template.
- """
- logger.info('Showing inputs for service template {0}...'.format(service_template_name))
- print_service_template_inputs(model_storage, service_template_name, logger)
-
-
-@service_templates.command(name='validate',
- short_help='Validate a service template archive')
-@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, service_template_filename,
- model_storage, resource_storage, plugin_manager, logger):
- """
- Validate a service template archive
-
- SERVICE_TEMPLATE_PATH is the path to the service template archive.
- """
- logger.info('Validating service template: {0}'.format(service_template))
- service_template_path = service_template_utils.get(service_template, service_template_filename)
- core = Core(model_storage, resource_storage, plugin_manager)
- core.validate_service_template(service_template_path)
- logger.info('Service template validated successfully')
-
-
-@service_templates.command(name='create-archive',
- short_help='Create a CSAR archive from a service template source')
-@aria.argument('service-template-path')
-@aria.argument('destination')
-@aria.options.verbose()
-@aria.pass_logger
-def create_archive(service_template_path, destination, logger):
- """
- Create a CSAR archive from a service template source
-
- SERVICE_TEMPLATE_PATH is the path to the service template source.
-
- DESTINATION is the path to the created CSAR archive.
- """
- logger.info('Creating a CSAR archive')
- if not destination.endswith(csar.CSAR_FILE_EXTENSION):
- destination += csar.CSAR_FILE_EXTENSION
- csar.write(service_template_path, destination, logger)
- logger.info('CSAR archive created at {0}'.format(destination))
-
-
-def print_service_template_inputs(model_storage, service_template_name, logger):
- service_template = model_storage.service_template.get_by_name(service_template_name)
-
- logger.info('Service template inputs:')
- if service_template.inputs:
- logger.info(utils.get_parameter_templates_as_string(service_template.inputs))
- else:
- logger.info('\tNo inputs')
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/commands/services.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/commands/services.py b/apache-ariatosca-0.1.1/aria/cli/commands/services.py
deleted file mode 100644
index a99f5b3..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/commands/services.py
+++ /dev/null
@@ -1,238 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-CLI ``services`` sub-commands.
-"""
-
-import os
-from StringIO import StringIO
-
-from . import service_templates
-from .. import helptexts
-from .. import table
-from .. import utils
-from ..core import aria
-from ...core import Core
-from ...modeling import exceptions as modeling_exceptions
-from ...storage import exceptions as storage_exceptions
-from ...parser import consumption
-from ...utils import (formatting, collections, console)
-
-
-DESCRIPTION_FIELD_LENGTH_LIMIT = 20
-SERVICE_COLUMNS = ('id', 'name', 'description', 'service_template_name', 'created_at', 'updated_at')
-
-
-@aria.group(name='services')
-@aria.options.verbose()
-def services():
- """
- Manage services
- """
- pass
-
-
-@services.command(name='show',
- short_help='Show information for a service')
-@aria.argument('service-name')
-@aria.options.verbose()
-@aria.options.service_mode_full
-@aria.options.mode_graph
-@aria.options.format_json
-@aria.options.format_yaml
-@aria.pass_model_storage
-@aria.pass_logger
-def show(service_name, model_storage, mode_full, mode_graph, format_json, format_yaml, logger):
- """
- Show information for a service
-
- SERVICE_NAME is the unique name of the service.
- """
- service = model_storage.service.get_by_name(service_name)
-
- if format_json or format_yaml:
- mode_full = True
-
- if mode_full:
- consumption.ConsumptionContext()
- if format_json:
- console.puts(formatting.json_dumps(collections.prune(service.as_raw)))
- elif format_yaml:
- console.puts(formatting.yaml_dumps(collections.prune(service.as_raw)))
- else:
- service.dump()
- elif mode_graph:
- consumption.ConsumptionContext()
- service.dump_graph()
- else:
- logger.info('Showing service {0}...'.format(service_name))
- service_dict = service.to_dict()
- columns = SERVICE_COLUMNS
- column_formatters = \
- dict(description=table.trim_formatter_generator(DESCRIPTION_FIELD_LENGTH_LIMIT))
- table.print_data(columns, service_dict, 'Service:',
- column_formatters=column_formatters, col_max_width=50)
-
- if service_dict['description'] is not None:
- logger.info('Description:')
- logger.info('{0}{1}'.format(service_dict['description'].encode('UTF-8') or '',
- os.linesep))
-
-
-@services.command(name='list', short_help='List services')
-@aria.options.service_template_name()
-@aria.options.sort_by()
-@aria.options.descending
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def list(service_template_name,
- sort_by,
- descending,
- model_storage,
- logger):
- """
- List services
-
- If `--service-template-name` is provided, list services based on that service template.
- Otherwise, list all services.
- """
- if service_template_name:
- logger.info('Listing services for service template {0}...'.format(
- service_template_name))
- service_template = model_storage.service_template.get_by_name(service_template_name)
- filters = dict(service_template=service_template)
- else:
- logger.info('Listing all services...')
- filters = {}
-
- services_list = model_storage.service.list(
- sort=utils.storage_sort_param(sort_by=sort_by, descending=descending),
- filters=filters)
- table.print_data(SERVICE_COLUMNS, services_list, 'Services:')
-
-
-@services.command(name='create',
- short_help='Create a service')
-@aria.argument('service-name', required=False)
-@aria.options.service_template_name(required=True)
-@aria.options.inputs(help=helptexts.SERVICE_INPUTS)
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_resource_storage
-@aria.pass_plugin_manager
-@aria.pass_logger
-def create(service_template_name,
- service_name,
- inputs, # pylint: disable=redefined-outer-name
- model_storage,
- resource_storage,
- plugin_manager,
- logger):
- """
- Create a service
-
- SERVICE_NAME is the unique name to give to the service.
- """
- logger.info('Creating new service from service template {0}...'.format(
- service_template_name))
- core = Core(model_storage, resource_storage, plugin_manager)
- service_template = model_storage.service_template.get_by_name(service_template_name)
-
- try:
- service = core.create_service(service_template.id, inputs, service_name)
- except storage_exceptions.StorageError as e:
- utils.check_overriding_storage_exceptions(e, 'service', service_name)
- raise
- except modeling_exceptions.ParameterException:
- service_templates.print_service_template_inputs(model_storage, service_template_name,
- logger)
- raise
- logger.info("Service created. The service's name is {0}".format(service.name))
-
-
-@services.command(name='delete',
- short_help='Delete a service')
-@aria.argument('service-name')
-@aria.options.force(help=helptexts.IGNORE_AVAILABLE_NODES)
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_resource_storage
-@aria.pass_plugin_manager
-@aria.pass_logger
-def delete(service_name, force, model_storage, resource_storage, plugin_manager, logger):
- """
- Delete a service
-
- SERVICE_NAME is the unique name of the service.
- """
- 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.id, force=force)
- logger.info('Service {0} deleted'.format(service_name))
-
-
-@services.command(name='outputs',
- short_help='Show service outputs')
-@aria.argument('service-name')
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def outputs(service_name, model_storage, logger):
- """
- Show service outputs
-
- SERVICE_NAME is the unique name of the service.
- """
- logger.info('Showing outputs for service {0}...'.format(service_name))
- service = model_storage.service.get_by_name(service_name)
-
- if service.outputs:
- outputs_string = StringIO()
- for output_name, output in service.outputs.iteritems():
- outputs_string.write(' - "{0}":{1}'.format(output_name, os.linesep))
- outputs_string.write(' Description: {0}{1}'.format(output.description, os.linesep))
- outputs_string.write(' Value: {0}{1}'.format(output.value, os.linesep))
- logger.info(outputs_string.getvalue())
- else:
- logger.info('\tNo outputs')
-
-
-@services.command(name='inputs',
- short_help='Show service inputs')
-@aria.argument('service-name')
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def inputs(service_name, model_storage, logger):
- """
- Show service inputs
-
- SERVICE_NAME is the unique name of the service.
- """
- logger.info('Showing inputs for service {0}...'.format(service_name))
- service = model_storage.service.get_by_name(service_name)
-
- if service.inputs:
- inputs_string = StringIO()
- for input_name, input_ in service.inputs.iteritems():
- inputs_string.write(' - "{0}":{1}'.format(input_name, os.linesep))
- inputs_string.write(' Description: {0}{1}'.format(input_.description, os.linesep))
- inputs_string.write(' Value: {0}{1}'.format(input_.value, os.linesep))
- logger.info(inputs_string.getvalue())
- else:
- logger.info('\tNo inputs')
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/commands/workflows.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/commands/workflows.py b/apache-ariatosca-0.1.1/aria/cli/commands/workflows.py
deleted file mode 100644
index 03cf00e..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/commands/workflows.py
+++ /dev/null
@@ -1,111 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-CLI ``worfklows`` sub-commands.
-"""
-
-from .. import table
-from ..core import aria
-from ..exceptions import AriaCliError
-
-WORKFLOW_COLUMNS = ['name', 'service_template_name', 'service_name']
-
-
-@aria.group(name='workflows')
-def workflows():
- """
- Manage service workflows
- """
- pass
-
-
-@workflows.command(name='show',
- short_help='Show information for a service workflow')
-@aria.argument('workflow-name')
-@aria.options.service_name(required=True)
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def show(workflow_name, service_name, model_storage, logger):
- """
- Show information for a service workflow
-
- SERVICE_NAME is the unique name of the service.
-
- WORKFLOW_NAME is the unique name of the workflow within the service (e.g. "uninstall").
- """
- logger.info('Retrieving workflow {0} for service {1}'.format(
- workflow_name, service_name))
- service = model_storage.service.get_by_name(service_name)
- workflow = next((wf for wf in service.workflows.values() if
- wf.name == workflow_name), None)
- if not workflow:
- raise AriaCliError(
- 'Workflow {0} not found for service {1}'.format(workflow_name, service_name))
-
- defaults = {
- 'service_template_name': service.service_template_name,
- 'service_name': service.name
- }
- table.print_data(WORKFLOW_COLUMNS, workflow, 'Workflows:', defaults=defaults)
-
- # print workflow inputs
- required_inputs = dict()
- optional_inputs = dict()
- for input_name, input in workflow.inputs.iteritems():
- inputs_group = optional_inputs if input.value is not None else required_inputs
- inputs_group[input_name] = input
-
- logger.info('Workflow Inputs:')
- logger.info('\tMandatory Inputs:')
- for input_name, input in required_inputs.iteritems():
- if input.description is not None:
- logger.info('\t\t{0}\t({1})'.format(input_name,
- input.description))
- else:
- logger.info('\t\t{0}'.format(input_name))
-
- logger.info('\tOptional Inputs:')
- for input_name, input in optional_inputs.iteritems():
- if input.description is not None:
- logger.info('\t\t{0}: \t{1}\t({2})'.format(
- input_name, input.value, input.description))
- else:
- logger.info('\t\t{0}: \t{1}'.format(input_name,
- input.value))
-
-
-@workflows.command(name='list',
- short_help='List service workflows')
-@aria.options.service_name(required=True)
-@aria.options.verbose()
-@aria.pass_model_storage
-@aria.pass_logger
-def list(service_name, model_storage, logger):
- """
- List service workflows
-
- SERVICE_NAME is the unique name of the service.
- """
- logger.info('Listing workflows for service {0}...'.format(service_name))
- service = model_storage.service.get_by_name(service_name)
- workflows_list = sorted(service.workflows.values(), key=lambda w: w.name)
-
- defaults = {
- 'service_template_name': service.service_template_name,
- 'service_name': service.name
- }
- table.print_data(WORKFLOW_COLUMNS, workflows_list, 'Workflows:', defaults=defaults)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/config/config.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/config/config.py b/apache-ariatosca-0.1.1/aria/cli/config/config.py
deleted file mode 100644
index bbece80..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/config/config.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-CLI configuration mechanism.
-"""
-
-import os
-import pkg_resources
-from ruamel import yaml
-
-from jinja2.environment import Template
-
-
-CONFIG_FILE_NAME = 'config.yaml'
-
-
-class CliConfig(object):
-
- def __init__(self, config_path):
- with open(config_path) as f:
- self._config = yaml.safe_load(f.read())
-
- @classmethod
- def create_config(cls, workdir):
- config_path = os.path.join(workdir, CONFIG_FILE_NAME)
- if not os.path.isfile(config_path):
- config_template = pkg_resources.resource_string(
- __package__,
- 'config_template.yaml')
-
- default_values = {
- 'log_path': os.path.join(workdir, 'cli.log'),
- 'enable_colors': True
- }
-
- template = Template(config_template)
- rendered = template.render(**default_values)
- with open(config_path, 'w') as f:
- f.write(rendered)
- f.write(os.linesep)
-
- return cls(config_path)
-
- @property
- def logging(self):
- return self.Logging(self._config.get('logging'))
-
- class Logging(object):
-
- def __init__(self, logging):
- self._logging = logging or {}
-
- @property
- def filename(self):
- return self._logging.get('filename')
-
- @property
- def loggers(self):
- return self._logging.get('loggers', {})
-
- @property
- def execution(self):
- return self.Execution(self._logging.get('execution'))
-
- class Execution(object):
-
- def __init__(self, execution_logging):
- self._execution_logging = execution_logging
-
- @property
- def colors_enabled(self):
- return self.colors.get('enabled', False)
-
- @property
- def colors(self):
- return self._execution_logging.get('colors', {})
-
- @property
- def formats(self):
- return self._execution_logging.get('formats', {})
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/config/config_template.yaml
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/config/config_template.yaml b/apache-ariatosca-0.1.1/aria/cli/config/config_template.yaml
deleted file mode 100644
index 94fcac3..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/config/config_template.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-logging:
-
- # path to a file where cli logs will be saved.
- filename: {{ log_path }}
-
- # configuring level per logger
- loggers:
-
- # main logger of the cli. provides basic descriptions for executed operations.
- aria.cli.main: info
-
- execution:
- formats:
- # According to verbosity level 0 - no verbose. 3 - high verbose
- 0: '{message}'
- 1: '{timestamp:%H:%M:%S} | {level[0]} | {message}'
- 2: '{timestamp:%H:%M:%S} | {level[0]} | {implementation} | {message}'
- 3: '{timestamp:%H:%M:%S} | {level[0]} | {implementation} | {inputs} | {message}'
-
- colors:
- enabled: true
-
- level:
- default: {'fore': 'lightmagenta_ex'}
- error: {'fore': 'red', 'style': 'bright'}
- timestamp:
- default: {'fore': 'lightmagenta_ex'}
- error: {'fore': 'red', 'style': 'bright'}
- message:
- default: {'fore': 'lightblue_ex'}
- error: {'fore': 'red', 'style': 'bright'}
- implementation:
- default: {'fore': 'lightblack_ex'}
- error: {'fore': 'red', 'style': 'bright'}
- inputs:
- default: {'fore': 'blue'}
- error: {'fore': 'red', 'style': 'bright'}
- traceback:
- default: {'fore': 'red'}
-
- marker: 'lightyellow_ex'
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/core/aria.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/core/aria.py b/apache-ariatosca-0.1.1/aria/cli/core/aria.py
deleted file mode 100644
index 515c06a..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/core/aria.py
+++ /dev/null
@@ -1,501 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-Enhancements and ARIA-specific conveniences for `Click <http://click.pocoo.org>`__.
-"""
-
-import os
-import sys
-import difflib
-import traceback
-import inspect
-from functools import wraps
-
-import click
-
-from ..env import (
- env,
- logger
-)
-from .. import defaults
-from .. import helptexts
-from ..ascii_art import ARIA_ASCII_ART
-from ..inputs import inputs_to_dict
-from ... import __version__
-from ...utils.exceptions import get_exception_as_string
-
-
-CLICK_CONTEXT_SETTINGS = dict(
- help_option_names=['-h', '--help'],
- token_normalize_func=lambda param: param.lower())
-
-
-class MutuallyExclusiveOption(click.Option):
- def __init__(self, *args, **kwargs):
- self.mutually_exclusive = set(kwargs.pop('mutually_exclusive', tuple()))
- self.mutuality_description = kwargs.pop('mutuality_description',
- ', '.join(self.mutually_exclusive))
- self.mutuality_error = kwargs.pop('mutuality_error',
- helptexts.DEFAULT_MUTUALITY_ERROR_MESSAGE)
- if self.mutually_exclusive:
- help = kwargs.get('help', '')
- kwargs['help'] = '{0}. {1}'.format(help, self._message)
- super(MutuallyExclusiveOption, self).__init__(*args, **kwargs)
-
- def handle_parse_result(self, ctx, opts, args):
- if (self.name in opts) and self.mutually_exclusive.intersection(opts):
- raise click.UsageError('Illegal usage: {0}'.format(self._message))
- return super(MutuallyExclusiveOption, self).handle_parse_result(ctx, opts, args)
-
- @property
- def _message(self):
- return '{0} be used together with {1} ({2}).'.format(
- '{0} cannot'.format(', '.join(self.opts)) if hasattr(self, 'opts') else 'Cannot',
- self.mutuality_description,
- self.mutuality_error)
-
-
-def mutually_exclusive_option(*param_decls, **attrs):
- """
- Decorator for mutually exclusive options.
-
- This decorator works similarly to `click.option`, but supports an extra ``mutually_exclusive``
- argument, which is a list of argument names with which the option is mutually exclusive.
-
- You can optionally also supply ``mutuality_description`` and ``mutuality_error`` to override the
- default messages.
-
- NOTE: All mutually exclusive options must use this. It's not enough to use it in just one of the
- options.
- """
-
- # NOTE: This code is copied and slightly modified from click.decorators.option and
- # click.decorators._param_memo. Unfortunately, using click's ``cls`` parameter support does not
- # work as is with extra decorator arguments.
-
- def decorator(func):
- if 'help' in attrs:
- attrs['help'] = inspect.cleandoc(attrs['help'])
- param = MutuallyExclusiveOption(param_decls, **attrs)
- if not hasattr(func, '__click_params__'):
- func.__click_params__ = []
- func.__click_params__.append(param)
- return func
- return decorator
-
-
-def show_version(ctx, param, value):
- if not value:
- return
-
- logger.info('{0} v{1}'.format(ARIA_ASCII_ART, __version__))
- ctx.exit()
-
-
-def inputs_callback(ctx, param, value):
- """
- Allow to pass any inputs we provide to a command as processed inputs instead of having to call
- ``inputs_to_dict`` inside the command.
-
- ``@aria.options.inputs`` already calls this callback so that every time you use the option it
- returns the inputs as a dictionary.
- """
- if not value:
- return {}
-
- return inputs_to_dict(value)
-
-
-def set_verbosity_level(ctx, param, value):
- if not value:
- return
-
- env.logging.verbosity_level = value
-
-
-def set_cli_except_hook():
- def recommend(possible_solutions):
- logger.info('Possible solutions:')
- for solution in possible_solutions:
- logger.info(' - {0}'.format(solution))
-
- def new_excepthook(tpe, value, trace):
- if env.logging.is_high_verbose_level():
- # log error including traceback
- logger.error(get_exception_as_string(tpe, value, trace))
- else:
- # write the full error to the log file
- with open(env.logging.log_file, 'a') as log_file:
- traceback.print_exception(
- etype=tpe,
- value=value,
- tb=trace,
- file=log_file)
- # print only the error message
- print value
-
- if hasattr(value, 'possible_solutions'):
- recommend(getattr(value, 'possible_solutions'))
-
- sys.excepthook = new_excepthook
-
-
-def pass_logger(func):
- """
- Simply passes the logger to a command.
- """
- # Wraps here makes sure the original docstring propagates to click
- @wraps(func)
- def wrapper(*args, **kwargs):
- return func(logger=logger, *args, **kwargs)
-
- return wrapper
-
-
-def pass_plugin_manager(func):
- """
- Simply passes the plugin manager to a command.
- """
- # Wraps here makes sure the original docstring propagates to click
- @wraps(func)
- def wrapper(*args, **kwargs):
- return func(plugin_manager=env.plugin_manager, *args, **kwargs)
-
- return wrapper
-
-
-def pass_model_storage(func):
- """
- Simply passes the model storage to a command.
- """
- # Wraps here makes sure the original docstring propagates to click
- @wraps(func)
- def wrapper(*args, **kwargs):
- return func(model_storage=env.model_storage, *args, **kwargs)
-
- return wrapper
-
-
-def pass_resource_storage(func):
- """
- Simply passes the resource storage to a command.
- """
- # Wraps here makes sure the original docstring propagates to click
- @wraps(func)
- def wrapper(*args, **kwargs):
- return func(resource_storage=env.resource_storage, *args, **kwargs)
-
- return wrapper
-
-
-def pass_context(func):
- """
- Make click context ARIA specific.
-
- This exists purely for aesthetic reasons, otherwise some decorators are called
- ``@click.something`` instead of ``@aria.something``.
- """
- return click.pass_context(func)
-
-
-class AliasedGroup(click.Group):
- def __init__(self, *args, **kwargs):
- self.max_suggestions = kwargs.pop("max_suggestions", 3)
- self.cutoff = kwargs.pop("cutoff", 0.5)
- super(AliasedGroup, self).__init__(*args, **kwargs)
-
- def get_command(self, ctx, cmd_name):
- cmd = click.Group.get_command(self, ctx, cmd_name)
- if cmd is not None:
- return cmd
- matches = \
- [x for x in self.list_commands(ctx) if x.startswith(cmd_name)]
- if not matches:
- return None
- elif len(matches) == 1:
- return click.Group.get_command(self, ctx, matches[0])
- ctx.fail('Too many matches: {0}'.format(', '.join(sorted(matches))))
-
- def resolve_command(self, ctx, args):
- """
- Override clicks ``resolve_command`` method and appends *Did you mean ...* suggestions to the
- raised exception message.
- """
- try:
- return super(AliasedGroup, self).resolve_command(ctx, args)
- except click.exceptions.UsageError as error:
- error_msg = str(error)
- original_cmd_name = click.utils.make_str(args[0])
- matches = difflib.get_close_matches(
- original_cmd_name,
- self.list_commands(ctx),
- self.max_suggestions,
- self.cutoff)
- if matches:
- error_msg += '{0}{0}Did you mean one of these?{0} {1}'.format(
- os.linesep,
- '{0} '.format(os.linesep).join(matches, ))
- raise click.exceptions.UsageError(error_msg, error.ctx)
-
-
-def group(name):
- """
- Allow to create a group with a default click context and a class for Click's ``didyoueamn``
- without having to repeat it for every group.
- """
- return click.group(
- name=name,
- context_settings=CLICK_CONTEXT_SETTINGS,
- cls=AliasedGroup)
-
-
-def command(*args, **kwargs):
- """
- Make Click commands ARIA specific.
-
- This exists purely for aesthetic reasons, otherwise some decorators are called
- ``@click.something`` instead of ``@aria.something``.
- """
- return click.command(*args, **kwargs)
-
-
-def argument(*args, **kwargs):
- """
- Make Click arguments specific to ARIA.
-
- This exists purely for aesthetic reasons, otherwise some decorators are called
- ``@click.something`` instead of ``@aria.something``
- """
- return click.argument(*args, **kwargs)
-
-
-class Options(object):
- def __init__(self):
- """
- The options API is nicer when you use each option by calling ``@aria.options.some_option``
- instead of ``@aria.some_option``.
-
- Note that some options are attributes and some are static methods. The reason for that is
- that we want to be explicit regarding how a developer sees an option. If it can receive
- arguments, it's a method - if not, it's an attribute.
- """
- self.version = click.option(
- '--version',
- is_flag=True,
- callback=show_version,
- expose_value=False,
- is_eager=True,
- help=helptexts.VERSION)
-
- self.json_output = click.option(
- '--json-output',
- is_flag=True,
- help=helptexts.JSON_OUTPUT)
-
- self.dry_execution = click.option(
- '--dry',
- is_flag=True,
- help=helptexts.DRY_EXECUTION)
-
- self.reset_config = click.option(
- '--reset-config',
- is_flag=True,
- help=helptexts.RESET_CONFIG)
-
- self.descending = click.option(
- '--descending',
- required=False,
- is_flag=True,
- default=defaults.SORT_DESCENDING,
- help=helptexts.DESCENDING)
-
- self.service_template_filename = click.option(
- '-n',
- '--service-template-filename',
- default=defaults.SERVICE_TEMPLATE_FILENAME,
- help=helptexts.SERVICE_TEMPLATE_FILENAME)
-
- self.service_template_mode_full = mutually_exclusive_option(
- '-f',
- '--full',
- 'mode_full',
- mutually_exclusive=('mode_types',),
- is_flag=True,
- help=helptexts.SHOW_FULL,
- mutuality_description='-t, --types',
- mutuality_error=helptexts.MODE_MUTUALITY_ERROR_MESSAGE)
-
- self.service_mode_full = mutually_exclusive_option(
- '-f',
- '--full',
- 'mode_full',
- mutually_exclusive=('mode_graph',),
- is_flag=True,
- help=helptexts.SHOW_FULL,
- mutuality_description='-g, --graph',
- mutuality_error=helptexts.MODE_MUTUALITY_ERROR_MESSAGE)
-
- self.mode_types = mutually_exclusive_option(
- '-t',
- '--types',
- 'mode_types',
- mutually_exclusive=('mode_full',),
- is_flag=True,
- help=helptexts.SHOW_TYPES,
- mutuality_description='-f, --full',
- mutuality_error=helptexts.MODE_MUTUALITY_ERROR_MESSAGE)
-
- self.mode_graph = mutually_exclusive_option(
- '-g',
- '--graph',
- 'mode_graph',
- mutually_exclusive=('mode_full',),
- is_flag=True,
- help=helptexts.SHOW_GRAPH,
- mutuality_description='-f, --full',
- mutuality_error=helptexts.MODE_MUTUALITY_ERROR_MESSAGE)
-
- self.format_json = mutually_exclusive_option(
- '-j',
- '--json',
- 'format_json',
- mutually_exclusive=('format_yaml',),
- is_flag=True,
- help=helptexts.SHOW_JSON,
- mutuality_description='-y, --yaml',
- mutuality_error=helptexts.FORMAT_MUTUALITY_ERROR_MESSAGE)
-
- self.format_yaml = mutually_exclusive_option(
- '-y',
- '--yaml',
- 'format_yaml',
- mutually_exclusive=('format_json',),
- is_flag=True,
- help=helptexts.SHOW_YAML,
- mutuality_description='-j, --json',
- mutuality_error=helptexts.FORMAT_MUTUALITY_ERROR_MESSAGE)
-
- @staticmethod
- def verbose(expose_value=False):
- return click.option(
- '-v',
- '--verbose',
- count=True,
- callback=set_verbosity_level,
- expose_value=expose_value,
- is_eager=True,
- help=helptexts.VERBOSE)
-
- @staticmethod
- def inputs(help):
- return click.option(
- '-i',
- '--inputs',
- multiple=True,
- callback=inputs_callback,
- help=help)
-
- @staticmethod
- def force(help):
- return click.option(
- '-f',
- '--force',
- is_flag=True,
- help=help)
-
- @staticmethod
- def task_max_attempts(default=defaults.TASK_MAX_ATTEMPTS):
- return click.option(
- '--task-max-attempts',
- type=int,
- default=default,
- help=helptexts.TASK_MAX_ATTEMPTS.format(default))
-
- @staticmethod
- def sort_by(default='created_at'):
- return click.option(
- '--sort-by',
- required=False,
- default=default,
- help=helptexts.SORT_BY)
-
- @staticmethod
- def task_retry_interval(default=defaults.TASK_RETRY_INTERVAL):
- return click.option(
- '--task-retry-interval',
- type=int,
- default=default,
- help=helptexts.TASK_RETRY_INTERVAL.format(default))
-
- @staticmethod
- def service_id(required=False):
- return click.option(
- '-s',
- '--service-id',
- required=required,
- help=helptexts.SERVICE_ID)
-
- @staticmethod
- def execution_id(required=False):
- return click.option(
- '-e',
- '--execution-id',
- required=required,
- help=helptexts.EXECUTION_ID)
-
- @staticmethod
- def service_template_id(required=False):
- return click.option(
- '-t',
- '--service-template-id',
- required=required,
- help=helptexts.SERVICE_TEMPLATE_ID)
-
- @staticmethod
- def service_template_path(required=False):
- return click.option(
- '-p',
- '--service-template-path',
- required=required,
- type=click.Path(exists=True))
-
- @staticmethod
- def service_name(required=False):
- return click.option(
- '-s',
- '--service-name',
- required=required,
- help=helptexts.SERVICE_ID)
-
- @staticmethod
- def service_template_name(required=False):
- return click.option(
- '-t',
- '--service-template-name',
- required=required,
- help=helptexts.SERVICE_ID)
-
- @staticmethod
- def mark_pattern():
- return click.option(
- '-m',
- '--mark-pattern',
- help=helptexts.MARK_PATTERN,
- type=str,
- required=False
- )
-
-options = Options()
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/csar.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/csar.py b/apache-ariatosca-0.1.1/aria/cli/csar.py
deleted file mode 100644
index 40b1699..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/csar.py
+++ /dev/null
@@ -1,187 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-Support for the CSAR (Cloud Service ARchive) packaging specification.
-
-See the `TOSCA Simple Profile v1.0 cos01 specification <http://docs.oasis-open.org/tosca
-/TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html#_Toc461787381>`__
-"""
-
-import os
-import logging
-import pprint
-import tempfile
-import zipfile
-
-import requests
-from ruamel import yaml
-
-CSAR_FILE_EXTENSION = '.csar'
-META_FILE = 'TOSCA-Metadata/TOSCA.meta'
-META_FILE_VERSION_KEY = 'TOSCA-Meta-File-Version'
-META_FILE_VERSION_VALUE = '1.0'
-META_CSAR_VERSION_KEY = 'CSAR-Version'
-META_CSAR_VERSION_VALUE = '1.1'
-META_CREATED_BY_KEY = 'Created-By'
-META_CREATED_BY_VALUE = 'ARIA'
-META_ENTRY_DEFINITIONS_KEY = 'Entry-Definitions'
-BASE_METADATA = {
- META_FILE_VERSION_KEY: META_FILE_VERSION_VALUE,
- META_CSAR_VERSION_KEY: META_CSAR_VERSION_VALUE,
- META_CREATED_BY_KEY: META_CREATED_BY_VALUE,
-}
-
-
-def write(service_template_path, destination, logger):
-
- service_template_path = os.path.abspath(os.path.expanduser(service_template_path))
- source = os.path.dirname(service_template_path)
- entry = os.path.basename(service_template_path)
-
- meta_file = os.path.join(source, META_FILE)
- if not os.path.isdir(source):
- raise ValueError('{0} is not a directory. Please specify the service template '
- 'directory.'.format(source))
- if not os.path.isfile(service_template_path):
- raise ValueError('{0} does not exists. Please specify a valid entry point.'
- .format(service_template_path))
- if os.path.exists(destination):
- raise ValueError('{0} already exists. Please provide a path to where the CSAR should be '
- 'created.'.format(destination))
- if os.path.exists(meta_file):
- raise ValueError('{0} already exists. This commands generates a meta file for you. Please '
- 'remove the existing metafile.'.format(meta_file))
- metadata = BASE_METADATA.copy()
- metadata[META_ENTRY_DEFINITIONS_KEY] = entry
- logger.debug('Compressing root directory to ZIP')
- with zipfile.ZipFile(destination, 'w', zipfile.ZIP_DEFLATED) as f:
- for root, _, files in os.walk(source):
- for file in files:
- file_full_path = os.path.join(root, file)
- file_relative_path = os.path.relpath(file_full_path, source)
- logger.debug('Writing to archive: {0}'.format(file_relative_path))
- f.write(file_full_path, file_relative_path)
- logger.debug('Writing new metadata file to {0}'.format(META_FILE))
- f.writestr(META_FILE, yaml.dump(metadata, default_flow_style=False))
-
-
-class _CSARReader(object):
-
- def __init__(self, source, destination, logger):
- self.logger = logger
- if os.path.isdir(destination) and os.listdir(destination):
- raise ValueError('{0} already exists and is not empty. '
- 'Please specify the location where the CSAR '
- 'should be extracted.'.format(destination))
- downloaded_csar = '://' in source
- if downloaded_csar:
- file_descriptor, download_target = tempfile.mkstemp()
- os.close(file_descriptor)
- self._download(source, download_target)
- source = download_target
- self.source = os.path.expanduser(source)
- self.destination = os.path.expanduser(destination)
- self.metadata = {}
- try:
- if not os.path.exists(self.source):
- raise ValueError('{0} does not exists. Please specify a valid CSAR path.'
- .format(self.source))
- if not zipfile.is_zipfile(self.source):
- raise ValueError('{0} is not a valid CSAR.'.format(self.source))
- self._extract()
- self._read_metadata()
- self._validate()
- finally:
- if downloaded_csar:
- os.remove(self.source)
-
- @property
- def created_by(self):
- return self.metadata.get(META_CREATED_BY_KEY)
-
- @property
- def csar_version(self):
- return self.metadata.get(META_CSAR_VERSION_KEY)
-
- @property
- def meta_file_version(self):
- return self.metadata.get(META_FILE_VERSION_KEY)
-
- @property
- def entry_definitions(self):
- return self.metadata.get(META_ENTRY_DEFINITIONS_KEY)
-
- @property
- def entry_definitions_yaml(self):
- with open(os.path.join(self.destination, self.entry_definitions)) as f:
- return yaml.load(f)
-
- def _extract(self):
- self.logger.debug('Extracting CSAR contents')
- if not os.path.exists(self.destination):
- os.mkdir(self.destination)
- with zipfile.ZipFile(self.source) as f:
- f.extractall(self.destination)
- self.logger.debug('CSAR contents successfully extracted')
-
- def _read_metadata(self):
- csar_metafile = os.path.join(self.destination, META_FILE)
- if not os.path.exists(csar_metafile):
- raise ValueError('Metadata file {0} is missing from the CSAR'.format(csar_metafile))
- self.logger.debug('CSAR metadata file: {0}'.format(csar_metafile))
- self.logger.debug('Attempting to parse CSAR metadata YAML')
- with open(csar_metafile) as f:
- self.metadata.update(yaml.load(f))
- self.logger.debug('CSAR metadata:{0}{1}'.format(os.linesep, pprint.pformat(self.metadata)))
-
- def _validate(self):
- def validate_key(key, expected=None):
- if not self.metadata.get(key):
- raise ValueError('{0} is missing from the metadata file.'.format(key))
- actual = str(self.metadata[key])
- if expected and actual != expected:
- raise ValueError('{0} is expected to be {1} in the metadata file while it is in '
- 'fact {2}.'.format(key, expected, actual))
- validate_key(META_FILE_VERSION_KEY, expected=META_FILE_VERSION_VALUE)
- validate_key(META_CSAR_VERSION_KEY, expected=META_CSAR_VERSION_VALUE)
- validate_key(META_CREATED_BY_KEY)
- validate_key(META_ENTRY_DEFINITIONS_KEY)
- self.logger.debug('CSAR entry definitions: {0}'.format(self.entry_definitions))
- entry_definitions_path = os.path.join(self.destination, self.entry_definitions)
- if not os.path.isfile(entry_definitions_path):
- raise ValueError('The entry definitions {0} referenced by the metadata file does not '
- 'exist.'.format(entry_definitions_path))
-
- def _download(self, url, target):
- response = requests.get(url, stream=True)
- if response.status_code != 200:
- raise ValueError('Server at {0} returned a {1} status code'
- .format(url, response.status_code))
- self.logger.info('Downloading {0} to {1}'.format(url, target))
- with open(target, 'wb') as f:
- for chunk in response.iter_content(chunk_size=8192):
- if chunk:
- f.write(chunk)
-
-
-def read(source, destination=None, logger=None):
- destination = destination or tempfile.mkdtemp()
- logger = logger or logging.getLogger('dummy')
- return _CSARReader(source=source, destination=destination, logger=logger)
-
-
-def is_csar_archive(source):
- return source.endswith(CSAR_FILE_EXTENSION)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/defaults.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/defaults.py b/apache-ariatosca-0.1.1/aria/cli/defaults.py
deleted file mode 100644
index e84abc0..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/defaults.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-Various CLI default values.
-"""
-
-#: Default service template filename
-SERVICE_TEMPLATE_FILENAME = 'service_template.yaml'
-
-#: Default task max attempts
-TASK_MAX_ATTEMPTS = 30
-
-#: Default task retry interval
-TASK_RETRY_INTERVAL = 30
-
-#: Default sort descending
-SORT_DESCENDING = False
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/env.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/env.py b/apache-ariatosca-0.1.1/aria/cli/env.py
deleted file mode 100644
index 84bdebe..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/env.py
+++ /dev/null
@@ -1,127 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-Environment (private)
-"""
-
-import os
-import shutil
-
-from .config import config
-from .logger import Logging
-from .. import (application_model_storage, application_resource_storage)
-from ..orchestrator.plugin import PluginManager
-from ..storage.sql_mapi import SQLAlchemyModelAPI
-from ..storage.filesystem_rapi import FileSystemResourceAPI
-
-
-ARIA_DEFAULT_WORKDIR_NAME = '.aria'
-
-
-class _Environment(object):
-
- def __init__(self, workdir):
-
- self._workdir = workdir
- self._init_workdir()
-
- self._config = config.CliConfig.create_config(workdir)
- self._logging = Logging(self._config)
-
- self._model_storage_dir = os.path.join(workdir, 'models')
- self._resource_storage_dir = os.path.join(workdir, 'resources')
- self._plugins_dir = os.path.join(workdir, 'plugins')
-
- # initialized lazily
- self._model_storage = None
- self._resource_storage = None
- self._plugin_manager = None
-
- @property
- def workdir(self):
- return self._workdir
-
- @property
- def config(self):
- return self._config
-
- @property
- def logging(self):
- return self._logging
-
- @property
- def model_storage(self):
- if not self._model_storage:
- self._model_storage = self._init_sqlite_model_storage()
- return self._model_storage
-
- @property
- def resource_storage(self):
- if not self._resource_storage:
- self._resource_storage = self._init_fs_resource_storage()
- return self._resource_storage
-
- @property
- def plugin_manager(self):
- if not self._plugin_manager:
- self._plugin_manager = self._init_plugin_manager()
- return self._plugin_manager
-
- def reset(self, reset_config):
- if reset_config:
- shutil.rmtree(self._workdir)
- else:
- _, dirs, files = next(os.walk(self._workdir))
- files.remove(config.CONFIG_FILE_NAME)
-
- for dir_ in dirs:
- shutil.rmtree(os.path.join(self._workdir, dir_))
- for file_ in files:
- os.remove(os.path.join(self._workdir, file_))
-
- def _init_workdir(self):
- if not os.path.exists(self._workdir):
- os.makedirs(self._workdir)
-
- def _init_sqlite_model_storage(self):
- if not os.path.exists(self._model_storage_dir):
- os.makedirs(self._model_storage_dir)
-
- initiator_kwargs = dict(base_dir=self._model_storage_dir)
- return application_model_storage(
- SQLAlchemyModelAPI,
- initiator_kwargs=initiator_kwargs)
-
- def _init_fs_resource_storage(self):
- if not os.path.exists(self._resource_storage_dir):
- os.makedirs(self._resource_storage_dir)
-
- fs_kwargs = dict(directory=self._resource_storage_dir)
- return application_resource_storage(
- FileSystemResourceAPI,
- api_kwargs=fs_kwargs)
-
- def _init_plugin_manager(self):
- if not os.path.exists(self._plugins_dir):
- os.makedirs(self._plugins_dir)
-
- return PluginManager(self.model_storage, self._plugins_dir)
-
-
-env = _Environment(os.path.join(
- os.environ.get('ARIA_WORKDIR', os.path.expanduser('~')), ARIA_DEFAULT_WORKDIR_NAME))
-
-logger = env.logging.logger
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca-website/blob/23d6ba76/apache-ariatosca-0.1.1/aria/cli/exceptions.py
----------------------------------------------------------------------
diff --git a/apache-ariatosca-0.1.1/aria/cli/exceptions.py b/apache-ariatosca-0.1.1/aria/cli/exceptions.py
deleted file mode 100644
index 7da9836..0000000
--- a/apache-ariatosca-0.1.1/aria/cli/exceptions.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-CLI exceptions.
-"""
-
-from ..exceptions import AriaError
-
-
-class AriaCliError(AriaError):
- pass