summaryrefslogtreecommitdiffstats
path: root/cdap
diff options
context:
space:
mode:
Diffstat (limited to 'cdap')
-rwxr-xr-xcdap/cdap_types.yaml2
-rw-r--r--cdap/cdapplugin/cdapcloudify/cdap_plugin.py33
-rw-r--r--cdap/cdapplugin/requirements.txt2
-rw-r--r--cdap/cdapplugin/setup.py4
-rw-r--r--cdap/demo_blueprints/cdap_hello_world.yaml28
-rwxr-xr-xcdap/demo_blueprints/cdap_hello_world_reconfigure.sh6
6 files changed, 20 insertions, 55 deletions
diff --git a/cdap/cdap_types.yaml b/cdap/cdap_types.yaml
index f27b4b1..8d079c6 100755
--- a/cdap/cdap_types.yaml
+++ b/cdap/cdap_types.yaml
@@ -6,7 +6,7 @@ plugins:
cdap_deploy:
executor: central_deployment_agent
package_name: cdapcloudify
- package_version: 14.2.0
+ package_version: 14.2.1
data_types:
cdap_connections:
diff --git a/cdap/cdapplugin/cdapcloudify/cdap_plugin.py b/cdap/cdapplugin/cdapcloudify/cdap_plugin.py
index 1de0173..6f4134e 100644
--- a/cdap/cdapplugin/cdapcloudify/cdap_plugin.py
+++ b/cdap/cdapplugin/cdapcloudify/cdap_plugin.py
@@ -46,15 +46,17 @@ class BadConnections(NonRecoverableError):
def _trigger_update(updated_policies):
"""
Helper function for reconfiguring after a policy update
+
+ updated_policies is assumed to be a list of JSONs that are applicable to the brokers smart interface
"""
for p in updated_policies:
ctx.logger.info("Reconfiguring CDAP application via smart interface")
- return discovery.reconfigure_in_broker(cdap_broker_name = ctx.instance.runtime_properties[SELECTED_BROKER],
- service_component_name = ctx.instance.runtime_properties[SERVICE_COMPONENT_NAME],
- config = p,
- reconfiguration_type = "program-flowlet-smart",
- logger = ctx.logger)
-
+ return discovery.reconfigure_in_broker(
+ cdap_broker_name = ctx.instance.runtime_properties[SELECTED_BROKER],
+ service_component_name = ctx.instance.runtime_properties[SERVICE_COMPONENT_NAME],
+ config = p,
+ reconfiguration_type = "program-flowlet-smart",
+ logger = ctx.logger)
def _validate_conns(connections):
"""
@@ -107,19 +109,6 @@ def _services_calls_iterator(services_calls):
for_config[s["config_key"]] = "{{ " + s["service_component_type"] + " }}" #will get bound by CBS
return for_config
-
-######################
-# TEMPORARY!!!!!!
-# THIS WILL GO AWAY ONCE ALEX HAS A NODE TYPE AND PLUGIN
-######################
-@operation
-@Policies.populate_policy_on_node
-def policy_get(**kwargs):
- """decorate with @Policies.populate_policy_on_node on dcae.policy node to
- retrieve the latest policy_body for policy_id property and save it in runtime_properties
- """
- pass
-
######################
# Cloudify Operations
######################
@@ -252,11 +241,7 @@ def app_smart_reconfigure(new_config_template, **kwargs):
"""
try:
ctx.logger.info("Reconfiguring CDAP application via smart interface")
- discovery.reconfigure_in_broker(cdap_broker_name = ctx.instance.runtime_properties[SELECTED_BROKER],
- service_component_name = ctx.instance.runtime_properties[SERVICE_COMPONENT_NAME],
- config = new_config_template, #This keyname will likely change per policy handler
- reconfiguration_type = "program-flowlet-smart",
- logger = ctx.logger)
+ _trigger_update([new_config_template])
except Exception as e:
raise NonRecoverableError("CDAP Reconfigure error: {0}".format(e))
diff --git a/cdap/cdapplugin/requirements.txt b/cdap/cdapplugin/requirements.txt
index 48ff425..a522688 100644
--- a/cdap/cdapplugin/requirements.txt
+++ b/cdap/cdapplugin/requirements.txt
@@ -1,3 +1,3 @@
--extra-index-url {{ TODO }}/simple
-dcaepolicy==0.0.3
+dcaepolicy==0.0.4
uuid==1.30
diff --git a/cdap/cdapplugin/setup.py b/cdap/cdapplugin/setup.py
index 8498473..56e05f4 100644
--- a/cdap/cdapplugin/setup.py
+++ b/cdap/cdapplugin/setup.py
@@ -22,7 +22,7 @@ from setuptools import setup, find_packages
setup(
name = "cdapcloudify",
- version = "14.2.0",
+ version = "14.2.1",
packages=find_packages(),
author = "Tommy Carpenter",
author_email = "tommy at research dot eh tee tee dot com",
@@ -32,7 +32,7 @@ setup(
url = "https://gerrit.onap.org/r/#/admin/projects/dcaegen2/platform/plugins",
zip_safe=False,
install_requires = [
- "dcaepolicy==0.0.3",
+ "dcaepolicy==0.0.4",
"uuid==1.30"
]
)
diff --git a/cdap/demo_blueprints/cdap_hello_world.yaml b/cdap/demo_blueprints/cdap_hello_world.yaml
index 197603f..f150cb0 100644
--- a/cdap/demo_blueprints/cdap_hello_world.yaml
+++ b/cdap/demo_blueprints/cdap_hello_world.yaml
@@ -2,9 +2,8 @@ tosca_definitions_version: cloudify_dsl_1_3
imports:
- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
- #- {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2 }}/type_files/cdap/14.0.2/cdap_types.yaml
- - {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2 }}/type_files/cdap/14.2.0/cdap_types.yaml
- #TODO: IMPORT ALEX'S TYPE FILE
+ - {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2 }}/type_files/cdap/14.2.1/cdap_types.yaml
+ - {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2 }}/type_files/dcaepolicy/0.0.1/node-type.yaml
inputs:
hello_world_jar_url:
@@ -13,25 +12,6 @@ inputs:
type: string
default : "cdap_broker"
-#TODO: THIS WILL GO AWAY ONCE TYPE FILE IS IMP[ORTED
-node_types:
- dcae.nodes.policy:
- derived_from: cloudify.nodes.Root
- properties:
- policy_id:
- description: PK to policy
- type: string
- default: DCAE_alex.Config_empty-policy
- policy_apply_mode:
- description: choice of how to apply the policy update - none or script
- type: string
- default: none
- interfaces:
- cloudify.interfaces.lifecycle:
- create:
- implementation: cdap_deploy.cdapcloudify.cdap_plugin.policy_get
-#TODO: THIS WILL GO AWAY ONCE TYPE FILE IS IMP[ORTED
-
node_templates:
hw_app_policy_test:
type: dcae.nodes.policy
@@ -53,8 +33,8 @@ node_templates:
'who'
service_endpoints:
[{"service_name" : "Greeting", "service_endpoint" : "greet", "endpoint_method" : "GET"}]
- app_config: {"foo" : "foo-test"}
- app_preferences: {"foo_updated" : "foo-pref-test"}
+ app_config: {"foo" : "you should never see this; it should be overwritten by policy"}
+ app_preferences: {"foo_updated" : "you should never see this; it should be overwritten by policy"}
interfaces:
cloudify.interfaces.lifecycle:
diff --git a/cdap/demo_blueprints/cdap_hello_world_reconfigure.sh b/cdap/demo_blueprints/cdap_hello_world_reconfigure.sh
index c5df2f5..95efe60 100755
--- a/cdap/demo_blueprints/cdap_hello_world_reconfigure.sh
+++ b/cdap/demo_blueprints/cdap_hello_world_reconfigure.sh
@@ -1,4 +1,4 @@
#!/bin/bash
-cfy executions start -d cdap-hello-world -w execute_operation -p '{"operation" : "reconfiguration.app_config_reconfigure", "node_ids" : ["hw_cdap_app"], "operation_kwargs" : {"new_config_template" : {"foo":"bar"}}, "allow_kwargs_override": true}'
-cfy executions start -d cdap-hello-world -w execute_operation -p '{"operation" : "reconfiguration.app_preferences_reconfigure", "node_ids" : ["hw_cdap_app"], "operation_kwargs" : {"new_config_template" : {"fooprefs":"barprefs"}}, "allow_kwargs_override": true}'
-cfy executions start -d cdap-hello-world -w execute_operation -p '{"operation" : "reconfiguration.app_smart_reconfigure", "node_ids" : ["hw_cdap_app"], "operation_kwargs" : {"new_config_template" : {"fooprefs":"SO SMARTTTTTT", "foo":"SO SMART AGAINNNNN"}}, "allow_kwargs_override": true}'
+cfy executions start -d cdap_hello_world -w execute_operation -p '{"operation" : "reconfiguration.app_config_reconfigure", "node_ids" : ["hw_cdap_app"], "operation_kwargs" : {"new_config_template" : {"foo":"bar-manual-update"}}, "allow_kwargs_override": true}'
+cfy executions start -d cdap_hello_world -w execute_operation -p '{"operation" : "reconfiguration.app_preferences_reconfigure", "node_ids" : ["hw_cdap_app"], "operation_kwargs" : {"new_config_template" : {"foo_updated":"foo-pref-manual-update"}}, "allow_kwargs_override": true}'
+cfy executions start -d cdap_hello_world -w execute_operation -p '{"operation" : "reconfiguration.app_smart_reconfigure", "node_ids" : ["hw_cdap_app"], "operation_kwargs" : {"new_config_template" : {"foo_updated":"SO SMARTTTTTT", "foo":"SO SMART AGAINNNNN"}}, "allow_kwargs_override": true}'