Merge pull request #227 from djay87/master

ARIA-118 plugin.yaml importing
diff --git a/aria/cli/csar.py b/aria/cli/csar.py
index ba80bad..6def213 100644
--- a/aria/cli/csar.py
+++ b/aria/cli/csar.py
@@ -56,7 +56,7 @@
         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.'
+        raise ValueError('{0} does not exist. 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 '
@@ -97,7 +97,7 @@
         self.metadata = {}
         try:
             if not os.path.exists(self.source):
-                raise ValueError('{0} does not exists. Please specify a valid CSAR path.'
+                raise ValueError('{0} does not exist. 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))
diff --git a/aria/orchestrator/workflows/executor/process.py b/aria/orchestrator/workflows/executor/process.py
index 4143127..90f0d23 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -69,9 +69,17 @@
     Sub-process task executor.
     """
 
-    def __init__(self, plugin_manager=None, python_path=None, *args, **kwargs):
+    def __init__(
+            self,
+            plugin_manager=None,
+            python_path=None,
+            strict_loading=True,
+            *args,
+            **kwargs
+    ):
         super(ProcessExecutor, self).__init__(*args, **kwargs)
         self._plugin_manager = plugin_manager
+        self._strict_loading = strict_loading
 
         # Optional list of additional directories that should be added to
         # subprocesses python path
@@ -173,7 +181,8 @@
             'function': ctx.task.function,
             'operation_arguments': dict(arg.unwrapped for arg in ctx.task.arguments.itervalues()),
             'port': self._server_port,
-            'context': ctx.serialization_dict
+            'context': ctx.serialization_dict,
+            'strict_loading': self._strict_loading
         }
 
     def _construct_subprocess_env(self, task):
@@ -326,6 +335,7 @@
     function = arguments['function']
     operation_arguments = arguments['operation_arguments']
     context_dict = arguments['context']
+    strict_loading = arguments['strict_loading']
 
     try:
         ctx = context_dict['context_cls'].instantiate_from_dict(**context_dict['context'])
@@ -336,7 +346,7 @@
     try:
         messenger.started()
         task_func = imports.load_attribute(function)
-        aria.install_aria_extensions()
+        aria.install_aria_extensions(strict_loading)
         for decorate in process_executor.decorate():
             task_func = decorate(task_func)
         task_func(ctx=ctx, **operation_arguments)
diff --git a/aria/utils/yaml.py b/aria/utils/yaml.py
index 4c9c557..86f7f5b 100644
--- a/aria/utils/yaml.py
+++ b/aria/utils/yaml.py
@@ -48,3 +48,9 @@
 
 finally:
     from ruamel import yaml                                                     # pylint: disable=unused-import
+
+
+# Enables support for writing Python Unicode class with YAML. This is a temporary fix which
+# should be replaced by a proper usage of ruamel
+# (addressed in https://issues.apache.org/jira/browse/ARIA-429).
+yaml.SafeLoader.add_constructor('tag:yaml.org,2002:python/unicode', lambda _, node: node.value)
diff --git a/examples/aria-service-proxy-plugin/.gitignore b/examples/aria-service-proxy-plugin/.gitignore
new file mode 100644
index 0000000..e26c3bb
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/.gitignore
@@ -0,0 +1,71 @@
+conf/nohup.out
+
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+#  Usually these files are written by a python script from a template
+#  before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+cover
+.tox/
+.coverage
+.cache
+nosetests.xml
+coverage.xml
+
+# testing sqlite db's
+*.db
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+.idea/*
+.venv/*
+
+AUTHORS
+ChangeLog
+.cloudify
+local-storage/
+
+# Emacs
+\#*
diff --git a/examples/aria-service-proxy-plugin/.travis.yml b/examples/aria-service-proxy-plugin/.travis.yml
new file mode 100644
index 0000000..b11ed62
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/.travis.yml
@@ -0,0 +1,31 @@
+# Licensed 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.
+
+sudo: false
+language: python
+python:
+  - "2.7"
+env:
+- TOX_ENV=pylint_code
+- TOX_ENV=pylint_tests
+- TOX_ENV=py27
+- TOX_ENV=py26
+- TOX_ENV=py27e2e
+- TOX_ENV=py26e2e
+install:
+  - pip install --upgrade pip
+  - pip install --upgrade setuptools
+  - pip install tox
+script:
+  - pip --version
+  - tox --version
+  - tox -e $TOX_ENV
diff --git a/examples/aria-service-proxy-plugin/CHANGELOG.txt b/examples/aria-service-proxy-plugin/CHANGELOG.txt
new file mode 100644
index 0000000..2229826
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/CHANGELOG.txt
@@ -0,0 +1,2 @@
+releases:
+ 
diff --git a/examples/aria-service-proxy-plugin/LICENSE b/examples/aria-service-proxy-plugin/LICENSE
new file mode 100644
index 0000000..f433b1a
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/LICENSE
@@ -0,0 +1,177 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
diff --git a/examples/aria-service-proxy-plugin/README.md b/examples/aria-service-proxy-plugin/README.md
new file mode 100644
index 0000000..e97cf1a
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/README.md
@@ -0,0 +1,19 @@
+# ARIA Service Proxy Plugin
+
+A plugin for inter-service coordination
+
+## Types
+
+### aria.serviceproxy.ServiceProxy
+Abstract representation of an ARIA service.  The type operates by copying the outputs of target services into its local runtime attributes.  The service must be installed, and node properties control other conditions for successful instantiation.  It isn't assumed that the service exists at the time of instantiation, and properties control timeout behavior.  A failed service discovery, or listed desired outputs, results in a NonRecoverableError.  The plugin logic is entirely executed in the `create` lifecycle operation of the Standard interface.  Any template nodes dependent on the proxy will wait for the proxy to either gather the outputs of the target service, or timeout, which will abort the workflow.  The intended usage is for dependent nodes to have easy access to the outputs of ARIA managed services via attributes.
+
+#### Properties
+* __service_name__ : The name of the target service.  Required.
+* __outputs__ : A `string` list of service outputs.  Acts as a filter to selected desired outputs. An empty list will result in no outputs being copied, which also would have the effect of making the existence of the target sufficient to satisfy the proxy.
+* __wait_config__: A `dictionary` with two keys:
+* * __wait_for_service__: A `boolean` that indicates whether to wait for a service that doesn't exist yet.  If `False`, if either the service or requested outputs are not present immediately, a non-recoverable exception is thrown.  If `True`, the plugin will wait.
+* * __wait_time__: An `integer` that indicates the number of seconds to wait for the service, and specified outputs, to exist.  Beyond this time, a non-recoverable exception is thrown.  Note that there is no enforced maximum wait which could cause a misconfiguration to wait forever.
+* * __wait_expression__: A Python evaluatable boolean expression using output names.  The expression acts as another barrier to matching the target service.  Examples values: "output1 > 4", "len(output1) == 7", "status == "ready"".  Be aware that while syntax is checked via Python evaluation, the meaning of the expression is not checked.  For example a wait expression of "1==0" could be supplied and result in an unsatifiable condition and wait (or failure).  Note that the Python evaluation environment only contains the target service outputs, and no additional imports.
+
+#### Attributes
+The outputs of the target are copied in a `list` in the runtime attributes named `service_outputs`.  Service outputs entries consist of single entry dictionaries, with the keys `name` and `value`.  Service output names and values are unchanged from their original values in the proxied service.
diff --git a/examples/aria-service-proxy-plugin/aria_service_proxy/__init__.py b/examples/aria-service-proxy-plugin/aria_service_proxy/__init__.py
new file mode 100644
index 0000000..ae1e83e
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/aria_service_proxy/__init__.py
@@ -0,0 +1,14 @@
+# 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.
diff --git a/examples/aria-service-proxy-plugin/aria_service_proxy/tasks.py b/examples/aria-service-proxy-plugin/aria_service_proxy/tasks.py
new file mode 100644
index 0000000..6a17bb1
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/aria_service_proxy/tasks.py
@@ -0,0 +1,192 @@
+# 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.
+
+from cloudify.decorators import operation
+from cloudify import ctx
+from cloudify.exceptions import NonRecoverableError
+from datetime import datetime
+from aria.cli.core import aria
+
+WAIT_CONFIG_KEY = 'wait_config'
+WAIT_TIME_KEY = 'wait_time'
+WAIT_FOR_SERVICE_KEY = 'wait_for_service'
+WAIT_EXPR_KEY = 'wait_expression'
+SERVICE_NAME_KEY = 'service_name'
+SERVICE_OUTPUTS_KEY = 'service_outputs'
+OUTPUT_KEY = 'outputs'
+LAST_UPDATE_KEY = 'last_update'
+
+WORKFLOW_INSTALL = 'install'
+WORKFLOW_UNINSTALL = 'uninstall'
+WF_SUCCESS_STATUS = 'succeeded'
+
+RETRY_DELAY_SECS = 1
+
+# Only operation exposed.  Waits for proxied service to be ready
+# if necessary, then copies selected outputs to node attributes.
+#
+@operation
+def proxy_connect(**kwargs):
+
+    #
+    # Collect node configuration
+    #
+
+    service_names = get_service_names()
+
+    duration = ctx.node.properties[WAIT_CONFIG_KEY][WAIT_TIME_KEY]
+
+    installed = False
+
+    service_exists = ctx.node.properties[SERVICE_NAME_KEY] in service_names
+
+    if service_exists:
+        installed = is_installed(
+            service_names[ctx.node.properties[SERVICE_NAME_KEY]])
+
+    wait_for_service = ctx.node.properties[WAIT_CONFIG_KEY][WAIT_FOR_SERVICE_KEY]
+
+    wait_expr = ctx.node.properties[WAIT_CONFIG_KEY].get(WAIT_EXPR_KEY,
+                                                       None)
+
+    # If the service doesn't exist, or exists but hasn't been installed,
+    # and wait_for_service = true, retry for configured duration.
+    #
+    if not service_exists or not installed:
+        if wait_for_service:
+            if duration > ctx.operation.retry_number:
+                return ctx.operation.retry(
+                    message = 'Waiting for service',
+                    retry_after=RETRY_DELAY_SECS)
+            else:
+                if not service_exists:
+                    raise NonRecoverableError(
+                        "service {} not found".format(
+                            ctx.node.properties[SERVICE_NAME_KEY]))
+                else:
+                    raise NonRecoverableError(
+                        "service {} not installed".format(
+                            ctx.node.properties[SERVICE_NAME_KEY]))
+        else:
+            if not service_exists:
+                raise NonRecoverableError(
+                    "service {} not found".format(
+                        ctx.node.properties[SERVICE_NAME_KEY]))
+            else:
+                raise NonRecoverableError(
+                    "service {} not installed".format(
+                        ctx.node.properties[SERVICE_NAME_KEY]))
+
+    # Service ready.  If outputs are configured in proxy, grab them
+    elif( ctx.node.properties[OUTPUT_KEY]):
+        outputs = service_names[ctx.node.properties[SERVICE_NAME_KEY]].outputs
+
+        # If the outputs are not ready yet, retry
+        if not output_equivalence( ctx.node.properties[OUTPUT_KEY], outputs):
+            return fail_or_wait(wait_for_service,
+                                duration,
+                                'Waiting for service outputs',
+                                "service {} outputs {} not found".format(
+                                    ctx.node.properties[SERVICE_NAME_KEY],
+                                    ctx.node.properties[OUTPUT_KEY]))
+
+        # Outputs are ready.  Copy them from target outputs into the
+        # this node instance attributes
+        else:
+            # Success
+            # place outputs in attributes
+            # final wicket: expression
+            if wait_expr:
+                if not eval_waitexpr(wait_expr, outputs):
+                    return(fail_or_wait(wait_for_service, duration,
+                                        "waiting for expr",
+                                        "Expr {} evaluates false".format(
+                                        wait_expr)))
+
+            service_outputs = []
+            if(SERVICE_OUTPUTS_KEY in ctx.instance.runtime_properties and
+               ctx.instance.runtime_properties[SERVICE_OUTPUTS_KEY]):
+                 service_outputs = list(
+                    ctx.instance.runtime_properties[SERVICE_OUTPUTS_KEY])
+            for key,val in outputs.iteritems():
+                service_outputs.append( dict(name = key,value = val.value))
+            ctx.instance.runtime_properties[SERVICE_OUTPUTS_KEY] = service_outputs
+
+            ctx.instance.runtime_properties[LAST_UPDATE_KEY] = str(datetime.utcnow())
+
+    # Service exists, but outputs not configured, so we're done
+    else:
+        ctx.logger.info("service exists, but no outputs specified = success")
+
+
+# returns service names
+@aria.pass_model_storage
+def get_service_names(model_storage):
+    """
+    Lists all services
+    """
+    services_list = model_storage.service.list()
+    outdict = {}
+    for service in services_list:
+        outdict[str(service.name)] = service
+    return outdict
+
+
+# Tests whether the list of configured outputs (a simple string list)
+# is equivalent # to the list returned from Aria (possible duplicate keys)
+def output_equivalence(config_list, service_list):
+    sset = set()
+    for key, val in service_list.iteritems():
+        sset.add(key)
+    if not len(sset) == len(config_list):
+        return False
+    for entry in sset:
+        if entry not in config_list:
+            return False
+    return True
+
+
+# Looks at the execution history to determine of service is installed
+@aria.pass_model_storage
+def is_installed(service, model_storage):
+    executions = model_storage.execution.list(
+        filters=dict(service=service)).items
+    for execution in reversed(executions):
+        if execution.workflow_name == WORKFLOW_UNINSTALL:
+            return False
+        if (execution.workflow_name == WORKFLOW_INSTALL and
+            execution.status == WF_SUCCESS_STATUS):
+            return True
+    return False
+
+
+# Evaluates wait_expr in the context of supplied outputs
+def eval_waitexpr(expr, outputs):
+    locals = {}
+    for key, val in outputs.iteritems():
+        locals[key] = val.value
+    return eval(expr, locals)
+
+# Convenience function that either fails immediately (if wait_flag
+# is false), or tests and retries or fails based on the wait condition
+def fail_or_wait( wait_flag, duration, wait_msg, fail_msg ):
+    if wait_flag:
+        if duration > ctx.operation.retry_number:
+            return ctx.operation.retry(
+                      message = wait_msg, retry_after=RETRY_DELAY_SECS)
+        else:
+            raise NonRecoverableError( fail_msg)
+    else:
+        raise NonRecoverableError( fail_msg)
diff --git a/examples/aria-service-proxy-plugin/circle.yml b/examples/aria-service-proxy-plugin/circle.yml
new file mode 100644
index 0000000..fcb3732
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/circle.yml
@@ -0,0 +1,25 @@
+machine:
+  python:
+    version: 2.7.9
+
+checkout:
+  post:
+    - >
+      if [ -n "$CI_PULL_REQUEST" ]; then
+        PR_ID=${CI_PULL_REQUEST##*/}
+        git fetch origin +refs/pull/$PR_ID/merge:
+        git checkout -qf FETCH_HEAD
+      fi
+
+dependencies:
+  override:
+    - pip install tox
+
+test:
+  override:
+    - tox -e flake8
+    - tox -e py27
+    - tox -e validate
+  post:
+    - mkdir -p $CIRCLE_TEST_REPORTS/reports
+    - cp nosetests.xml $CIRCLE_TEST_REPORTS
diff --git a/examples/aria-service-proxy-plugin/plugin.yaml b/examples/aria-service-proxy-plugin/plugin.yaml
new file mode 100644
index 0000000..ee27b19
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/plugin.yaml
@@ -0,0 +1,88 @@
+# 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.
+
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+topology_template:
+  policies:
+    aria-service-proxy-plugin:
+      type: aria.Plugin
+      properties:
+        version: 0.1
+        
+data_types:
+  serviceproxy.waitconfig:
+    properties:
+      wait_for_service:
+        type: boolean
+        description: >-
+          If True, wait for 'wait_time' for service to exist and other conditions
+          to be True.  Otherwise don't retry in case of failure.
+        required: false
+        default: false
+      wait_time:
+        description: time to wait for service outputs to be available in seconds
+        type: integer
+        required: false
+        default: 30
+      wait_expression:
+        description: >-
+          boolean expression to wait for truth value.  Python syntax.  Outputs from target
+          service are provided as variable names in the expression environment.
+          Example: output1 > output2
+        type: string
+        required: false
+        
+node_types:
+
+  aria.serviceproxy.ServiceProxy:
+    derived_from: tosca.nodes.Root
+    properties:
+      service_name:
+        description: the name of the service to proxy
+        required: true
+        type: string
+      outputs:
+        description: >-
+          list of outputs that will be mapped to proxy attributes
+          under the \"service_outputs" key
+        required: false
+        default: []
+        type: list
+        entry_schema:
+          type: string
+      wait_config:
+        type: serviceproxy.waitconfig
+        description: >-
+          configuration of wait for service existence, outputs, and/or output values
+        required: false
+        default:
+          wait_for_service:
+            false
+    attributes:
+      last_update:
+        description: time of last update
+        type: timestamp
+      service_outputs:
+        description: outputs copied from proxied service
+        type: map
+        entry_schema:
+          type: string
+    interfaces:
+      Standard:
+        type: tosca.interfaces.node.lifecycle.Standard
+        create:
+          implementation: aria-service-proxy-plugin > aria_service_proxy.tasks.proxy_connect
+            
diff --git a/examples/aria-service-proxy-plugin/requirements.txt b/examples/aria-service-proxy-plugin/requirements.txt
new file mode 100644
index 0000000..86986db
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/requirements.txt
@@ -0,0 +1,17 @@
+Jinja2==2.9
+MarkupSafe==1.0
+bottle==0.12.7
+certifi==2017.11.05
+chardet==3.0.4
+cloudify-plugins-common==4.2
+cloudify-rest-client==4.2
+decorator==4.1.2
+idna==2.6
+networkx==2.0
+pika==0.9.14
+proxy-tools==0.1.0
+requests==2.18.4
+requests-toolbelt==0.8.0
+urllib3==1.22
+wsgiref==0.1.2
+apache-ariatosca==0.2.0
diff --git a/examples/aria-service-proxy-plugin/setup.py b/examples/aria-service-proxy-plugin/setup.py
new file mode 100644
index 0000000..1762f45
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/setup.py
@@ -0,0 +1,31 @@
+# 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.
+
+import setuptools
+
+setuptools.setup(
+    name='aria-service-proxy-plugin',
+    version='0.1',
+    author='dfilppi',
+    author_email='dewayne@cloudify.co',
+    description='service proxy plugin',
+    packages=[ 'aria_service_proxy' ],
+    license='LICENSE',
+    install_requires=[
+        'cloudify-plugins-common>=4.0',
+        'networkx==2.0',
+        'Jinja2==2.9'
+        ]
+)
diff --git a/examples/aria-service-proxy-plugin/tests/__init__.py b/examples/aria-service-proxy-plugin/tests/__init__.py
new file mode 100644
index 0000000..38302fc
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/tests/__init__.py
@@ -0,0 +1,3 @@
+import os
+
+ROOT_DIR = os.path.dirname(os.path.dirname(__file__))
diff --git a/examples/aria-service-proxy-plugin/tests/test_proxy.py b/examples/aria-service-proxy-plugin/tests/test_proxy.py
new file mode 100644
index 0000000..6328b54
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/tests/test_proxy.py
@@ -0,0 +1,216 @@
+# 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.
+
+from mock import (
+    MagicMock,
+    Mock
+    )
+import pytest
+from aria_service_proxy import tasks
+from cloudify.exceptions import NonRecoverableError
+from cloudify.state import current_ctx
+
+
+# Tests that a retry is performed when wait_for_service is true and
+# the service doesn't exist
+def test_noservice_with_wait(monkeypatch):
+    node = Mock(properties={'service_name': 'testwait',
+                            'wait_config':
+                            {'wait_for_service': True, 'wait_time': 5},
+                            'outputs': ['someoutput']})
+    attrs = {'retry.return_value': 'retry'}
+    operation = Mock(retry_number=0, **attrs)
+    ctxmock = MagicMock(node = node, operation = operation)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks,"get_service_names",lambda: {})
+    ret = tasks.proxy_connect()
+    assert(ret == 'retry')
+
+
+# Make sure error raised when no service exists and no wait is configured
+def test_noservice_no_wait(monkeypatch):
+    node = Mock(properties={'service_name': 'testfail',
+                              'wait_config': {'wait_for_service': False, 'wait_time': 5 },
+                              'outputs': ['someoutput']})
+    ctxmock = MagicMock(node = node)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks,"get_service_names",lambda: {})
+    with pytest.raises(NonRecoverableError):
+        tasks.proxy_connect()
+
+
+# Test that a service for which wait is specified, is retried
+# properly, and the retry results in success after the service
+# appears
+def test_service_eventual_complete(monkeypatch):
+    output = Mock( value = 'someval')
+    service = Mock(outputs = { 'someoutput': output })
+
+    node = Mock( properties = {
+                      'service_name': 'test',
+                      'wait_config': { 'wait_for_service':True,
+                                       'wait_time': 1 },
+                      'outputs':['someoutput']
+                      }
+               )
+
+    instance = Mock(runtime_properties = {})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 0, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation, instance = instance)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test': service })
+    monkeypatch.setattr(tasks, "is_installed", lambda a: False)
+
+    ret = tasks.proxy_connect()
+    assert(ret == 'retry')
+
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test': service })
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+    ret = tasks.proxy_connect()
+    assert(ret == None)
+    assert(len(ctxmock.instance.runtime_properties['service_outputs']) == 1)
+    assert(ctxmock.instance.runtime_properties['service_outputs'][0]['name'] == 'someoutput')
+    assert(ctxmock.instance.runtime_properties['service_outputs'][0]['value'] == 'someval')
+
+
+# Test that a proxy generates a retry when the service exists, but the
+# outputs don't, and wait is configured
+def test_output_retry(monkeypatch):
+    output = Mock( value = 'someval')
+    service = Mock(outputs= {'test':output})
+    node = Mock(properties = {'service_name': 'test',
+                              'wait_config':
+                              {'wait_for_service': True, 'wait_time':5},
+                              'outputs': ['someoutput']})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 0, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test': service})
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+
+    ret = tasks.proxy_connect()
+    assert(ret == 'retry')
+
+
+# Test that nominal path works: service complete, outputs available
+def test_output_complete(monkeypatch):
+    output = Mock( value = 'someval')
+    service = Mock(outputs= {'someoutput':output})
+    node = Mock(properties = {'service_name': 'test',
+                              'wait_config':{'wait_for_service': True, 'wait_time':5},
+                              'outputs': ['someoutput']})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 5, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test':service})
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+
+    ret = tasks.proxy_connect()
+    assert(ret == None)
+
+# Test that retry occurs propertly when outputs unavailable (and wait
+# configured), and that they are propertly detected when they appear.
+def test_output_eventual_complete(monkeypatch):
+    output = Mock( value = 'someval')
+    service = Mock(outputs= {'test':output})
+    node = Mock(properties = {'service_name': 'test',
+                              'wait_config':{'wait_for_service': True, 'wait_time':1},
+                              'outputs': ['someoutput']})
+    attrs = {'retry.return_value' : 'retry' }
+    instance = Mock(runtime_properties = {})
+    operation = Mock( retry_number = 0, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation, instance = instance)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test':service})
+
+    ret = tasks.proxy_connect()
+    assert(ret == 'retry')
+
+    service = Mock(outputs= {'someoutput':output})
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test':service})
+    ret = tasks.proxy_connect()
+    assert(ret == None)
+    assert(len(ctxmock.instance.runtime_properties['service_outputs']) == 1)
+    assert(ctxmock.instance.runtime_properties['service_outputs'][0]['name'] == 'someoutput')
+    assert(ctxmock.instance.runtime_properties['service_outputs'][0]['value'] == 'someval')
+
+# Test wait expression fuctionality for failure case.  Pass in an output
+# with and test for incorrect length.  Should raise error.
+def test_expr_fail(monkeypatch):
+    output = Mock( value = 'someval')
+    service = Mock(outputs= {'someoutput':output})
+    node = Mock(properties = {'service_name': 'test',
+                              'wait_config':
+                                {'wait_for_service': True,
+                                 'wait_expression': 'len(someoutput) == 1',
+                                 'wait_time':5},
+                              'outputs': ['someoutput']})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 5, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test':service})
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+
+    with pytest.raises(NonRecoverableError):
+        tasks.proxy_connect()
+
+# Test wait expression fuctionality for success case.  Pass in an output
+# with and test for correct length.  Should raise no error.
+def test_expr_succeed(monkeypatch):
+    output = Mock( value = 'someval')
+    service = Mock(outputs= {'someoutput':output})
+    node = Mock(properties = {'service_name': 'test',
+                              'wait_config':
+                                {'wait_for_service': True,
+                                 'wait_expression': 'len(someoutput) == 7',
+                                 'wait_time':5},
+                              'outputs': ['someoutput']})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 5, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test':service})
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+
+    ret = tasks.proxy_connect()
+    assert(ret == None)
+
+# Test wait expression fuctionality for success case using two outputs.
+# Expression is boolean expression involving two outputs, and it true.
+# Should raise no error.
+def test_expr_succeed_mult(monkeypatch):
+    output1 = Mock( value = 4)
+    output2 = Mock( value = 7)
+    service = Mock(outputs= {'o1':output1, 'o2': output2})
+    node = Mock(properties = {'service_name': 'test',
+                              'wait_config':
+                                {'wait_for_service': True,
+                                 'wait_expression': 'o1 < o2',
+                                 'wait_time':5},
+                              'outputs': ['o1','o2']})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 5, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test':service})
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+
+    ret = tasks.proxy_connect()
+    assert(ret == None)
diff --git a/examples/aria-service-proxy-plugin/tox.ini b/examples/aria-service-proxy-plugin/tox.ini
new file mode 100644
index 0000000..14fa90c
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/tox.ini
@@ -0,0 +1,66 @@
+# content of: tox.ini , put in same dir as setup.py
+[tox]
+envlist=flake8,py27,validate
+
+[testenv:py27]
+deps =
+    -rdev-requirements.txt
+    -rtest-requirements.txt
+commands =
+    nosetests -v --cover-html --with-coverage \
+        --cover-package=cloudify_cloudinit \
+        --cover-package=cloudify_deployment_proxy \
+        --cover-package=cloudify_ssh_key \
+        --cover-package=cloudify_configuration \
+        --cover-package=cloudify_terminal \
+        --cover-package=cloudify_suspend \
+        --cover-package=cloudify_custom_workflow \
+        --with-xunit --xunit-file=nosetests.xml .
+
+[testenv:flake8]
+deps =
+    -rdev-requirements.txt
+    -rtest-requirements.txt
+commands =
+    flake8 cloudify_cloudinit
+    flake8 cloudify_deployment_proxy
+    flake8 cloudify_ssh_key
+    flake8 cloudify_configuration
+    flake8 cloudify_terminal
+    flake8 cloudify_suspend
+    flake8 cloudify_custom_workflow
+    pylint -E cloudify_deployment_proxy \
+           -E cloudify_ssh_key \
+           -E cloudify_terminal \
+           -E cloudify_configuration \
+           -E cloudify_custom_workflow \
+           -E cloudify_suspend
+
+[testenv:validate]
+deps =
+    -rdev-requirements.txt
+    -rtest-requirements.txt
+commands =
+    # configration plugin
+    cfy blueprint validate cloudify_cloudinit/examples/simple.yaml
+    # configration plugin
+    cfy blueprint validate cloudify_configuration/examples/simple.yaml
+    # deployment proxy examples
+    cfy blueprint validate cloudify_deployment_proxy/examples/deployment-proxy.yaml
+    cfy blueprint validate cloudify_deployment_proxy/examples/deployment-proxy-reuse.yaml
+    cfy blueprint validate cloudify_deployment_proxy/examples/deployment-proxy-custom-workflow.yaml
+    cfy blueprint validate cloudify_deployment_proxy/examples/deployment-without-workflow.yaml
+    cfy blueprint validate cloudify_deployment_proxy/examples/node-instance-proxy.yaml
+    # ssh examples
+    cfy blueprint validate cloudify_ssh_key/examples/import-simple-manager.yaml
+    cfy blueprint validate cloudify_ssh_key/examples/ssh-key-blueprint.yaml
+    # too slow
+    # cfy blueprint validate cloudify_ssh_key/examples/azure-blueprint.yaml
+    # terminal examples
+    cfy blueprint validate cloudify_terminal/examples/fortigate.yaml
+    cfy blueprint validate cloudify_terminal/examples/cisco.yaml
+    cfy blueprint validate cloudify_terminal/examples/linux-ssh.yaml
+    # suspend examples
+    cfy blueprint validate cloudify_suspend/examples/example.yaml
+    # custom workflow
+    cfy blueprint validate cloudify_custom_workflow/examples/example.yaml
diff --git a/release/asf-release.sh b/release/asf-release.sh
index 18f5b38..6b09543 100755
--- a/release/asf-release.sh
+++ b/release/asf-release.sh
@@ -135,7 +135,7 @@
     echo "Signing archive ${ARCHIVE_NAME}..."
     gpg --armor --output ${ARCHIVE_NAME}.asc --detach-sig ${ARCHIVE_NAME}
     gpg --print-md MD5 ${ARCHIVE_NAME} > ${ARCHIVE_NAME}.md5
-    gpg --print-md SHA512 ${ARCHIVE_NAME} > ${ARCHIVE_NAME}.sha
+    gpg --print-md SHA512 ${ARCHIVE_NAME} > ${ARCHIVE_NAME}.sha512
 }
 
 
@@ -227,23 +227,9 @@
 
     echo "Publishing to Apache dist..."
 
-    local TMP_DIR=$(mktemp -d)
-    echo "Checking out ARIA dist dev to ${TMP_DIR}"
-    pushd ${TMP_DIR}
-
-    svn co https://dist.apache.org/repos/dist/dev/incubator/ariatosca/ ariatosca-dev
-    svn co https://dist.apache.org/repos/dist/release/incubator/ariatosca/ ariatosca-release
-    cp -r ariatosca-dev/${RELEASE_DIR} ariatosca-release
-
-    pushd ariatosca-release
-    svn add ${RELEASE_DIR}
-    # TODO: remove older releases?
-    svn commit -m "ARIA ${VERSION} release"
-    popd
-    popd
+    svn mv https://dist.apache.org/repos/dist/dev/incubator/ariatosca/${RELEASE_DIR} https://dist.apache.org/repos/dist/release/incubator/ariatosca/${RELEASE_DIR} -m "ARIATOSCA ${VERSION} publish"
 }
 
-
 function _create_git_tag {
     local VERSION=$1
 
diff --git a/tests/cli/csar.py b/tests/cli/csar.py
new file mode 100644
index 0000000..3bbe4ad
--- /dev/null
+++ b/tests/cli/csar.py
@@ -0,0 +1,38 @@
+# 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.
+
+import os
+
+from aria.cli import csar
+from ..helpers import get_resource_uri
+
+
+def _create_archive(tmpdir, mocker):
+    service_template_dir = get_resource_uri(os.path.join(
+        'service-templates', 'tosca-simple-1.0', 'node-cellar', 'node-cellar.yaml'))
+    csar_path = str(tmpdir.join('csar_archive.csar'))
+    csar.write(service_template_dir, csar_path, mocker.MagicMock())
+    return csar_path
+
+
+def test_create_csar(tmpdir, mocker):
+    csar_path = _create_archive(tmpdir, mocker)
+    assert os.path.exists(csar_path)
+
+
+def test_read_csar(tmpdir, mocker):
+    csar_path = _create_archive(tmpdir, mocker)
+    csar_reader = csar.read(csar_path)
+    assert csar_reader