From 81b242147f174fc5d7cc983c36769d029ac1761b Mon Sep 17 00:00:00 2001 From: Tommy Carpenter Date: Mon, 11 Sep 2017 11:59:09 -0400 Subject: Cleanup after Policy update Issue-ID: DCAEGEN2-96 Change-Id: Iebc195340211faea6d0bcc834015117ba9ded09d Signed-off-by: Tommy Carpenter --- cdap/cdapplugin/cdapcloudify/cdap_plugin.py | 33 ++++++++--------------------- cdap/cdapplugin/requirements.txt | 2 +- cdap/cdapplugin/setup.py | 4 ++-- 3 files changed, 12 insertions(+), 27 deletions(-) (limited to 'cdap/cdapplugin') 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" ] ) -- cgit 1.2.3-korg